1 | BEGIN { $| = 1; print "1..20\n"; } |
1 | BEGIN { $| = 1; print "1..20\n"; } |
|
|
2 | BEGIN { $^W = 0 } # hate |
2 | |
3 | |
3 | use CBOR::XS; |
4 | use CBOR::XS; |
4 | |
5 | |
5 | print "ok 1\n"; |
6 | print "ok 1\n"; |
6 | |
7 | |
… | |
… | |
38 | 777 |
39 | 777 |
39 | } |
40 | } |
40 | |
41 | |
41 | $obj = bless { k => 1 }, CBOR::XS::freeze::; |
42 | $obj = bless { k => 1 }, CBOR::XS::freeze::; |
42 | $enc = encode_cbor $obj; |
43 | $enc = encode_cbor $obj; |
43 | print $enc eq (pack "H*", "d90100845043424f523a3a58533a3a667265657a65030102") ? "" : "not ", "ok 12\n"; |
44 | print $enc eq (pack "H*", "d81a845043424f523a3a58533a3a667265657a65030102") ? "" : "not ", "ok 12 ", (unpack "H*", $enc), "\n"; |
44 | |
45 | |
45 | $dec = decode_cbor $enc; |
46 | $dec = decode_cbor $enc; |
46 | print $dec eq 777 ? "" : "not ", "ok 19\n"; |
47 | print $dec eq 777 ? "" : "not ", "ok 19\n"; |
47 | |
48 | |
48 | print "ok 20\n"; |
49 | print "ok 20\n"; |