Skip to content

Instantly share code, notes, and snippets.

@makamaka
Created September 18, 2010 17:47
Show Gist options
  • Save makamaka/585885 to your computer and use it in GitHub Desktop.
Save makamaka/585885 to your computer and use it in GitHub Desktop.
# Data::MessagePack passes on 64bit box but fails on 32bit
=pod
XS and PP on v5.12.1 built for x86_64-linux-thread-multi
pass all tests.
XS on v5.12.0 built for i686-linux-thread-multi
on v5.8.8 built for i686-linux-thread-multi
not ok 3 - dump d3 10 00 00 00 00 00 00 00
# Failed test 'dump d3 10 00 00 00 00 00 00 00'
# at t/ex03_unpack.t line 14.
# got: '1.15292150460685e+18'
# expected: '1152921504606846976'
PP on v5.12.0 built for i686-linux-thread-multi
passes all tests
PP on v5.8.8 built for i686-linux-thread-multi
fails all tests
* PP版は5.8.8と5.12.0とでMath::BigIntのバージョンが違うせいか
5.8.8 => 1.77
5.12.0 => 1.89_01
 と思ったけど5.8.8のを1.95にしても変わらなかった
=cut
use Test::More;
use Data::MessagePack;
use t::Util;
no warnings 'uninitialized'; # i need this. i need this.
sub unpackit {
my $v = $_[0];
$v =~ s/ //g;
$v = pack 'H*', $v;
return Data::MessagePack->unpack($v);
}
sub pis ($$) {
is_deeply unpackit($_[0]), $_[1], 'dump ' . $_[0];
}
#my @dat = do 't/data_ex.pl';
my @dat = eval do { local $/; <DATA> };
plan tests => 1*(scalar(@dat)/2);
for (my $i=0; $i<scalar(@dat); ) {
pis $dat[$i++], $dat[$i++];
}
__DATA__
(
'd3 00 00 00 10 00 00 00 00' => '68719476736',
'd3 00 00 00 10 00 00 00 01' => '68719476737',
'd3 10 00 00 00 00 00 00 00' => '1152921504606846976',
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment