Commit | Line | Data |
36ec1dfe |
1 | #!/usr/bin/perl -w |
2 | |
3 | # Test bpi() and bexp() |
4 | |
5 | use Test::More; |
6 | use strict; |
7 | |
8 | BEGIN |
9 | { |
10 | $| = 1; |
11 | # to locate the testing files |
12 | my $location = $0; $location =~ s/big_pi_e.t//i; |
13 | if ($ENV{PERL_CORE}) |
14 | { |
15 | # testing with the core distribution |
16 | @INC = qw(../lib); |
17 | } |
18 | unshift @INC, '../lib'; |
19 | if (-d 't') |
20 | { |
21 | chdir 't'; |
22 | require File::Spec; |
23 | unshift @INC, File::Spec->catdir(File::Spec->updir, $location); |
24 | } |
25 | else |
26 | { |
27 | unshift @INC, $location; |
28 | } |
29 | print "# INC = @INC\n"; |
30 | |
31 | plan tests => 8; |
32 | } |
33 | |
34 | use Math::BigFloat; |
35 | |
36 | ############################################################################# |
37 | |
38 | my $pi = Math::BigFloat::bpi(); |
39 | |
40 | ok (!exists $pi->{_a}, 'A not set'); |
41 | ok (!exists $pi->{_p}, 'P not set'); |
42 | |
43 | $pi = Math::BigFloat->bpi(); |
44 | |
45 | ok (!exists $pi->{_a}, 'A not set'); |
46 | ok (!exists $pi->{_p}, 'P not set'); |
47 | |
48 | $pi = Math::BigFloat->bpi(10); |
49 | |
50 | is ($pi->{_a}, 10, 'A set'); |
51 | is ($pi->{_p}, undef, 'P not set'); |
52 | |
53 | ############################################################################# |
54 | my $e = Math::BigFloat->new(1)->bexp(); |
55 | |
56 | ok (!exists $e->{_a}, 'A not set'); |
57 | ok (!exists $e->{_p}, 'P not set'); |
58 | |
59 | |