diff options
author | Karel Miko <karel.miko@gmail.com> | 2019-10-19 19:28:41 +0200 |
---|---|---|
committer | Karel Miko <karel.miko@gmail.com> | 2019-10-19 19:28:41 +0200 |
commit | bc6b3c66ce09ecd2e787702954029f18a44aa776 (patch) | |
tree | 0c31582c398e1d61d9f010e923f637cfcb900c7e /t | |
parent | befdfb1d06e8558de775ae555d71b225c965a4fa (diff) |
fix #56 Math::BigInt 1.999817 breaks the tests of CryptX
Diffstat (limited to 't')
-rw-r--r-- | t/mbi_ltm/bigintpm.inc | 8 | ||||
-rw-r--r-- | t/mbi_ltm_bigintpm.t | 2 | ||||
-rw-r--r-- | t/mbi_ltm_bugs.t | 54 |
3 files changed, 19 insertions, 45 deletions
diff --git a/t/mbi_ltm/bigintpm.inc b/t/mbi_ltm/bigintpm.inc index 35efeca4..2792cca7 100644 --- a/t/mbi_ltm/bigintpm.inc +++ b/t/mbi_ltm/bigintpm.inc @@ -2643,10 +2643,10 @@ abc:12:NaN -2:3:-8 -2:4:16 -2:5:-32 -2:-1:NaN --2:-1:NaN -2:-2:NaN --2:-2:NaN +2:-1:0 +-2:-1:0 +2:-2:0 +-2:-2:0 # inf tests +inf:1234500012:inf -inf:1234500012:inf diff --git a/t/mbi_ltm_bigintpm.t b/t/mbi_ltm_bigintpm.t index 976e7b1e..b90213f7 100644 --- a/t/mbi_ltm_bigintpm.t +++ b/t/mbi_ltm_bigintpm.t @@ -6,7 +6,7 @@ use warnings; use Test::More; BEGIN { - plan skip_all => "requires Math::BigInt 1.999712+" unless eval { require Math::BigInt && eval($Math::BigInt::VERSION) >= 1.999712 }; + plan skip_all => "requires Math::BigInt 1.999817+" unless eval { require Math::BigInt && eval($Math::BigInt::VERSION) >= 1.999817 }; plan tests => 3712 # tests in require'd file + 6; # tests in this file } diff --git a/t/mbi_ltm_bugs.t b/t/mbi_ltm_bugs.t index 976e7b1e..3c535285 100644 --- a/t/mbi_ltm_bugs.t +++ b/t/mbi_ltm_bugs.t @@ -6,47 +6,21 @@ use warnings; use Test::More; BEGIN { - plan skip_all => "requires Math::BigInt 1.999712+" unless eval { require Math::BigInt && eval($Math::BigInt::VERSION) >= 1.999712 }; - plan tests => 3712 # tests in require'd file - + 6; # tests in this file + plan skip_all => "requires Math::BigInt" unless eval { require Math::BigInt }; + plan tests => 2; } use Math::BigInt lib => 'LTM'; -our ($CLASS, $CALC); -$CLASS = "Math::BigInt"; -$CALC = "Math::BigInt::LTM"; - -my $x; - -############################################################################# -# from_hex(), from_bin() and from_oct() tests - -$x = Math::BigInt->from_hex('0xcafe'); -is($x, "51966", - qq|Math::BigInt->from_hex("0xcafe")|); - -$x = Math::BigInt->from_hex('0xcafebabedead'); -is($x, "223195403574957", - qq|Math::BigInt->from_hex("0xcafebabedead")|); - -$x = Math::BigInt->from_bin('0b1001'); -is($x, "9", - qq|Math::BigInt->from_bin("0b1001")|); - -$x = Math::BigInt->from_bin('0b1001100110011001100110011001'); -is($x, "161061273", - qq|Math::BigInt->from_bin("0b1001100110011001100110011001");|); - -$x = Math::BigInt->from_oct('0775'); -is($x, "509", - qq|Math::BigInt->from_oct("0775");|); - -$x = Math::BigInt->from_oct('07777777777777711111111222222222'); -is($x, "9903520314281112085086151826", - qq|Math::BigInt->from_oct("07777777777777711111111222222222");|); - -############################################################################# -# all the other tests - -require './t/mbi_ltm/bigintpm.inc'; # all tests here for sharing +my $V = $Math::BigInt::VERSION; + +# https://github.com/DCIT/perl-CryptX/issues/56 +{ + my ($x, $y); + $x = Math::BigInt->new("2"); + $y = Math::BigInt->new("-1"); + is($x ** $y, $V < 1.999817 ? 'NaN' : 0); + $x = Math::BigInt->new("-2"); + $y = Math::BigInt->new("-2"); + is($x ** $y, $V < 1.999817 ? 'NaN' : 0); +} |