From 17679f331403b2d9af84bb4d107bc0ae1f3373f3 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Fri, 25 Sep 2020 14:24:55 -0400 Subject: move type test objects to file scope, remove need for (void)foo to avoid warnings on unused variables --- string.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 5b476d7..f1174ec 100644 --- a/string.c +++ b/string.c @@ -1,14 +1,14 @@ #include #include "test.h" +size_t test_size; + void test_string_h(void) { - size_t size; char dst[64] = { 0 }; char less[] = "a"; char more[] = "b"; char haystack[] = "the five boxing wizards jump quickly"; - (void)size; testing_header("string.h"); @@ -60,6 +60,7 @@ void test_string_h(void) test_true(strspn(haystack, "12345") == 0); test_true(strspn(haystack, "eht") == 3); + test_true(strstr(haystack, "") == haystack); test_true(strstr(haystack, "wizard") == haystack + 16); test_true(strstr(haystack, "rogue") == NULL); -- cgit v1.2.1