4 BEGIN { plan tests => 6 };
6 BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; }
8 use JSON -support_by_pp;
10 eval q| require Math::BigInt |;
13 skip "Can't load Math::BigInt.", 6 if ($@);
15 my $v = Math::BigInt->VERSION;
25 $json->allow_nonref->allow_bignum(1);
26 $json->convert_blessed->allow_blessed;
28 my $num = $json->decode(q|100000000000000000000000000000000000000|);
30 isa_ok($num, 'Math::BigInt');
31 is("$num", $fix . '100000000000000000000000000000000000000');
32 is($json->encode($num), $fix . '100000000000000000000000000000000000000');
34 $num = $json->decode(q|2.0000000000000000001|);
36 isa_ok($num, 'Math::BigFloat');
37 is("$num", '2.0000000000000000001');
38 is($json->encode($num), '2.0000000000000000001');