From 764761a58fa5512f381f1ea2d1095dd3a5a34f3b Mon Sep 17 00:00:00 2001 From: starnakin Date: Sun, 18 Jun 2023 19:43:39 +0200 Subject: [PATCH] add: test to strstr strchr --- tests/strchr.🗿 | 4 ++++ tests/strstr.🗿 | 2 ++ 2 files changed, 6 insertions(+) diff --git a/tests/strchr.🗿 b/tests/strchr.🗿 index 1aa1706..08d3090 100644 --- a/tests/strchr.🗿 +++ b/tests/strchr.🗿 @@ -1,10 +1,14 @@ main() { local str; + name = "strchr"; + str = "bozoman du 36"; test_str(strchr(str, 'z'), str + 2, ""); test_str(strchr(str, 0), str + 13, ""); test_str(strchr(str, '5'), 0, ""); test_str(strchr(str, '6'), str + 12, ""); + test_str(strchr("", 'q'), 0, "empty str"); + test_str(strchr("", 0), "", "empty str and \0 to find"); } diff --git a/tests/strstr.🗿 b/tests/strstr.🗿 index 09a86d8..1db9a39 100644 --- a/tests/strstr.🗿 +++ b/tests/strstr.🗿 @@ -5,4 +5,6 @@ main() test_str(strstr("test", "t"), "test", ""); test_str(strstr("test", "st"), "st", ""); test_str(strstr("hello world!", "s"), 0, "non present to_find"); + test_str(strstr("", "s"), 0, "empty str"); + test_str(strstr("", ""), "", "empty str and empty to find"); }