|
@@ -10,6 +10,19 @@
|
|
|
|
|
|
|
|
bx::AllocatorI* g_allocator;
|
|
bx::AllocatorI* g_allocator;
|
|
|
|
|
|
|
|
|
|
+TEST_CASE("chars", "")
|
|
|
|
|
+{
|
|
|
|
|
+ for (char ch = 'A'; ch <= 'Z'; ++ch)
|
|
|
|
|
+ {
|
|
|
|
|
+ REQUIRE(!bx::isLower(ch) );
|
|
|
|
|
+ REQUIRE(!bx::isNumeric(ch) );
|
|
|
|
|
+ REQUIRE(bx::isUpper(ch) );
|
|
|
|
|
+ REQUIRE(bx::isAlpha(ch) );
|
|
|
|
|
+ REQUIRE(bx::isAlphaNum(ch) );
|
|
|
|
|
+ REQUIRE(bx::isLower(bx::toLower(ch) ) );
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
TEST_CASE("strnlen", "")
|
|
TEST_CASE("strnlen", "")
|
|
|
{
|
|
{
|
|
|
const char* test = "test";
|
|
const char* test = "test";
|
|
@@ -45,6 +58,7 @@ TEST_CASE("strincmp", "")
|
|
|
REQUIRE(0 == bx::strincmp("test", "test") );
|
|
REQUIRE(0 == bx::strincmp("test", "test") );
|
|
|
REQUIRE(0 == bx::strincmp("test", "testestes", 4) );
|
|
REQUIRE(0 == bx::strincmp("test", "testestes", 4) );
|
|
|
REQUIRE(0 == bx::strincmp("testestes", "test", 4) );
|
|
REQUIRE(0 == bx::strincmp("testestes", "test", 4) );
|
|
|
|
|
+ REQUIRE(0 != bx::strincmp("preprocess", "platform") );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("strnchr", "")
|
|
TEST_CASE("strnchr", "")
|
|
@@ -63,6 +77,31 @@ TEST_CASE("strnrchr", "")
|
|
|
REQUIRE(&test[2] == bx::strnrchr(test, 's') );
|
|
REQUIRE(&test[2] == bx::strnrchr(test, 's') );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+TEST_CASE("stristr", "")
|
|
|
|
|
+{
|
|
|
|
|
+ const char* test = "The Quick Brown Fox Jumps Over The Lazy Dog.";
|
|
|
|
|
+
|
|
|
|
|
+ REQUIRE(NULL == bx::stristr(test, "quick", 8) );
|
|
|
|
|
+ REQUIRE(NULL == bx::stristr(test, "quick1") );
|
|
|
|
|
+ REQUIRE(&test[4] == bx::stristr(test, "quick", 9) );
|
|
|
|
|
+ REQUIRE(&test[4] == bx::stristr(test, "quick") );
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+TEST_CASE("strnstr", "")
|
|
|
|
|
+{
|
|
|
|
|
+ const char* test = "The Quick Brown Fox Jumps Over The Lazy Dog.";
|
|
|
|
|
+
|
|
|
|
|
+ REQUIRE(NULL == bx::strnstr(test, "quick", 8) );
|
|
|
|
|
+ REQUIRE(NULL == bx::strnstr(test, "quick1") );
|
|
|
|
|
+ REQUIRE(NULL == bx::strnstr(test, "quick", 9) );
|
|
|
|
|
+ REQUIRE(NULL == bx::strnstr(test, "quick") );
|
|
|
|
|
+
|
|
|
|
|
+ REQUIRE(NULL == bx::strnstr(test, "Quick", 8) );
|
|
|
|
|
+ REQUIRE(NULL == bx::strnstr(test, "Quick1") );
|
|
|
|
|
+ REQUIRE(&test[4] == bx::strnstr(test, "Quick", 9) );
|
|
|
|
|
+ REQUIRE(&test[4] == bx::strnstr(test, "Quick") );
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
TEST_CASE("StringView", "")
|
|
TEST_CASE("StringView", "")
|
|
|
{
|
|
{
|
|
|
bx::StringView sv("test");
|
|
bx::StringView sv("test");
|