summaryrefslogtreecommitdiff
path: root/tests/factor/Test.pm
blob: 1f1c540489c614d4e79d77f1f1eff60d022f8803 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# -*-perl-*-
package Test;
require 5.002;
use strict;

sub test_vector
{
  my @tvec =
    (
     # test-name options input expected-output expected-return-code
     #
     ['1', '9', {}, '3 3', 0],
     ['1a', '7', {}, '7', 0],
     ['2', '4294967291', {}, '4294967291', 0],
     ['3', '4294967292', {}, '2 2 3 3 7 11 31 151 331', 0],
     ['4', '4294967293', {}, '9241 464773', 0],

     ['a', '4294966201', {}, '12197 352133', 0],
     ['b', '4294966339', {}, '13187 325697', 0],
     ['c', '4294966631', {}, '13729 312839', 0],
     ['d', '4294966457', {}, '14891 288427', 0],
     ['e', '4294966759', {}, '21649 198391', 0],
     ['f', '4294966573', {}, '23071 186163', 0],
     ['g', '4294967101', {}, '23603 181967', 0],
     ['h', '4294966519', {}, '34583 124193', 0],
     ['i', '4294966561', {}, '36067 119083', 0],
     ['j', '4294966901', {}, '37747 113783', 0],
     ['k', '4294966691', {}, '39241 109451', 0],
     ['l', '4294966969', {}, '44201 97169', 0],
     ['m', '4294967099', {}, '44483 96553', 0],
     ['n', '4294966271', {}, '44617 96263', 0],
     ['o', '4294966789', {}, '50411 85199', 0],
     ['p', '4294966189', {}, '53197 80737', 0],
     ['q', '4294967213', {}, '57139 75167', 0],
     ['s', '4294967071', {}, '65521 65551', 0],
     ['t', '4294966194', {}, '2 3 3 3 3 3 3 3 53 97 191', 0],
     ['u', '4294966272', {}, '2 2 2 2 2 2 2 2 2 2 3 23 89 683', 0],
     ['v', '4294966400', {}, '2 2 2 2 2 2 2 5 5 1342177', 0],
     ['w', '4294966464', {}, '2 2 2 2 2 2 3 3 3 2485513', 0],
     ['x', '4294966896', {}, '2 2 2 2 3 3 3 11 607 1489', 0],
     ['y', '4294966998', {}, '2 3 7 3917 26107', 0],
     );

  my @tv;
  my $t;
  foreach $t (@tvec)
    {
      my ($test_name, $arg, $in, $exp, $ret) = @$t;
      # Append a newline to end of each expected string.
      push (@tv, [$test_name, $arg, $in, "$arg: $exp\n", $ret]);
    }

  return @tv;
}

1;