diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2020-09-10 23:11:44 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2020-09-10 23:11:44 +0100 |
commit | 2644c6fc2c99b63936c3e505340e597b1c1f4fa7 (patch) | |
tree | c3f2259aa828e660c037049792affe02573b4ea2 /unpack_test.c | |
parent | fa6635d7c7d10a820754eda9668e54c226823ec9 (diff) | |
download | pack-2644c6fc2c99b63936c3e505340e597b1c1f4fa7.tar.gz pack-2644c6fc2c99b63936c3e505340e597b1c1f4fa7.tar.xz pack-2644c6fc2c99b63936c3e505340e597b1c1f4fa7.zip |
unpack: Implement float unpacking.
Diffstat (limited to 'unpack_test.c')
-rw-r--r-- | unpack_test.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/unpack_test.c b/unpack_test.c index a0eb35e..66d2117 100644 --- a/unpack_test.c +++ b/unpack_test.c @@ -36,6 +36,20 @@ struct test { #include "unpack_test.inc" +TEST(simple0_float, "simple unpack float") +{ + float v[1] = { __LINE__ }; + + CHECK_UNPACK(DATA(0x00, 0x00, 0x00, 0x00), "f", &v); + CHECK_EQUAL("f", v[0], 0.0f); + CHECK_UNPACK(DATA(0x3f, 0x80, 0x00, 0x00), "f", &v); + CHECK_EQUAL("f", v[0], 1.0f); + CHECK_UNPACK(DATA(0x41, 0x00, 0x00, 0x00), "f", &v); + CHECK_EQUAL("f", v[0], 8.0f); + + return true; +} + int main(void) { extern struct test __start_tests, __stop_tests; |