add: test to strstr strchr

This commit is contained in:
starnakin 2023-06-18 19:43:39 +02:00
parent c6728cfe49
commit 764761a58f
2 changed files with 6 additions and 0 deletions

View File

@ -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");
}

View File

@ -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");
}