andreas1234567 has asked for the wisdom of the Perl Monks concerning the following question:
The module's tests fail on a number of platforms. I suspect it has to do with unpack and byteorder. However, I don't have access to any of the architectures for which the tests FAIL, so this is pure speculation. The tests that fail are primarily of the kind that read a number and unpack it, but the resulting number isn't what was expected (edited for brevity):
It looks like the tests that FAIL contain# +----+------------------------+---------+ # | Elt|Got |Expected | # +----+------------------------+---------+ # * 1| 1.12884118761808e-319 | 100 * # * 2| 3.03865194161742e-319 | 1 * # * 6| 1.30222857005357e-314 | 1251997 * # +----+------------------------+---------+
while the tests that PASS containbyteorder=4321 byteorder=87654321
The following unpack templates are used:byteorder=1234 byteorder=12345678
Is it the case that the byte order is the source of the failing tests? How do I make the module work on all platforms?return unpack 'C*', $buffer; # bytes return unpack 'C*', reverse $buffer; # int return unpack 'C*', reverse $buffer; # long return unpack 'd*', reverse $buffer; # float return unpack 's*', reverse $buffer; # short
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: unpack and byteorder - tests fail on certain platforms
by davidrw (Prior) on Jan 09, 2008 at 15:01 UTC | |
by halley (Prior) on Jan 11, 2008 at 17:47 UTC | |
|
Re: unpack and byteorder - tests fail on certain platforms
by salva (Canon) on Jan 09, 2008 at 15:35 UTC |