Luna/tests/libc/TestString.cpp
apio 15199a2366
All checks were successful
continuous-integration/drone/push Build is passing
libluna+libc: Implement memchr() and strstr()
2023-07-10 15:30:05 +02:00

25 lines
459 B
C++

#include <string.h>
#include <test.h>
TestResult test_strstr()
{
const char* find = "Hello, world!";
validate(strstr(find, "Hello") == find);
validate(strstr(find, "!") == find + 12);
validate(strstr(find, "world") == find + 7);
validate(strstr(find, "Hullo") == nullptr);
validate(strstr(find, "notfound") == nullptr);
test_success;
}
Result<void> test_main()
{
test_prelude;
run_test(test_strstr);
return {};
}