More tests

This commit is contained in:
gfx 2010-09-19 15:47:32 +09:00
parent afefbe4e56
commit 7f42ed86f2
2 changed files with 11 additions and 2 deletions

@ -5,13 +5,14 @@ no warnings 'uninitialized'; # i need this. i need this.
sub unpackit { sub unpackit {
my $v = $_[0]; my $v = $_[0];
$v =~ s/ //g; $v =~ s/ +//g;
$v = pack 'H*', $v; $v = pack 'H*', $v;
return Data::MessagePack->unpack($v); return Data::MessagePack->unpack($v);
} }
sub pis ($$) { sub pis ($$) {
is_deeply unpackit($_[0]), $_[1], 'dump ' . $_[0]; is_deeply unpackit($_[0]), $_[1], 'dump ' . $_[0]
or diag( explain(unpackit($_[0])) );
} }
my @dat = do 't/data.pl'; my @dat = do 't/data.pl';

@ -4,6 +4,11 @@ no warnings; # i need this, i need this.
'94 a0 a1 61 a2 62 63 a3 64 65 66', ["", "a", "bc", "def"], '94 a0 a1 61 a2 62 63 a3 64 65 66', ["", "a", "bc", "def"],
'92 90 91 91 c0', [[], [[undef]]], '92 90 91 91 c0', [[], [[undef]]],
'93 c0 c2 c3', [undef, false, true], '93 c0 c2 c3', [undef, false, true],
'82 d0 2a c2 d0 2b c3', { 42 => false, 43 => true }, # fix map
'de 00 02 d0 2a c2 d0 2b c3', { 42 => false, 43 => true }, # map 16
'df 00 00 00 02 d0 2a c2 d0 2b c3', { 42 => false, 43 => true }, # map 32
'ce 80 00 00 00', 2147483648, 'ce 80 00 00 00', 2147483648,
'99 cc 00 cc 80 cc ff cd 00 00 cd 80 00 cd ff ff ce 00 00 00 00 ce 80 00 00 00 ce ff ff ff ff', '99 cc 00 cc 80 cc ff cd 00 00 cd 80 00 cd ff ff ce 00 00 00 00 ce 80 00 00 00 ce ff ff ff ff',
[0, 128, 255, 0, 32768, 65535, 0, 2147483648, 4294967295], [0, 128, 255, 0, 32768, 65535, 0, 2147483648, 4294967295],
@ -39,5 +44,8 @@ no warnings; # i need this, i need this.
# int64_t # int64_t
'd3 00 00 00 10 00 00 00 00' => '68719476736', 'd3 00 00 00 10 00 00 00 00' => '68719476736',
'd3 00 00 00 10 00 00 00 01' => '68719476737', 'd3 00 00 00 10 00 00 00 01' => '68719476737',
'd3 00 00 10 00 00 00 00 00' => '17592186044416',
'd3 00 10 00 00 00 00 00 00' => '4503599627370496',
'd3 10 00 00 00 00 00 00 00' => '1152921504606846976', 'd3 10 00 00 00 00 00 00 00' => '1152921504606846976',
'd3 11 00 00 00 00 00 00 00' => '1224979098644774912',
) )