CBOR-PP
view release on metacpan or search on metacpan
t/examples.t view on Meta::CPAN
is_deeply(
scalar( CBOR::PP::decode( CBOR::PP::encode( $t->[0] ) ) ),
$t->[0],
sprintf("Round-trip: $t->[1]"),
);
}
# NB: Different perls have historically represented these values
# using different strings:
# - Modern perls all appear to use: inf nan -inf
# - Some older perls used Inf NaN -Inf
# - Others (e.g., Strawberry 5.12.2) used 1.#INF 1.#QNAN -1.#INF
# - Still others (Solaris) used Infinity NaN -Infinity
my $inf = unpack("f>", "\x7f\x80\x00\x00");
my $nan = unpack("f>", "\x7f\xc0\x00\x00");
my $neginf = unpack("f>", "\xff\x80\x00\x00");
my @decode = (
[ -1 => '20' ],
[ -10 => '29' ],
[ -100 => '3863' ],
[ -1000 => '3903e7' ],
( run in 0.222 second using v1.01-cache-2.11-cpan-4d50c553e7e )