Revision: | 1.1 |
Committed: | Fri Oct 25 23:09:45 2013 UTC (10 years, 8 months ago) by root |
Content type: | application/x-troff |
Branch: | MAIN |
CVS Tags: | rel-1_11, rel-1_12, rel-0_07, rel-1_71, rel-1_8, rel-0_04, rel-1_1, rel-1_0, rel-1_3, rel-1_5, rel-1_4, rel-1_7, rel-1_6, rel-0_09, rel-0_08, rel-0_05, rel-1_25, rel-1_26, rel-0_06, rel-0_03, rel-0_02, rel-1_41, rel-1_82, rel-1_83, rel-1_81, rel-1_86, rel-1_87, rel-1_84, rel-1_85, HEAD |
Error occurred while calculating annotation data. | |
Log Message: | *** empty log message *** |
# | Content |
---|---|
1 | BEGIN { $| = 1; print "1..6144\n"; } |
2 | |
3 | use CBOR::XS; |
4 | |
5 | our $test; |
6 | sub ok($;$) { |
7 | print $_[0] ? "" : "not ", "ok ", ++$test, " - $_[1]\n"; |
8 | } |
9 | |
10 | sub test($) { |
11 | my $js; |
12 | |
13 | $js = CBOR::XS->new->shrink->encode ([$_[0]]); |
14 | ok ($_[0] eq ((decode_cbor $js)->[0]), 0); |
15 | $js = CBOR::XS->new->encode ([$_[0]]); |
16 | ok ($_[0] eq (CBOR::XS->new->shrink->decode($js))->[0], 1); |
17 | } |
18 | |
19 | srand 0; # doesn't help too much, but its at least more deterministic |
20 | |
21 | for (1..768) { |
22 | test join "", map chr ($_ & 255), 0..$_; |
23 | test join "", map chr rand 255, 0..$_; |
24 | test join "", map chr ($_ * 97 & ~0x4000), 0..$_; |
25 | test join "", map chr (rand (2**20) & ~0x800), 0..$_; |
26 | } |
27 |