diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2020-09-12 00:52:50 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2020-09-12 00:52:50 +0100 |
commit | 06b25d3cfdfa71e219012366703f2f3d10f8f854 (patch) | |
tree | 1f12cecfcbb6a19945e78789541a6b19e98fb474 | |
parent | 5469e68fa7fa8c4e6865414ecaebe2e1fedfeda8 (diff) | |
download | pack-06b25d3cfdfa71e219012366703f2f3d10f8f854.tar.gz pack-06b25d3cfdfa71e219012366703f2f3d10f8f854.tar.xz pack-06b25d3cfdfa71e219012366703f2f3d10f8f854.zip |
unpack_test: simple unpack padding test
-rw-r--r-- | unpack_test.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/unpack_test.c b/unpack_test.c index 1d7ea4c..28cafdc 100644 --- a/unpack_test.c +++ b/unpack_test.c @@ -64,6 +64,27 @@ TEST(simple0_double, "simple unpack double") return true; } +TEST(simple_padding, "simple unpack padding") +{ + struct { + int i; + unsigned char c; + float f; + } v = { __LINE__, __LINE__ + 1, __LINE__ + 2 }; + + CHECK_UNPACK(DATA(0xff, 0x85, + 0x00, 0x00, 0x00, + 0x16, + 0x00, 0x00, + 0x40, 0x44, 0x58, 0x00), + ">i3xBxxf", &v.i, &v.c, &v.f); + CHECK_EQUAL("d", v.i, -123); + CHECK_EQUAL("d", v.c, 22); + CHECK_EQUAL("f", v.f, 0x1.88bp+1); + + return true; +} + int main(void) { extern struct test __start_tests, __stop_tests; |