This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In XS_VERSION_BOOTCHECK, correct the flags argument of get_sv() to 0.
[perl5.git] / cpan / Math-BigInt / t / constant.t
1 #!/usr/bin/perl -w
2
3 use strict;
4 use Test;
5
6 BEGIN
7   {
8   $| = 1;
9   # to locate the testing files
10   my $location = $0; $location =~ s/constant.t//i;
11   if ($ENV{PERL_CORE})
12     {
13     # testing with the core distribution
14     @INC = qw(../t/lib);
15     }
16   unshift @INC, qw(../lib);
17   if (-d 't')
18     {
19     chdir 't';
20     require File::Spec;
21     unshift @INC, File::Spec->catdir(File::Spec->updir, $location);
22     }
23   else
24     {
25     unshift @INC, $location;
26     }
27   print "# INC = @INC\n";
28
29   plan tests => 7;
30   } 
31
32 use Math::BigInt ':constant';
33
34 ok (2 ** 255,'57896044618658097711785492504343953926634992332820282019728792003956564819968');
35
36 {
37   no warnings 'portable';       # protect against "non-portable" warnings
38 # hexadecimal constants
39 ok (0x123456789012345678901234567890,
40     Math::BigInt->new('0x123456789012345678901234567890'));
41 # binary constants
42 ok (0b01010100011001010110110001110011010010010110000101101101,
43     Math::BigInt->new(
44      '0b01010100011001010110110001110011010010010110000101101101'));
45 }
46
47 use Math::BigFloat ':constant';
48 ok (1.0 / 3.0, '0.3333333333333333333333333333333333333333');
49
50 # stress-test Math::BigFloat->import()
51
52 Math::BigFloat->import( qw/:constant/ );
53 ok (1,1);
54
55 Math::BigFloat->import( qw/:constant upgrade Math::BigRat/ );
56 ok (1,1);
57
58 Math::BigFloat->import( qw/upgrade Math::BigRat :constant/ );
59 ok (1,1);
60
61 # all tests done
62