| Revision: | 1.1 |
| Committed: | Fri Mar 23 15:10:56 2007 UTC (19 years, 5 months ago) by root |
| Content type: | application/x-troff |
| Branch: | MAIN |
| CVS Tags: | rel-2_01, rel-2_3, rel-1_11, rel-1_51, rel-1_53, rel-4_0, rel-2_222, rel-0_31, rel-3_0, rel-4_01, rel-4_03, rel-4_02, rel-2_2, rel-4_04, rel-2_0, rel-2_1, rel-0_3, rel-4_0_00, rel-0_5, rel-0_7, rel-0_8, rel-2_34, rel-2_32, rel-2_33, rel-2_31, rel-1_1, rel-1_0, rel-1_3, rel-1_2, rel-1_5, rel-1_4, rel-2_2311, rel-1_01, rel-1_24, rel-3_01, rel-3_02, rel-3_03, rel-3_04, rel-1_21, rel-1_22, rel-1_23, rel-1_43, rel-1_41, rel-2_232, rel-2_231, rel-2_29, rel-2_28, rel-2_21, rel-2_2222, rel-2_23, rel-2_22, rel-2_25, rel-2_24, rel-2_27, rel-2_26, HEAD |
| Log Message: | *** empty log message *** |
| # | User | Rev | Content |
|---|---|---|---|
| 1 | root | 1.1 | # copied over from JSON::PC and modified to use JSON::XS |
| 2 | |||
| 3 | use Test::More; | ||
| 4 | use strict; | ||
| 5 | BEGIN { plan tests => 6 }; | ||
| 6 | use JSON::XS; | ||
| 7 | use utf8; | ||
| 8 | |||
| 9 | ######################### | ||
| 10 | my ($js,$obj); | ||
| 11 | my $pc = new JSON::XS; | ||
| 12 | |||
| 13 | $js = '{"foo":0}'; | ||
| 14 | $obj = $pc->decode($js); | ||
| 15 | is($obj->{foo}, 0, "normal 0"); | ||
| 16 | |||
| 17 | $js = '{"foo":0.1}'; | ||
| 18 | $obj = $pc->decode($js); | ||
| 19 | is($obj->{foo}, 0.1, "normal 0.1"); | ||
| 20 | |||
| 21 | |||
| 22 | $js = '{"foo":10}'; | ||
| 23 | $obj = $pc->decode($js); | ||
| 24 | is($obj->{foo}, 10, "normal 10"); | ||
| 25 | |||
| 26 | $js = '{"foo":-10}'; | ||
| 27 | $obj = $pc->decode($js); | ||
| 28 | is($obj->{foo}, -10, "normal -10"); | ||
| 29 | |||
| 30 | |||
| 31 | $js = '{"foo":0, "bar":0.1}'; | ||
| 32 | $obj = $pc->decode($js); | ||
| 33 | is($obj->{foo},0, "normal 0"); | ||
| 34 | is($obj->{bar},0.1,"normal 0.1"); | ||
| 35 |