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

Comparing CBOR-XS/t/53_bignum.t (file contents):
Revision 1.4 by root, Mon Apr 25 21:30:23 2016 UTC vs.
Revision 1.6 by root, Tue Apr 26 16:07:04 2016 UTC

1BEGIN { $| = 1; print "1..102\n"; } 1BEGIN { $| = 1; print "1..105\n"; }
2BEGIN { $^W = 0 } # hate 2BEGIN { $^W = 0 } # hate
3 3
4use CBOR::XS; 4use CBOR::XS;
5 5
6use Math::BigInt only => "Calc"; # needed for representation stability 6use Math::BigInt only => "FastCalc"; # needed for representation stability
7 7
8print "ok 1\n"; 8print "ok 1\n";
9 9
10my $t = decode_cbor pack "H*", "82c48221196ab3c5822003"; 10my $t = decode_cbor pack "H*", "82c48221196ab3c5822003";
11 11
33print "799999999999999999998e+99999999999999999998" eq $t->bsstr ? "" : "not ", "ok 100\n"; 33print "799999999999999999998e+99999999999999999998" eq $t->bsstr ? "" : "not ", "ok 100\n";
34 34
35$t = encode_cbor $t; 35$t = encode_cbor $t;
36print "d9010882c249056bc75e2d63100000c2492b5e3af16b187ffffe" eq (unpack "H*", $t) ? "" : "not ", "ok 101\n"; 36print "d9010882c249056bc75e2d63100000c2492b5e3af16b187ffffe" eq (unpack "H*", $t) ? "" : "not ", "ok 101\n";
37 37
38print "ok 102\n"; 38$t = encode_cbor CBOR::XS::tag 30, [4, 2];
39$t = decode_cbor $t;
40print $t eq 2 ? "" : "not ", "ok 102 # $t\n";
39 41
42$t = encode_cbor $t;
43print "02" eq (unpack "H*", $t) ? "" : "not ", "ok 103\n";
44
45$t = encode_cbor decode_cbor encode_cbor CBOR::XS::tag 30, [Math::BigInt->new (5), 2];
46print "d81e820502" eq (unpack "H*", $t) ? "" : "not ", "ok 104\n";
47
48print "ok 105\n";
49

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines