diff --git a/str_test.c b/str_test.c index 898a292..f8e7fc4 100644 --- a/str_test.c +++ b/str_test.c @@ -29,13 +29,16 @@ test_it() str_deinit(&s); // TEST str_init_data + printf("testing str_init_data...\n"); str_init_data(&s, "hello"); my_assert(s.len == strlen("hello"), "str_init_data, неправильный размер строки"); + my_assert(str_data(&s) != NULL, "str_data вернула NULL, а должна указатель на строку"); my_assert(strcmp(str_data(&s), "hello") == 0, "str_init_data, не правильная строка '%s' != 'hello'", str_data(&s)); // TEST str_set + printf("testing str_set...\n"); str_set(&s, ""); my_assert(s.len == 0, "str_set, нулевая строка, неверный размер"); @@ -50,6 +53,7 @@ test_it() "str_set, нулевая строка, не верное содержимое %s", str_data(&s)); // TEST str_copy + printf("testing str_copy...\n"); str s2; s2 = str_copy(&s); my_assert(s2.len == s.len, @@ -61,6 +65,7 @@ test_it() str_deinit(&s2); // TEST str_append + printf("testing str_append...\n"); str_set(&s, "hello"); str_append(&s, " world"); my_assert(strcmp(s.ptr, "hello world") == 0, @@ -114,4 +119,4 @@ main(int argc, char *argv[]) { test_it(); return 0; -} \ No newline at end of file +}