1# copied over from JSON::PC and modified to use JSON 2# copied over from JSON::XS and modified to use JSON 3 4use Test::More; 5use strict; 6BEGIN { plan tests => 6 }; 7 8BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; } 9 10use JSON; 11 12 13######################### 14my ($js,$obj); 15my $pc = new JSON; 16 17$js = '{"foo":0}'; 18$obj = $pc->decode($js); 19is($obj->{foo}, 0, "normal 0"); 20 21$js = '{"foo":0.1}'; 22$obj = $pc->decode($js); 23is($obj->{foo}, 0.1, "normal 0.1"); 24 25 26$js = '{"foo":10}'; 27$obj = $pc->decode($js); 28is($obj->{foo}, 10, "normal 10"); 29 30$js = '{"foo":-10}'; 31$obj = $pc->decode($js); 32is($obj->{foo}, -10, "normal -10"); 33 34 35$js = '{"foo":0, "bar":0.1}'; 36$obj = $pc->decode($js); 37is($obj->{foo},0, "normal 0"); 38is($obj->{bar},0.1,"normal 0.1"); 39 40