1 # copied over from JSON::PP::PC and modified to use JSON::PP
2 # copied over from JSON::PP::XS and modified to use JSON::PP
6 BEGIN { plan tests => 8 };
8 BEGIN { $ENV{PERL_JSON_BACKEND} = 0; }
12 #########################
14 my $pc = new JSON::PP;
17 $obj = $pc->decode($js);
18 is($obj->[0], -12.34, 'digit -12.34');
19 $js = $pc->encode($obj);
20 is($js,'[-12.34]', 'digit -12.34');
23 $obj = $pc->decode($js);
24 is($obj->[0], -123400, 'digit -1.234e5');
25 $js = $pc->encode($obj);
26 is($js,'[-123400]', 'digit -1.234e5');
29 $obj = $pc->decode($js);
30 is($obj->[0], 0.000123, 'digit 1.23E-4');
31 $js = $pc->encode($obj);
33 if ( $js =~ /\[1/ ) { # for 5.6.2 on Darwin 8.10.0
34 like($js, qr/[1.23[eE]-04]/, 'digit 1.23E-4');
37 is($js,'[0.000123]', 'digit 1.23E-4');
42 $js = q|[1.01e+67]|; # 30 -> 67 ... patched by H.Merijn Brand
43 $obj = $pc->decode($js);
44 is($obj->[0], 1.01e+67, 'digit 1.01e+67');
45 $js = $pc->encode($obj);
46 like($js,qr/\[1.01[Ee]\+0?67\]/, 'digit 1.01e+67');