Commit | Line | Data |
b3abae2a |
1 | #!/usr/bin/perl -w |
2 | |
3 | use strict; |
4 | use Test; |
5 | |
6 | BEGIN |
7 | { |
8 | $| = 1; |
9 | chdir 't' if -d 't'; |
10 | unshift @INC, '../lib'; # for running manually |
56b9c951 |
11 | plan tests => 7; |
b3abae2a |
12 | } |
13 | |
14 | use Math::BigInt ':constant'; |
15 | |
16 | ok (2 ** 255,'57896044618658097711785492504343953926634992332820282019728792003956564819968'); |
17 | |
56b9c951 |
18 | { |
8f675a64 |
19 | no warnings 'portable'; |
20 | # hexadecimal constants |
21 | ok (0x123456789012345678901234567890, |
22 | Math::BigInt->new('0x123456789012345678901234567890')); |
23 | # binary constants |
24 | ok (0b01010100011001010110110001110011010010010110000101101101, |
25 | Math::BigInt->new( |
56b9c951 |
26 | '0b01010100011001010110110001110011010010010110000101101101')); |
27 | } |
28 | |
b3abae2a |
29 | use Math::BigFloat ':constant'; |
30 | ok (1.0 / 3.0, '0.3333333333333333333333333333333333333333'); |
31 | |
32 | # stress-test Math::BigFloat->import() |
33 | |
34 | Math::BigFloat->import( qw/:constant/ ); |
35 | ok (1,1); |
36 | |
37 | Math::BigFloat->import( qw/:constant upgrade Math::BigRat/ ); |
38 | ok (1,1); |
39 | |
40 | Math::BigFloat->import( qw/upgrade Math::BigRat :constant/ ); |
41 | ok (1,1); |
42 | |
43 | # all tests done |
44 | |