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 min[9] = {
10 0x80, 0, 0, 0, 0, 0, 0, 0, 0x80
13 static const unsigned char test_pattern[8] = {
14 0xde, 0xad, 0xbe, 0xef, 0xf0, 0x0d, 0xca, 0xfe
17 #define test(func, pattern, expected) do { \
18 long long result__ = (func)(pattern); \
19 if (!tap_result(result__ == (expected), "%s(%s)", #func, #expected)) { \
20 tap_diag(" expected: %ld", (long long)(expected)); \
21 tap_diag(" actual: %ld", result__); \
30 test(unpack_s64_be, zero, 0);
31 test(unpack_s64_be, minus_one, -1);
32 test(unpack_s64_be, test_pattern, -2401053088584709378);
33 test(unpack_s64_be, min, -9223372036854775807-1);
35 test(unpack_s64_le, zero, 0);
36 test(unpack_s64_le, minus_one, -1);
37 test(unpack_s64_le, test_pattern, -87241914314740258);
38 test(unpack_s64_le, min+1, -9223372036854775807-1);
40 tap_skip_all("no 64-bit support");