diff options
Diffstat (limited to 'tests/gtests')
-rw-r--r-- | tests/gtests/blenlib/BLI_path_util_test.cc | 15 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_string_test.cc | 21 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/gtests/blenlib/BLI_path_util_test.cc b/tests/gtests/blenlib/BLI_path_util_test.cc index c07ff2b0b05..c9a7436df31 100644 --- a/tests/gtests/blenlib/BLI_path_util_test.cc +++ b/tests/gtests/blenlib/BLI_path_util_test.cc @@ -618,3 +618,18 @@ TEST(path_util, PathFrameGet) PATH_FRAME_GET("", -1, -1, false); } #undef PATH_FRAME_GET + + +/* BLI_path_extension */ +TEST(path_util, PathExtension) +{ + EXPECT_EQ(NULL, BLI_path_extension("some.def/file")); + EXPECT_EQ(NULL, BLI_path_extension("Text")); + EXPECT_EQ(NULL, BLI_path_extension("Text…001")); + + EXPECT_STREQ(".", BLI_path_extension("some/file.")); + EXPECT_STREQ(".gz", BLI_path_extension("some/file.tar.gz")); + EXPECT_STREQ(".abc", BLI_path_extension("some.def/file.abc")); + EXPECT_STREQ(".abc", BLI_path_extension("C:\\some.def\\file.abc")); + EXPECT_STREQ(".001", BLI_path_extension("Text.001")); +} diff --git a/tests/gtests/blenlib/BLI_string_test.cc b/tests/gtests/blenlib/BLI_string_test.cc index b63b591b39a..c79afdfb92c 100644 --- a/tests/gtests/blenlib/BLI_string_test.cc +++ b/tests/gtests/blenlib/BLI_string_test.cc @@ -12,6 +12,7 @@ extern "C" { #include "BLI_utildefines.h" #include "BLI_string.h" #include "BLI_string_utf8.h" +#include "BLI_string_utils.h" } using std::initializer_list; @@ -588,3 +589,23 @@ TEST(string, StringStrncasestr) res = BLI_strncasestr(str_test0, "not there", 9); EXPECT_EQ(res, (void *)NULL); } + + +/* BLI_string_is_decimal */ +TEST(string, StrIsDecimal) +{ + EXPECT_FALSE(BLI_string_is_decimal("")); + EXPECT_FALSE(BLI_string_is_decimal("je moeder")); + EXPECT_FALSE(BLI_string_is_decimal("je møder")); + EXPECT_FALSE(BLI_string_is_decimal("Agent 327")); + EXPECT_FALSE(BLI_string_is_decimal("Agent\000327")); + EXPECT_FALSE(BLI_string_is_decimal("\000327")); + EXPECT_FALSE(BLI_string_is_decimal("0x16")); + EXPECT_FALSE(BLI_string_is_decimal("16.4")); + EXPECT_FALSE(BLI_string_is_decimal("-1")); + + EXPECT_TRUE(BLI_string_is_decimal("0")); + EXPECT_TRUE(BLI_string_is_decimal("1")); + EXPECT_TRUE(BLI_string_is_decimal("001")); + EXPECT_TRUE(BLI_string_is_decimal("11342908713948713498745980171334059871345098713405981734")); +} |