1N/A#!/usr/bin/perl -w
1N/A
1N/Ause strict;
1N/Ause Test;
1N/A
1N/ABEGIN
1N/A {
1N/A $| = 1;
1N/A # to locate the testing files
1N/A my $location = $0; $location =~ s/constant.t//i;
1N/A if ($ENV{PERL_CORE})
1N/A {
1N/A # testing with the core distribution
1N/A @INC = qw(../t/lib);
1N/A }
1N/A unshift @INC, qw(../lib);
1N/A if (-d 't')
1N/A {
1N/A chdir 't';
1N/A require File::Spec;
1N/A unshift @INC, File::Spec->catdir(File::Spec->updir, $location);
1N/A }
1N/A else
1N/A {
1N/A unshift @INC, $location;
1N/A }
1N/A print "# INC = @INC\n";
1N/A
1N/A plan tests => 7;
1N/A if ($] < 5.006)
1N/A {
1N/A for (1..7) { skip (1,'Not supported on older Perls'); }
1N/A exit;
1N/A }
1N/A }
1N/A
1N/Ause Math::BigInt ':constant';
1N/A
1N/Aok (2 ** 255,'57896044618658097711785492504343953926634992332820282019728792003956564819968');
1N/A
1N/A{
1N/A no warnings 'portable'; # protect against "non-portable" warnings
1N/A# hexadecimal constants
1N/Aok (0x123456789012345678901234567890,
1N/A Math::BigInt->new('0x123456789012345678901234567890'));
1N/A# binary constants
1N/Aok (0b01010100011001010110110001110011010010010110000101101101,
1N/A Math::BigInt->new(
1N/A '0b01010100011001010110110001110011010010010110000101101101'));
1N/A}
1N/A
1N/Ause Math::BigFloat ':constant';
1N/Aok (1.0 / 3.0, '0.3333333333333333333333333333333333333333');
1N/A
1N/A# stress-test Math::BigFloat->import()
1N/A
1N/AMath::BigFloat->import( qw/:constant/ );
1N/Aok (1,1);
1N/A
1N/AMath::BigFloat->import( qw/:constant upgrade Math::BigRat/ );
1N/Aok (1,1);
1N/A
1N/AMath::BigFloat->import( qw/upgrade Math::BigRat :constant/ );
1N/Aok (1,1);
1N/A
1N/A# all tests done
1N/A