… | |
… | |
29 | ok ($_[0] eq JSON::XS->new->decode ($js)->[0], 6); |
29 | ok ($_[0] eq JSON::XS->new->decode ($js)->[0], 6); |
30 | $js = JSON::XS->new->allow_nonref(0)->encode ([$_[0]]); |
30 | $js = JSON::XS->new->allow_nonref(0)->encode ([$_[0]]); |
31 | ok ($_[0] eq JSON::XS->new->shrink->decode ($js)->[0], 7); |
31 | ok ($_[0] eq JSON::XS->new->shrink->decode ($js)->[0], 7); |
32 | } |
32 | } |
33 | |
33 | |
34 | srand 0; # doesn't help too much, but its at leats more deterministic |
34 | srand 0; # doesn't help too much, but its at least more deterministic |
35 | |
35 | |
36 | for (1..768) { |
36 | for (1..768) { |
37 | test join "", map chr ($_ & 255), 0..$_; |
37 | test join "", map chr ($_ & 255), 0..$_; |
38 | test join "", map chr rand 255, 0..$_; |
38 | test join "", map chr rand 255, 0..$_; |
39 | test join "", map chr ($_ * 97 & ~0x4000), 0..$_; |
39 | test join "", map chr ($_ * 97 & ~0x4000), 0..$_; |
40 | test join "", map chr (rand (2**20) & ~0x800), 0..$_; |
40 | test join "", map chr (rand (2**20) & ~0x800), 0..$_; |
41 | } |
41 | } |
|
|
42 | |