Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^2: unpack and byteorder - tests fail on certain platforms

by halley (Prior)
on Jan 11, 2008 at 17:47 UTC ( #661935=note: print w/replies, xml ) Need Help??

in reply to Re: unpack and byteorder - tests fail on certain platforms
in thread unpack and byteorder - tests fail on certain platforms

Agreed; a unit test of pack() and unpack() should not be concerned with the actual bytes of platform-dependent packings unless there is an independent, bug-free way of doing the packs and unpacks on that platform. The following would be good tests for the above formats:
$x = pack($format, $original); ok($original == unpack($format, $x), 'reversible unpack'); $x = external_platform_pack($format, $original); ok($original == unpack($format, $x), 'unpack from platform-specific source'); $x = pack($format, $original); ok($original == external_platform_unpack($format, $x), 'pack to platform-specific source');
Only the first one is devoid of platform-dependence. Of course, a diverse pool of $original value samples should be run.

[ e d @ h a l l e y . c c ]

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://661935]
[choroba]: Good morning! I'll be mostly absent today, a day off at work, children have concerts and other activities...
[Corion]: Hi choroba! Yay, day off sounds great! I hope the performances of the kids go well!

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2017-12-12 08:45 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (327 votes). Check out past polls.