Add string formatting to Str8

This commit is contained in:
2025-02-22 16:41:05 +00:00
parent cda7e413e2
commit 80bd68f313
6 changed files with 40 additions and 17 deletions

View File

@@ -270,7 +270,7 @@ TestFuncResult test_str8_slice(void) {
return wapp_tester_result(result);
}
TestFuncResult test_str8_concat(void) {
TestFuncResult test_str8_alloc_concat(void) {
bool result;
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
@@ -282,10 +282,10 @@ TestFuncResult test_str8_concat(void) {
Str8 *output;
output = wapp_str8_concat(&arena, &str, &suffix1);
output = wapp_str8_alloc_concat(&arena, &str, &suffix1);
result = output->size == concat1.size && wapp_str8_equal(output, &concat1);
output = wapp_str8_concat(&arena, output, &suffix2);
output = wapp_str8_alloc_concat(&arena, output, &suffix2);
result = result && output->size == concat2.size && wapp_str8_equal(output, &concat2);
wapp_mem_arena_allocator_destroy(&arena);

View File

@@ -14,12 +14,12 @@ TestFuncResult test_str8_alloc_buf(void);
TestFuncResult test_str8_alloc_cstr(void);
TestFuncResult test_str8_alloc_str8(void);
TestFuncResult test_str8_alloc_substr(void);
TestFuncResult test_str8_alloc_concat(void);
TestFuncResult test_str8_get_index_within_bounds(void);
TestFuncResult test_str8_get_index_out_of_bounds(void);
TestFuncResult test_str8_set(void);
TestFuncResult test_str8_equal(void);
TestFuncResult test_str8_slice(void);
TestFuncResult test_str8_concat(void);
TestFuncResult test_str8_concat_capped(void);
TestFuncResult test_str8_copy_cstr_capped(void);
TestFuncResult test_str8_copy_str8_capped(void);

View File

@@ -20,12 +20,12 @@ int main(void) {
test_str8_alloc_cstr,
test_str8_alloc_str8,
test_str8_alloc_substr,
test_str8_alloc_concat,
test_str8_get_index_within_bounds,
test_str8_get_index_out_of_bounds,
test_str8_set,
test_str8_equal,
test_str8_slice,
test_str8_concat,
test_str8_concat_capped,
test_str8_copy_cstr_capped,
test_str8_copy_str8_capped,