diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/_brk-test.h | 15 | ||||
-rwxr-xr-x | test/run-tests | 4 | ||||
-rw-r--r-- | test/wbrk-human-test.c | 2 |
3 files changed, 12 insertions, 9 deletions
diff --git a/test/_brk-test.h b/test/_brk-test.h index e599578..909f33f 100644 --- a/test/_brk-test.h +++ b/test/_brk-test.h @@ -56,8 +56,14 @@ test(struct u8view sv, int id) { size_t total = 0; + arena a = mkarena(0); + struct arena_ctx ctx = {.a = &a}; + typedef dynarr(char8_t) item; - dynarr(item) items = {}; + dynarr(item) items = { + .alloc = alloc_arena, + .ctx = &ctx, + }; rune op; struct u8view sv_cpy = sv; @@ -70,7 +76,7 @@ test(struct u8view sv, int id) total += w; if (op == U'÷') - DAPUSH(&items, (item){}); + DAPUSH(&items, ((item){.alloc = alloc_arena, .ctx = &ctx})); DAEXTEND(&items.buf[items.len - 1], buf, w); } @@ -102,10 +108,7 @@ test(struct u8view sv, int id) } } - da_foreach (items, wd) - free(wd->buf); - free(items.buf); + arena_free(&a); free(p); - return true; } diff --git a/test/run-tests b/test/run-tests index f8554c0..4413fff 100755 --- a/test/run-tests +++ b/test/run-tests @@ -12,7 +12,7 @@ download() readonly FLAGS=' -std=c23 -I../include - -Og -ggdb3 + -O0 -g -ggdb3 -Wall -Wextra -Wpedantic -Wno-pointer-sign -Wno-attributes @@ -34,7 +34,7 @@ sed -En 's/\s+//g; s/÷?#.*//g; /./p' data/WordBreakTest >wbrk.in for src in *.c do - gcc $FLAGS -o "${src%.*}" "$src" ../libmlib.a + cc $FLAGS -o "${src%.*}" "$src" ../libmlib.a done trap "$( diff --git a/test/wbrk-human-test.c b/test/wbrk-human-test.c index 1fa9bd8..6f8bf7a 100644 --- a/test/wbrk-human-test.c +++ b/test/wbrk-human-test.c @@ -50,7 +50,7 @@ test(struct u8view sv, int id) u8cut(&src, &sv, U";", 1); struct u8view w; - dynarr(struct u8view) ws = {}; + dynarr(struct u8view) ws = {.alloc = alloc_heap}; while (u8cut(&w, &sv, U"|", 1) != MBEND) DAPUSH(&ws, w); |