4 use Test::More tests => 3651 + 6;
6 use Math::BigInt lib => 'Calc';
8 use vars qw ($scale $class $try $x $y $f @args $ans $ans1 $ans1_str $setup $CL);
9 $class = "Math::BigInt";
10 $CL = "Math::BigInt::Calc";
12 #############################################################################
13 # from_hex(), from_bin() and from_oct() tests
15 my $x = Math::BigInt->from_hex('0xcafe');
16 is ($x, "51966", 'from_hex() works');
18 $x = Math::BigInt->from_hex('0xcafebabedead');
19 is ($x, "223195403574957", 'from_hex() works with long numbers');
21 $x = Math::BigInt->from_bin('0b1001');
22 is ($x, "9", 'from_bin() works');
24 $x = Math::BigInt->from_bin('0b1001100110011001100110011001');
25 is ($x, "161061273", 'from_bin() works with big numbers');
27 $x = Math::BigInt->from_oct('0775');
28 is ($x, "509", 'from_oct() works');
30 $x = Math::BigInt->from_oct('07777777777777711111111222222222');
31 is ($x, "9903520314281112085086151826", 'from_oct() works with big numbers');
33 #############################################################################
36 require 't/bigintpm.inc'; # all tests here for sharing