diff options
author | markm <markm@FreeBSD.org> | 2000-06-25 11:04:01 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2000-06-25 11:04:01 +0000 |
commit | 2618fad5bbb2d0182eb31ed805c41b543c513940 (patch) | |
tree | 52ba93338b13aefd02a0055304a9eccfa0e049f5 /contrib/perl5/t/lib/bigintpm.t | |
parent | 77644ee620b6a79cf8c538abaf7cd301a875528d (diff) | |
download | FreeBSD-src-2618fad5bbb2d0182eb31ed805c41b543c513940.zip FreeBSD-src-2618fad5bbb2d0182eb31ed805c41b543c513940.tar.gz |
Vendor import of Perl 5.006
Diffstat (limited to 'contrib/perl5/t/lib/bigintpm.t')
-rwxr-xr-x | contrib/perl5/t/lib/bigintpm.t | 116 |
1 files changed, 90 insertions, 26 deletions
diff --git a/contrib/perl5/t/lib/bigintpm.t b/contrib/perl5/t/lib/bigintpm.t index e7cac26..ae362e2 100755 --- a/contrib/perl5/t/lib/bigintpm.t +++ b/contrib/perl5/t/lib/bigintpm.t @@ -2,14 +2,14 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; + unshift @INC, '../lib'; } use Math::BigInt; $test = 0; $| = 1; -print "1..247\n"; +print "1..278\n"; while (<DATA>) { chop; if (s/^&//) { @@ -27,20 +27,32 @@ while (<DATA>) { $try .= "abs \$x;"; } else { $try .= "\$y = new Math::BigInt \"$args[1]\";"; - if ($f eq bcmp){ + if ($f eq "bcmp"){ $try .= "\$x <=> \$y;"; - }elsif ($f eq badd){ + }elsif ($f eq "badd"){ $try .= "\$x + \$y;"; - }elsif ($f eq bsub){ + }elsif ($f eq "bsub"){ $try .= "\$x - \$y;"; - }elsif ($f eq bmul){ + }elsif ($f eq "bmul"){ $try .= "\$x * \$y;"; - }elsif ($f eq bdiv){ + }elsif ($f eq "bdiv"){ $try .= "\$x / \$y;"; - }elsif ($f eq bmod){ + }elsif ($f eq "bmod"){ $try .= "\$x % \$y;"; - }elsif ($f eq bgcd){ + }elsif ($f eq "bgcd"){ $try .= "Math::BigInt::bgcd(\$x, \$y);"; + }elsif ($f eq "blsft"){ + $try .= "\$x << \$y;"; + }elsif ($f eq "brsft"){ + $try .= "\$x >> \$y;"; + }elsif ($f eq "band"){ + $try .= "\$x & \$y;"; + }elsif ($f eq "bior"){ + $try .= "\$x | \$y;"; + }elsif ($f eq "bxor"){ + $try .= "\$x ^ \$y;"; + }elsif ($f eq "bnot"){ + $try .= "~\$x;"; } else { warn "Unknown op"; } } #print ">>>",$try,"<<<\n"; @@ -52,7 +64,24 @@ while (<DATA>) { print "# '$try' expected: '$ans' got: '$ans1'\n"; } } -} +} + +{ + use Math::BigInt ':constant'; + + $test++; + print "not " + unless 2**150 eq "+1427247692705959881058285969449495136382746624"; + print "ok $test\n"; + $test++; + @a = (); + for ($i = 1; $i < 10; $i++) { + push @a, $i; + } + print "not " unless "@a" eq "+1 +2 +3 +4 +5 +6 +7 +8 +9"; + print "ok $test\n"; +} + __END__ &bnorm abc:NaN @@ -93,29 +122,29 @@ abc:NaN +123456789:+123456789 -123456789:+123456789 &bcmp -abc:abc:NaN -abc:+0:NaN -+0:abc:NaN -+0:+0:+0 +abc:abc: +abc:+0: ++0:abc: ++0:+0:0 -1:+0:-1 -+0:-1:+1 -+1:+0:+1 ++0:-1:1 ++1:+0:1 +0:+1:-1 -1:+1:-1 -+1:-1:+1 --1:-1:+0 -+1:+1:+0 -+123:+123:+0 -+123:+12:+1 ++1:-1:1 +-1:-1:0 ++1:+1:0 ++123:+123:0 ++123:+12:1 +12:+123:-1 --123:-123:+0 +-123:-123:0 -123:-12:-1 --12:-123:+1 +-12:-123:1 +123:+124:-1 -+124:+123:+1 --123:-124:+1 ++124:+123:1 +-123:-124:1 -124:-123:-1 -+100:+5:+1 ++100:+5:1 &badd abc:abc:NaN abc:+0:NaN @@ -311,3 +340,38 @@ abc:+0:NaN +3:+2:+1 +100:+625:+25 +4096:+81:+1 +&blsft +abc:abc:NaN ++2:+2:+8 ++1:+32:+4294967296 ++1:+48:+281474976710656 ++8:-2:NaN +&brsft +abc:abc:NaN ++8:+2:+2 ++4294967296:+32:+1 ++281474976710656:+48:+1 ++2:-2:NaN +&band +abc:abc:NaN ++8:+2:+0 ++281474976710656:+0:+0 ++281474976710656:+1:+0 ++281474976710656:+281474976710656:+281474976710656 +&bior +abc:abc:NaN ++8:+2:+10 ++281474976710656:+0:+281474976710656 ++281474976710656:+1:+281474976710657 ++281474976710656:+281474976710656:+281474976710656 +&bxor +abc:abc:NaN ++8:+2:+10 ++281474976710656:+0:+281474976710656 ++281474976710656:+1:+281474976710657 ++281474976710656:+281474976710656:+0 +&bnot +abc:NaN ++0:-1 ++8:-9 ++281474976710656:-281474976710657 |