Fix tests to work on big-endian machines

Tested on powerpc 32 bit.