>perl -wMstrict -le "use Test::More 'no_plan'; use List::Util qw(shuffle); ;; sub rand_s24 { return map { int(rand 2**24) - 2**23 } 1 .. $_[0]; } ;; use constant MIN_S24 => -(2**23); use constant MAX_S24 => -MIN_S24() - 1; use constant VALUES => (0, 1, -1, MIN_S24, MAX_S24); use constant N_VALUES => scalar(@{[ VALUES ]}); use constant MAX_LEN => 25; ;; for my $pass (1 .. 200) { for my $len (1 .. MAX_LEN) { my @to_pack = (rand_s24($len - N_VALUES), VALUES)[-$len .. -1]; @to_pack = shuffle @to_pack; $len == @to_pack or die qq{bad len: array to pack}; ;; my $packed = pack '(l