aboutsummaryrefslogtreecommitdiffstats
path: root/unpack_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'unpack_test.c')
-rw-r--r--unpack_test.c14
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;