xref: /openbsd/gnu/usr.bin/perl/cpan/bignum/t/in_effect.t (revision eac174f2)
1*eac174f2Safresh1# -*- mode: perl; -*-
2b8851fccSafresh1
3b8851fccSafresh1###############################################################################
4b8851fccSafresh1# Test in_effect()
5b8851fccSafresh1
6b8851fccSafresh1use strict;
7b8851fccSafresh1use warnings;
8b8851fccSafresh1
9*eac174f2Safresh1use Test::More tests => 21;
10b8851fccSafresh1
11*eac174f2Safresh1{
12b8851fccSafresh1    use bigint;
13b8851fccSafresh1
14b8851fccSafresh1    can_ok('bigint', qw/in_effect/);
15b8851fccSafresh1
16b8851fccSafresh1  SKIP: {
17b8851fccSafresh1        skip('Need at least Perl v5.9.4', 3) if $] < "5.009005";
18b8851fccSafresh1
19b8851fccSafresh1        is(bigint::in_effect(), 1,     'bigint in effect');
20*eac174f2Safresh1        is(bigfloat::in_effect(), undef, 'bigfloat not in effect');
21*eac174f2Safresh1        is(bigrat::in_effect(), undef, 'bigint not in effect');
22b8851fccSafresh1    }
23b8851fccSafresh1
24b8851fccSafresh1    {
25b8851fccSafresh1        no bigint;
26*eac174f2Safresh1
27*eac174f2Safresh1        is(bigint::in_effect(), undef, 'bigint not in effect');
28*eac174f2Safresh1        is(bigfloat::in_effect(), undef, 'bigfloat not in effect');
29*eac174f2Safresh1        is(bigrat::in_effect(), undef, 'bigrat not in effect');
30*eac174f2Safresh1    }
31*eac174f2Safresh1}
32*eac174f2Safresh1
33*eac174f2Safresh1{
34*eac174f2Safresh1    use bigfloat;
35*eac174f2Safresh1
36*eac174f2Safresh1    can_ok('bigfloat', qw/in_effect/);
37*eac174f2Safresh1
38*eac174f2Safresh1  SKIP: {
39*eac174f2Safresh1        skip('Need at least Perl v5.9.4', 3) if $] < "5.009005";
40*eac174f2Safresh1
41*eac174f2Safresh1        is(bigint::in_effect(), undef, 'bigint not in effect');
42*eac174f2Safresh1        is(bigfloat::in_effect(), 1,     'bigfloat in effect');
43*eac174f2Safresh1        is(bigrat::in_effect(), undef, 'bigint not in effect');
44*eac174f2Safresh1    }
45*eac174f2Safresh1
46*eac174f2Safresh1    {
47*eac174f2Safresh1        no bigfloat;
48*eac174f2Safresh1
49*eac174f2Safresh1        is(bigint::in_effect(), undef, 'bigint not in effect');
50*eac174f2Safresh1        is(bigfloat::in_effect(), undef, 'bigfloat not in effect');
51*eac174f2Safresh1        is(bigrat::in_effect(), undef, 'bigrat not in effect');
52*eac174f2Safresh1    }
53*eac174f2Safresh1}
54*eac174f2Safresh1
55*eac174f2Safresh1{
56*eac174f2Safresh1    use bigrat;
57*eac174f2Safresh1
58*eac174f2Safresh1    can_ok('bigrat', qw/in_effect/);
59*eac174f2Safresh1
60*eac174f2Safresh1  SKIP: {
61*eac174f2Safresh1        skip('Need at least Perl v5.9.4', 3) if $] < "5.009005";
62*eac174f2Safresh1
63*eac174f2Safresh1        is(bigint::in_effect(), undef, 'bigint not in effect');
64*eac174f2Safresh1        is(bigfloat::in_effect(), undef, 'bigfloat not in effect');
65*eac174f2Safresh1        is(bigrat::in_effect(), 1,     'bigint in effect');
66*eac174f2Safresh1    }
67*eac174f2Safresh1
68*eac174f2Safresh1    {
69b8851fccSafresh1        no bigrat;
70b8851fccSafresh1
71b8851fccSafresh1        is(bigint::in_effect(), undef, 'bigint not in effect');
72*eac174f2Safresh1        is(bigfloat::in_effect(), undef, 'bigfloat not in effect');
73b8851fccSafresh1        is(bigrat::in_effect(), undef, 'bigrat not in effect');
74b8851fccSafresh1    }
75*eac174f2Safresh1}
76