--- CBOR-XS/t/53_bignum.t 2013/11/22 15:28:38 1.1 +++ CBOR-XS/t/53_bignum.t 2013/11/22 15:33:44 1.2 @@ -1,4 +1,4 @@ -BEGIN { $| = 1; print "1..4\n"; } +BEGIN { $| = 1; print "1..100\n"; } BEGIN { $^W = 0 } # hate use CBOR::XS; @@ -14,3 +14,17 @@ print $t eq (pack "H*", "82c48221196ab3c482200f") ? "" : "not ", "ok 4 # ", (unpack "H*", $t), "\n"; +# Math::BigFloat loaded by now... + +for (5..99) { + my $n = Math::BigFloat->new ((int rand 1e9) . "." . (int rand 1e9) . "e" . ((int rand 1e8) - 0.5e8)); + my $m = decode_cbor encode_cbor $n; + + $n = $n->bsstr; + $m = $m->bsstr; + + print $n != $m ? "not " : "ok $_ # $n eq $m\n"; +} + +print "ok 100\n"; +