diff options
Diffstat (limited to 'tests/test_string.c')
| -rw-r--r-- | tests/test_string.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_string.c b/tests/test_string.c new file mode 100644 index 0000000..1baab6a --- /dev/null +++ b/tests/test_string.c @@ -0,0 +1,19 @@ +#include "../include/string.h" +#include "../include/testing.h" + +i32 test_string_literal_equality() { + t_assert(Str_equals(S("Bonjour"), S("Bonjour"))); + return 0; +} + +i32 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_equal(Arena_get_used(perm), 5); + + return 0; +} |
