X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMath%2FBigInt%2Ft%2Fbigintc.t;h=05b5fccdfc8d21a2029f33f8dc7aab808504f1c2;hb=394e6ffb59de984c27a7dce4842d9c594c141888;hp=87006b044ad56eb77af80a3657c95281dd4a9f68;hpb=027dc3881cf72be7400bcb34bc5555fc060cbbc5;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Math/BigInt/t/bigintc.t b/lib/Math/BigInt/t/bigintc.t index 87006b0..05b5fcc 100644 --- a/lib/Math/BigInt/t/bigintc.t +++ b/lib/Math/BigInt/t/bigintc.t @@ -8,7 +8,7 @@ BEGIN $| = 1; chdir 't' if -d 't'; unshift @INC, '../lib'; # for running manually - plan tests => 56; + plan tests => 63; } # testing of Math::BigInt::Calc, primarily for interface/api and not for the @@ -128,6 +128,24 @@ $x = $C->_new(\$x); $C->_dec($x); ok (${$C->_str($x)},$z); # should not happen: # $x = $C->_new(\"-2"); $y = $C->_new(\"4"); ok ($C->_acmp($x,$y),-1); +# _mod +$x = $C->_new(\"1000"); $y = $C->_new(\"3"); +ok (${$C->_str(scalar $C->_mod($x,$y))},1); +$x = $C->_new(\"1000"); $y = $C->_new(\"2"); +ok (${$C->_str(scalar $C->_mod($x,$y))},0); + +# _and, _or, _xor +$x = $C->_new(\"5"); $y = $C->_new(\"2"); +ok (${$C->_str(scalar $C->_xor($x,$y))},7); +$x = $C->_new(\"5"); $y = $C->_new(\"2"); +ok (${$C->_str(scalar $C->_or($x,$y))},7); +$x = $C->_new(\"5"); $y = $C->_new(\"3"); +ok (${$C->_str(scalar $C->_and($x,$y))},1); + +# _from_hex, _from_bin +ok (${$C->_str(scalar $C->_from_hex(\"0xFf"))},255); +ok (${$C->_str(scalar $C->_from_bin(\"0b10101011"))},160+11); + # _check $x = $C->_new(\"123456789"); ok ($C->_check($x),0);