aboutsummaryrefslogtreecommitdiff
path: root/tests/test_string.c
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-04-08 13:14:27 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-04-08 13:15:01 +0200
commitcf534d762754860ed5b714974f99acd282d48b3b (patch)
treebf22341cedfb50ee7bcd4e15f85add2329783f31 /tests/test_string.c
parent630fcb1846aed16b9ab62bcf700f668883f4521f (diff)
Restructure into src/{std,json}/
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_string.c')
-rw-r--r--tests/test_string.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/tests/test_string.c b/tests/test_string.c
deleted file mode 100644
index 297e294..0000000
--- a/tests/test_string.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "../include/string.h"
-#include "../include/testing.h"
-#include "../include/types.h"
-#include <stdio.h>
-
-i32 test_string_literal_equality() {
- t_assert_strequal(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_strequal(src, cpy);
- t_assert_equal(Arena_get_used(perm), 5);
-
- return 0;
-}
-
-i32 test_fast_string() {
- bytex32 quote_mask = _mm256_set1_epi8('"');
- byte *s = malloc(32 * sizeof(byte));
- s = "abcdefghijklmnopqrstuvwxyzabcdef";
-
- bytex32 chunk = _mm256_loadu_si256((bytex32 *)s);
- bytex32 cmp = _mm256_cmpeq_epi8(chunk, quote_mask);
- i32 mask = _mm256_movemask_epi8(cmp);
- t_assert_equal(_mm_popcnt_u32(mask), 0);
-
- s = "abcdefghijklm\"nopqrstuvwxyzabcde";
-
- chunk = _mm256_loadu_si256((bytex32 *)s);
- cmp = _mm256_cmpeq_epi8(chunk, quote_mask);
- mask = _mm256_movemask_epi8(cmp);
- t_assert_equal(_mm_popcnt_u32(mask), 1);
-
- return 0;
-}