Add test for wapp_str8_format

This commit is contained in:
Abdelrahman Said 2025-02-22 16:44:19 +00:00
parent 80bd68f313
commit 01f066d20c
3 changed files with 15 additions and 0 deletions

View File

@ -346,6 +346,19 @@ TestFuncResult test_str8_copy_str8_capped(void) {
return wapp_tester_result(result); return wapp_tester_result(result);
} }
TestFuncResult test_str8_format(void) {
bool result;
Str8 buf = wapp_str8_buf(128);
Str8 expected = wapp_str8_lit("My name is Abdelrahman and I am 35 years old");
wapp_str8_format(&buf, "My name is %s and I am %u years old", "Abdelrahman", 35);
result = wapp_str8_equal(&buf, &expected);
return wapp_tester_result(result);
}
TestFuncResult test_str8_find(void) { TestFuncResult test_str8_find(void) {
bool result; bool result;
Str8RO s = wapp_str8_lit("Do as I say, not as I do"); Str8RO s = wapp_str8_lit("Do as I say, not as I do");

View File

@ -23,6 +23,7 @@ TestFuncResult test_str8_slice(void);
TestFuncResult test_str8_concat_capped(void); TestFuncResult test_str8_concat_capped(void);
TestFuncResult test_str8_copy_cstr_capped(void); TestFuncResult test_str8_copy_cstr_capped(void);
TestFuncResult test_str8_copy_str8_capped(void); TestFuncResult test_str8_copy_str8_capped(void);
TestFuncResult test_str8_format(void);
TestFuncResult test_str8_find(void); TestFuncResult test_str8_find(void);
TestFuncResult test_str8_rfind(void); TestFuncResult test_str8_rfind(void);
TestFuncResult test_str8_split(void); TestFuncResult test_str8_split(void);

View File

@ -29,6 +29,7 @@ int main(void) {
test_str8_concat_capped, test_str8_concat_capped,
test_str8_copy_cstr_capped, test_str8_copy_cstr_capped,
test_str8_copy_str8_capped, test_str8_copy_str8_capped,
test_str8_format,
test_str8_find, test_str8_find,
test_str8_rfind, test_str8_rfind,
test_str8_split, test_str8_split,