4 static const unsigned char zero[8];
5 static const unsigned char minus_one[8] = {
6 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
9 static const unsigned char test_pattern[8] = {
10 0xde, 0xad, 0xbe, 0xef, 0xf0, 0x0d, 0xca, 0xfe
13 #define test(func, pattern, expected) do { \
14 unsigned long long result__ = (func)(pattern); \
15 if (!tap_result(result__ == (expected), "%s(%s)", #func, #expected)) { \
16 tap_diag(" expected: %llu", (unsigned long long)(expected)); \
17 tap_diag(" actual: %llu", result__); \
26 test(unpack_64_be, zero, 0);
27 test(unpack_64_be, minus_one, 0xffffffffffffffff);
28 test(unpack_64_be, test_pattern, 0xdeadbeeff00dcafe);
29 test(unpack_64_le, zero, 0);
30 test(unpack_64_le, minus_one, 0xffffffffffffffff);
31 test(unpack_64_le, test_pattern, 0xfeca0df0efbeadde);
33 tap_skip_all("no 64-bit support");