Configure locincpth vs Jaguar gcc 3
[p5sagit/p5-mst-13.2.git] / lib / Math / BigInt / t / constant.t
CommitLineData
b3abae2a 1#!/usr/bin/perl -w
2
3use strict;
4use Test;
5
6BEGIN
7 {
8 $| = 1;
9 chdir 't' if -d 't';
10 unshift @INC, '../lib'; # for running manually
56b9c951 11 plan tests => 7;
07d34614 12 if ($] < 5.006)
13 {
14 for (1..7) { skip (1,'Not supported on older Perls'); }
15 exit;
16 }
b3abae2a 17 }
18
75d53f21 19no warnings 'portable'; # this must wait until after the version check
b3abae2a 20use Math::BigInt ':constant';
21
22ok (2 ** 255,'57896044618658097711785492504343953926634992332820282019728792003956564819968');
23
56b9c951 24{
56d9de68 25 local $^W = 0; # protect against "non-portable" warnings
8f675a64 26# hexadecimal constants
27ok (0x123456789012345678901234567890,
28 Math::BigInt->new('0x123456789012345678901234567890'));
29# binary constants
30ok (0b01010100011001010110110001110011010010010110000101101101,
31 Math::BigInt->new(
56b9c951 32 '0b01010100011001010110110001110011010010010110000101101101'));
33}
34
b3abae2a 35use Math::BigFloat ':constant';
36ok (1.0 / 3.0, '0.3333333333333333333333333333333333333333');
37
38# stress-test Math::BigFloat->import()
39
40Math::BigFloat->import( qw/:constant/ );
41ok (1,1);
42
43Math::BigFloat->import( qw/:constant upgrade Math::BigRat/ );
44ok (1,1);
45
46Math::BigFloat->import( qw/upgrade Math::BigRat :constant/ );
47ok (1,1);
48
49# all tests done
50