summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-09-25 14:24:55 -0400
committerJakob Kaivo <jkk@ung.org>2020-09-25 14:24:55 -0400
commit17679f331403b2d9af84bb4d107bc0ae1f3373f3 (patch)
treed47fe3a08bfc5ade912a35642e9a830dc8f28eee /string.c
parent6a2d72af1ac550f5050eeac0be25734c206b9512 (diff)
move type test objects to file scope, remove need for (void)foo to avoid warnings on unused variables
Diffstat (limited to 'string.c')
-rw-r--r--string.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/string.c b/string.c
index 5b476d7..f1174ec 100644
--- a/string.c
+++ b/string.c
@@ -1,14 +1,14 @@
#include <string.h>
#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);