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
CommitLineData
b3abae2a
JH
1#!/usr/bin/perl -w
2
3use strict;
4use Test;
5
6BEGIN
7 {
8 $| = 1;
091c87b1
T
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
56b9c951 29 plan tests => 7;
b3abae2a
JH
30 }
31
32use Math::BigInt ':constant';
33
34ok (2 ** 255,'57896044618658097711785492504343953926634992332820282019728792003956564819968');
35
56b9c951 36{
2ab5f49d 37 no warnings 'portable'; # protect against "non-portable" warnings
8f675a64
JH
38# hexadecimal constants
39ok (0x123456789012345678901234567890,
40 Math::BigInt->new('0x123456789012345678901234567890'));
41# binary constants
42ok (0b01010100011001010110110001110011010010010110000101101101,
43 Math::BigInt->new(
56b9c951
JH
44 '0b01010100011001010110110001110011010010010110000101101101'));
45}
46
b3abae2a
JH
47use Math::BigFloat ':constant';
48ok (1.0 / 3.0, '0.3333333333333333333333333333333333333333');
49
50# stress-test Math::BigFloat->import()
51
52Math::BigFloat->import( qw/:constant/ );
53ok (1,1);
54
55Math::BigFloat->import( qw/:constant upgrade Math::BigRat/ );
56ok (1,1);
57
58Math::BigFloat->import( qw/upgrade Math::BigRat :constant/ );
59ok (1,1);
60
61# all tests done
62