ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CBOR-XS/t/51_types.t
Revision: 1.3
Committed: Sat Nov 30 17:19:34 2013 UTC (10 years, 7 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-1_11, rel-1_12, rel-1_71, rel-1_8, rel-1_1, rel-1_3, rel-1_5, rel-1_4, rel-1_7, rel-1_6, rel-1_25, rel-1_26, 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
Changes since 1.2: +29 -1 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.3 BEGIN { $| = 1; print "1..21\n"; }
2 root 1.1
3     use Types::Serialiser;
4     use CBOR::XS;
5    
6     print "ok 1\n";
7    
8     $enc = encode_cbor Types::Serialiser::false;
9     print $enc ne "\xf4" ? "not " : "", "ok 2\n";
10    
11     $dec = decode_cbor $enc;
12     print Types::Serialiser::is_false $dec ? "" : "not ", "ok 3\n";
13     print Types::Serialiser::is_bool $dec ? "" : "not ", "ok 4\n";
14    
15     $enc = encode_cbor Types::Serialiser::true;
16     print $enc ne "\xf5" ? "not " : "", "ok 5\n";
17    
18     $dec = decode_cbor $enc;
19     print Types::Serialiser::is_true $dec ? "" : "not ", "ok 6\n";
20     print Types::Serialiser::is_bool $dec ? "" : "not ", "ok 7\n";
21    
22     $enc = encode_cbor Types::Serialiser::error;
23     print $enc ne "\xf7" ? "not " : "", "ok 8\n";
24    
25     $dec = decode_cbor $enc;
26     print Types::Serialiser::is_error $dec ? "" : "not ", "ok 9\n";
27    
28 root 1.2 $enc = encode_cbor undef;
29     print $enc ne "\xf6" ? "not " : "", "ok 10\n";
30    
31     $dec = decode_cbor $enc;
32     print !defined $dec ? "" : "not ", "ok 11\n";
33    
34 root 1.3 my $c = CBOR::XS->new->allow_sharing;
35    
36     $enc = $c->encode (Types::Serialiser::false);
37     print $enc ne "\xf4" ? "not " : "", "ok 12\n";
38    
39     $dec = $c->decode ($enc);
40     print Types::Serialiser::is_false $dec ? "" : "not ", "ok 13\n";
41     print Types::Serialiser::is_bool $dec ? "" : "not ", "ok 14\n";
42    
43     $enc = $c->encode (Types::Serialiser::true);
44     print $enc ne "\xf5" ? "not " : "", "ok 15\n";
45    
46     $dec = $c->decode ($enc);
47     print Types::Serialiser::is_true $dec ? "" : "not ", "ok 16\n";
48     print Types::Serialiser::is_bool $dec ? "" : "not ", "ok 17\n";
49    
50     $enc = $c->encode (Types::Serialiser::error);
51     print $enc ne "\xf7" ? "not " : "", "ok 18\n";
52    
53     $dec = $c->decode ($enc);
54     print Types::Serialiser::is_error $dec ? "" : "not ", "ok 19\n";
55    
56     $enc = $c->encode (undef);
57     print $enc ne "\xf6" ? "not " : "", "ok 20\n";
58    
59     $dec = $c->decode ($enc);
60     print !defined $dec ? "" : "not ", "ok 21\n";
61