summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorClement Sibille <clements+git@lisible.xyz>2024-05-20 00:52:17 +0900
committerClement Sibille <clements+git@lisible.xyz>2024-05-20 01:28:21 +0900
commit2d813cc4c26af142bcfaabdf654371e7801f6491 (patch)
treecbbf8cbb2af9554d7215e96a63fcc213d05c853a /tests
parentbd22b018c841cddf4eb8e1dae48eb14eef850523 (diff)
Add bytes module
Diffstat (limited to '')
-rw-r--r--tests/bytes.c10
-rw-r--r--tests/test.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/bytes.c b/tests/bytes.c
new file mode 100644
index 0000000..2d6f95b
--- /dev/null
+++ b/tests/bytes.c
@@ -0,0 +1,10 @@
+#include "test.h"
+#include <lisiblestd/bytes.h>
+
+void t_float_from_bytes_le(void) {
+ const u8 bytes[4] = {154, 153, 137, 64};
+ float number = float_from_bytes_le(bytes);
+ T_ASSERT_FLOAT_EQ(number, 4.3, 0.01);
+}
+
+TEST_SUITE(TEST(t_float_from_bytes_le))
diff --git a/tests/test.h b/tests/test.h
index 223abf5..b81936c 100644
--- a/tests/test.h
+++ b/tests/test.h
@@ -1,6 +1,7 @@
#ifndef LSTD_TESTS_TEST_H
#define LSTD_TESTS_TEST_H
+#include <math.h> // IWYU pragma: keep
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
Go back to lisible.xyz