aboutsummaryrefslogtreecommitdiff
path: root/test_string.c
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2025-02-14 19:01:21 +0100
committerMartin Kagamino Lehoux <martin@lehoux.net>2025-02-14 19:01:21 +0100
commit54db532879ed3f6d76463a3ab3f3895bd41c861c (patch)
tree0b9f52e01f612d0ac26003df96094dac2287bf5f /test_string.c
parent03632f51152e5e3b6bb74c29987709fbe97a9a69 (diff)
feat(test): Add test runner (debug is ok, 2 failures in release)
Diffstat (limited to 'test_string.c')
-rw-r--r--test_string.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test_string.c b/test_string.c
new file mode 100644
index 0000000..590a30f
--- /dev/null
+++ b/test_string.c
@@ -0,0 +1,19 @@
+#include "string.h"
+#include "testing.h"
+
+char test_string_literal_equality() {
+ t_assert(Str_equals(S("Bonjour"), S("Bonjour")));
+ return 0;
+}
+
+char test_string_copy() {
+ Arena perm = Arena_new(128e3);
+ Str src = S("Hello");
+
+ Str cpy = Str_copy(&perm, src.data, src.len);
+
+ t_assert(Str_equals(src, cpy));
+ t_assert(Arena_get_used(perm) == 5);
+
+ return 0;
+}