Add wapp_str8_push_back and wapp_str8_list_empty
This commit is contained in:
@@ -236,6 +236,28 @@ TestFuncResult test_str8_set(void) {
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_push_back(void) {
|
||||
bool result;
|
||||
|
||||
Str8 expected = wapp_str8_lit("Abdelrahman");
|
||||
Str8 buf = wapp_str8_buf(64);
|
||||
wapp_str8_push_back(&buf, 'A');
|
||||
wapp_str8_push_back(&buf, 'b');
|
||||
wapp_str8_push_back(&buf, 'd');
|
||||
wapp_str8_push_back(&buf, 'e');
|
||||
wapp_str8_push_back(&buf, 'l');
|
||||
wapp_str8_push_back(&buf, 'r');
|
||||
wapp_str8_push_back(&buf, 'a');
|
||||
wapp_str8_push_back(&buf, 'h');
|
||||
wapp_str8_push_back(&buf, 'm');
|
||||
wapp_str8_push_back(&buf, 'a');
|
||||
wapp_str8_push_back(&buf, 'n');
|
||||
|
||||
result = wapp_str8_equal(&buf, &expected);
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_equal(void) {
|
||||
bool result;
|
||||
|
||||
|
@@ -18,6 +18,7 @@ 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_push_back(void);
|
||||
TestFuncResult test_str8_equal(void);
|
||||
TestFuncResult test_str8_slice(void);
|
||||
TestFuncResult test_str8_concat_capped(void);
|
||||
|
@@ -246,3 +246,19 @@ TestFuncResult test_str8_list_remove(void) {
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_empty(void) {
|
||||
bool result;
|
||||
|
||||
Str8List list = {0};
|
||||
wapp_str8_list_push_back(&list, &wapp_str8_node_from_cstr("Hello"));
|
||||
wapp_str8_list_push_back(&list, &wapp_str8_node_from_cstr("from"));
|
||||
wapp_str8_list_push_back(&list, &wapp_str8_node_from_cstr("wizapp"));
|
||||
wapp_str8_list_push_back(&list, &wapp_str8_node_from_cstr("stdlib"));
|
||||
|
||||
wapp_str8_list_empty(&list);
|
||||
|
||||
result = list.first == NULL && list.last == NULL && list.node_count == 0 && list.total_size == 0;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ TestFuncResult test_str8_list_insert(void);
|
||||
TestFuncResult test_str8_list_pop_front(void);
|
||||
TestFuncResult test_str8_list_pop_back(void);
|
||||
TestFuncResult test_str8_list_remove(void);
|
||||
TestFuncResult test_str8_list_empty(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
END_C_LINKAGE
|
||||
|
Reference in New Issue
Block a user