Re-enable strcasestr on Windows, fix linking error

This commit is contained in:
Tim Wojtulewicz 2022-11-11 18:26:33 -07:00 committed by Tim Wojtulewicz
parent bfd5b06943
commit 51cdbbd59d

View file

@ -1343,20 +1343,7 @@ const char* strpbrk_n(size_t len, const char* s, const char* charset)
return nullptr; return nullptr;
} }
#if ! defined(HAVE_STRCASESTR) && ! defined(_MSC_VER) #if ! defined(HAVE_STRCASESTR)
TEST_CASE("util strcasestr")
{
const char* s = "this is a string";
const char* out = strcasestr(s, "is");
CHECK(strcmp(out, "is a string") == 0);
const char* out2 = strcasestr(s, "IS");
CHECK(strcmp(out2, "is a string") == 0);
const char* out3 = strcasestr(s, "not there");
CHECK(strcmp(out2, s) == 0);
}
// This code is derived from software contributed to BSD by Chris Torek. // This code is derived from software contributed to BSD by Chris Torek.
char* strcasestr(const char* s, const char* find) char* strcasestr(const char* s, const char* find)
@ -1384,6 +1371,20 @@ char* strcasestr(const char* s, const char* find)
return (char*)s; return (char*)s;
} }
TEST_CASE("util strcasestr")
{
const char* s = "this is a string";
const char* out = strcasestr(s, "is");
CHECK(strcmp(out, "is a string") == 0);
const char* out2 = strcasestr(s, "IS");
CHECK(strcmp(out2, "is a string") == 0);
const char* out3 = strcasestr(s, "not there");
CHECK(strcmp(out2, s) == 0);
}
#endif #endif
TEST_CASE("util atoi_n") TEST_CASE("util atoi_n")