diff options
author | Jim Meyering <jim@meyering.net> | 1997-02-19 03:38:52 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1997-02-19 03:38:52 +0000 |
commit | 5234813a09891a2788384edc961667c80174e290 (patch) | |
tree | 60be8b367549d2d0e6b40258074d17583d20fef5 /tests/factor | |
parent | 3b8313838c6d23b7b0b48dfb2933c5be1d5e3c7d (diff) | |
download | coreutils-5234813a09891a2788384edc961667c80174e290.tar.xz |
.
Diffstat (limited to 'tests/factor')
-rw-r--r-- | tests/factor/Makefile.am | 8 | ||||
-rw-r--r-- | tests/factor/Test.pm | 38 | ||||
-rw-r--r-- | tests/factor/factor-tests | 427 |
3 files changed, 463 insertions, 10 deletions
diff --git a/tests/factor/Makefile.am b/tests/factor/Makefile.am index d6c2b56f6..df1519f43 100644 --- a/tests/factor/Makefile.am +++ b/tests/factor/Makefile.am @@ -3,8 +3,12 @@ ##test-files-begin x = factor explicit = -maint_gen = 1.X 2.X 3.X 4.X -run_gen = 1.O 1.E 2.O 2.E 3.O 3.E 4.O 4.E +maint_gen = 1.X 1a.X 2.X 3.X 4.X a.X b.X c.X d.X e.X f.X g.X h.X i.X j.X k.X \ +l.X m.X n.X o.X p.X q.X s.X t.X u.X v.X w.X x.X y.X +run_gen = 1.O 1.E 1a.O 1a.E 2.O 2.E 3.O 3.E 4.O 4.E a.O a.E b.O b.E c.O c.E \ +d.O d.E e.O e.E f.O f.E g.O g.E h.O h.E i.O i.E j.O j.E k.O k.E l.O l.E m.O \ +m.E n.O n.E o.O o.E p.O p.E q.O q.E s.O s.E t.O t.E u.O u.E v.O v.E w.O w.E \ +x.O x.E y.O y.E ##test-files-end EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen) diff --git a/tests/factor/Test.pm b/tests/factor/Test.pm index 7afaddc6f..1f1c54048 100644 --- a/tests/factor/Test.pm +++ b/tests/factor/Test.pm @@ -9,21 +9,45 @@ sub test_vector ( # test-name options input expected-output expected-return-code # - ['1', "9", {}, '9: 3 3', 0], - ['2', "4294967291", {}, '4294967291: 4294967291', 0], - ['3', "4294967292", {}, '4294967292: 2 2 3 3 7 11 31 151 331', 0], - ['4', "4294967293", {}, '4294967293: 9241 464773', 0], + ['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], - # FIXME: add a lot more... + ['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, $flags, $in, $exp, $ret) = @$t; + my ($test_name, $arg, $in, $exp, $ret) = @$t; # Append a newline to end of each expected string. - push (@tv, [$test_name, $flags, $in, "$exp\n", $ret]); + push (@tv, [$test_name, $arg, $in, "$arg: $exp\n", $ret]); } return @tv; diff --git a/tests/factor/factor-tests b/tests/factor/factor-tests index 2847bdd3d..daa97e9b4 100644 --- a/tests/factor/factor-tests +++ b/tests/factor/factor-tests @@ -26,6 +26,23 @@ else esac fi test -s 1.E || rm -f 1.E +$xx 7 > 1a.O 2> 1a.E +code=$? +if test $code != 0 ; then + $echo "Test 1a failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp 1a.O $srcdir/1a.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed 1a"; fi ;; + 1) $echo "Test 1a failed: files 1a.O and $srcdir/1a.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test 1a may have failed." 1>&2; + $echo The command "cmp 1a.O $srcdir/1a.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s 1a.E || rm -f 1a.E $xx 4294967291 > 2.O 2> 2.E code=$? if test $code != 0 ; then @@ -77,8 +94,416 @@ else esac fi test -s 4.E || rm -f 4.E +$xx 4294966201 > a.O 2> a.E +code=$? +if test $code != 0 ; then + $echo "Test a failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp a.O $srcdir/a.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed a"; fi ;; + 1) $echo "Test a failed: files a.O and $srcdir/a.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test a may have failed." 1>&2; + $echo The command "cmp a.O $srcdir/a.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s a.E || rm -f a.E +$xx 4294966339 > b.O 2> b.E +code=$? +if test $code != 0 ; then + $echo "Test b failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp b.O $srcdir/b.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed b"; fi ;; + 1) $echo "Test b failed: files b.O and $srcdir/b.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test b may have failed." 1>&2; + $echo The command "cmp b.O $srcdir/b.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s b.E || rm -f b.E +$xx 4294966631 > c.O 2> c.E +code=$? +if test $code != 0 ; then + $echo "Test c failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp c.O $srcdir/c.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed c"; fi ;; + 1) $echo "Test c failed: files c.O and $srcdir/c.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test c may have failed." 1>&2; + $echo The command "cmp c.O $srcdir/c.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s c.E || rm -f c.E +$xx 4294966457 > d.O 2> d.E +code=$? +if test $code != 0 ; then + $echo "Test d failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp d.O $srcdir/d.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed d"; fi ;; + 1) $echo "Test d failed: files d.O and $srcdir/d.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test d may have failed." 1>&2; + $echo The command "cmp d.O $srcdir/d.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s d.E || rm -f d.E +$xx 4294966759 > e.O 2> e.E +code=$? +if test $code != 0 ; then + $echo "Test e failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp e.O $srcdir/e.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed e"; fi ;; + 1) $echo "Test e failed: files e.O and $srcdir/e.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test e may have failed." 1>&2; + $echo The command "cmp e.O $srcdir/e.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s e.E || rm -f e.E +$xx 4294966573 > f.O 2> f.E +code=$? +if test $code != 0 ; then + $echo "Test f failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp f.O $srcdir/f.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed f"; fi ;; + 1) $echo "Test f failed: files f.O and $srcdir/f.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test f may have failed." 1>&2; + $echo The command "cmp f.O $srcdir/f.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s f.E || rm -f f.E +$xx 4294967101 > g.O 2> g.E +code=$? +if test $code != 0 ; then + $echo "Test g failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp g.O $srcdir/g.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed g"; fi ;; + 1) $echo "Test g failed: files g.O and $srcdir/g.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test g may have failed." 1>&2; + $echo The command "cmp g.O $srcdir/g.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s g.E || rm -f g.E +$xx 4294966519 > h.O 2> h.E +code=$? +if test $code != 0 ; then + $echo "Test h failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp h.O $srcdir/h.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed h"; fi ;; + 1) $echo "Test h failed: files h.O and $srcdir/h.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test h may have failed." 1>&2; + $echo The command "cmp h.O $srcdir/h.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s h.E || rm -f h.E +$xx 4294966561 > i.O 2> i.E +code=$? +if test $code != 0 ; then + $echo "Test i failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp i.O $srcdir/i.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed i"; fi ;; + 1) $echo "Test i failed: files i.O and $srcdir/i.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test i may have failed." 1>&2; + $echo The command "cmp i.O $srcdir/i.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s i.E || rm -f i.E +$xx 4294966901 > j.O 2> j.E +code=$? +if test $code != 0 ; then + $echo "Test j failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp j.O $srcdir/j.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed j"; fi ;; + 1) $echo "Test j failed: files j.O and $srcdir/j.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test j may have failed." 1>&2; + $echo The command "cmp j.O $srcdir/j.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s j.E || rm -f j.E +$xx 4294966691 > k.O 2> k.E +code=$? +if test $code != 0 ; then + $echo "Test k failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp k.O $srcdir/k.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed k"; fi ;; + 1) $echo "Test k failed: files k.O and $srcdir/k.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test k may have failed." 1>&2; + $echo The command "cmp k.O $srcdir/k.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s k.E || rm -f k.E +$xx 4294966969 > l.O 2> l.E +code=$? +if test $code != 0 ; then + $echo "Test l failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp l.O $srcdir/l.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed l"; fi ;; + 1) $echo "Test l failed: files l.O and $srcdir/l.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test l may have failed." 1>&2; + $echo The command "cmp l.O $srcdir/l.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s l.E || rm -f l.E +$xx 4294967099 > m.O 2> m.E +code=$? +if test $code != 0 ; then + $echo "Test m failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp m.O $srcdir/m.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed m"; fi ;; + 1) $echo "Test m failed: files m.O and $srcdir/m.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test m may have failed." 1>&2; + $echo The command "cmp m.O $srcdir/m.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s m.E || rm -f m.E +$xx 4294966271 > n.O 2> n.E +code=$? +if test $code != 0 ; then + $echo "Test n failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp n.O $srcdir/n.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed n"; fi ;; + 1) $echo "Test n failed: files n.O and $srcdir/n.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test n may have failed." 1>&2; + $echo The command "cmp n.O $srcdir/n.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s n.E || rm -f n.E +$xx 4294966789 > o.O 2> o.E +code=$? +if test $code != 0 ; then + $echo "Test o failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp o.O $srcdir/o.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed o"; fi ;; + 1) $echo "Test o failed: files o.O and $srcdir/o.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test o may have failed." 1>&2; + $echo The command "cmp o.O $srcdir/o.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s o.E || rm -f o.E +$xx 4294966189 > p.O 2> p.E +code=$? +if test $code != 0 ; then + $echo "Test p failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp p.O $srcdir/p.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed p"; fi ;; + 1) $echo "Test p failed: files p.O and $srcdir/p.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test p may have failed." 1>&2; + $echo The command "cmp p.O $srcdir/p.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s p.E || rm -f p.E +$xx 4294967213 > q.O 2> q.E +code=$? +if test $code != 0 ; then + $echo "Test q failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp q.O $srcdir/q.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed q"; fi ;; + 1) $echo "Test q failed: files q.O and $srcdir/q.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test q may have failed." 1>&2; + $echo The command "cmp q.O $srcdir/q.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s q.E || rm -f q.E +$xx 4294967071 > s.O 2> s.E +code=$? +if test $code != 0 ; then + $echo "Test s failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp s.O $srcdir/s.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed s"; fi ;; + 1) $echo "Test s failed: files s.O and $srcdir/s.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test s may have failed." 1>&2; + $echo The command "cmp s.O $srcdir/s.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s s.E || rm -f s.E +$xx 4294966194 > t.O 2> t.E +code=$? +if test $code != 0 ; then + $echo "Test t failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp t.O $srcdir/t.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed t"; fi ;; + 1) $echo "Test t failed: files t.O and $srcdir/t.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test t may have failed." 1>&2; + $echo The command "cmp t.O $srcdir/t.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s t.E || rm -f t.E +$xx 4294966272 > u.O 2> u.E +code=$? +if test $code != 0 ; then + $echo "Test u failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp u.O $srcdir/u.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed u"; fi ;; + 1) $echo "Test u failed: files u.O and $srcdir/u.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test u may have failed." 1>&2; + $echo The command "cmp u.O $srcdir/u.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s u.E || rm -f u.E +$xx 4294966400 > v.O 2> v.E +code=$? +if test $code != 0 ; then + $echo "Test v failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp v.O $srcdir/v.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed v"; fi ;; + 1) $echo "Test v failed: files v.O and $srcdir/v.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test v may have failed." 1>&2; + $echo The command "cmp v.O $srcdir/v.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s v.E || rm -f v.E +$xx 4294966464 > w.O 2> w.E +code=$? +if test $code != 0 ; then + $echo "Test w failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp w.O $srcdir/w.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed w"; fi ;; + 1) $echo "Test w failed: files w.O and $srcdir/w.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test w may have failed." 1>&2; + $echo The command "cmp w.O $srcdir/w.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s w.E || rm -f w.E +$xx 4294966896 > x.O 2> x.E +code=$? +if test $code != 0 ; then + $echo "Test x failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp x.O $srcdir/x.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed x"; fi ;; + 1) $echo "Test x failed: files x.O and $srcdir/x.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test x may have failed." 1>&2; + $echo The command "cmp x.O $srcdir/x.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s x.E || rm -f x.E +$xx 4294966998 > y.O 2> y.E +code=$? +if test $code != 0 ; then + $echo "Test y failed: ../../src/factor return code $code differs from expected value 0" 1>&2 + errors=`expr $errors + 1` +else + cmp y.O $srcdir/y.X + case $? in + 0) if test "$VERBOSE" ; then $echo "passed y"; fi ;; + 1) $echo "Test y failed: files y.O and $srcdir/y.X differ" 1>&2; + errors=`expr $errors + 1` ;; + 2) $echo "Test y may have failed." 1>&2; + $echo The command "cmp y.O $srcdir/y.X" failed. 1>&2 ; + errors=`expr $errors + 1` ;; + esac +fi +test -s y.E || rm -f y.E if test $errors = 0 ; then - $echo Passed all 4 tests. 1>&2 + $echo Passed all 29 tests. 1>&2 else $echo Failed $errors tests. 1>&2 fi |