ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CBOR-XS/t/52_object.t
(Generate patch)

Comparing CBOR-XS/t/52_object.t (file contents):
Revision 1.3 by root, Mon Oct 28 22:59:39 2013 UTC vs.
Revision 1.7 by root, Sat Nov 30 17:19:34 2013 UTC

1BEGIN { $| = 1; print "1..20\n"; } 1BEGIN { $| = 1; print "1..21\n"; }
2BEGIN { $^W = 0 } # hate
2 3
3use CBOR::XS; 4use CBOR::XS;
4 5
5print "ok 1\n"; 6print "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;
43print $enc eq (pack "H*", "d90100845043424f523a3a58533a3a667265657a65030102") ? "" : "not ", "ok 12\n"; 44print $enc eq (pack "H*", "d81a845043424f523a3a58533a3a667265657a65030102") ? "" : "not ", "ok 12 ", (unpack "H*", $enc), "\n";
44 45
45$dec = decode_cbor $enc; 46$dec = decode_cbor $enc;
46print $dec eq 777 ? "" : "not ", "ok 19\n"; 47print $dec eq 777 ? "" : "not ", "ok 19\n";
47 48
48print "ok 20\n"; 49sub CBOR::XS::freeze2::FREEZE {
50 77
51}
49 52
53my $enc = CBOR::XS->new->allow_sharing->encode ([(bless [], CBOR::XS::freeze2::) x 3]);
54print $enc eq (pack "H*", "83d81cd81a825143424f523a3a58533a3a667265657a6532184dd81d00d81d00") ? "" : "not ", "ok 20 ", (unpack "H*", $enc), "\n";
55
56print "ok 21\n";
57

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines