Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/tests/BLI_string_ref_test.cc')
-rw-r--r--source/blender/blenlib/tests/BLI_string_ref_test.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/source/blender/blenlib/tests/BLI_string_ref_test.cc b/source/blender/blenlib/tests/BLI_string_ref_test.cc
index 401a7bc1118..fb8b894bfd5 100644
--- a/source/blender/blenlib/tests/BLI_string_ref_test.cc
+++ b/source/blender/blenlib/tests/BLI_string_ref_test.cc
@@ -246,10 +246,18 @@ TEST(string_ref, DropPrefixN)
EXPECT_EQ(ref3, "");
}
-TEST(string_ref, DropPrefix)
+TEST(string_ref, DropPrefixLargeN)
{
StringRef ref("test");
- StringRef ref2 = ref.drop_prefix("tes");
+ StringRef ref2 = ref.drop_prefix(100);
+ EXPECT_EQ(ref2.size(), 0);
+ EXPECT_EQ(ref2, "");
+}
+
+TEST(string_ref, DropKnownPrefix)
+{
+ StringRef ref("test");
+ StringRef ref2 = ref.drop_known_prefix("tes");
EXPECT_EQ(ref2.size(), 1);
EXPECT_EQ(ref2, "t");
}
@@ -262,6 +270,14 @@ TEST(string_ref, DropSuffix)
EXPECT_EQ(ref2, "tes");
}
+TEST(string_ref, DropSuffixLargeN)
+{
+ StringRef ref("test");
+ StringRef ref2 = ref.drop_suffix(100);
+ EXPECT_EQ(ref2.size(), 0);
+ EXPECT_EQ(ref2, "");
+}
+
TEST(string_ref, Substr)
{
StringRef ref("hello world");
@@ -298,7 +314,7 @@ TEST(string_ref, ToStringView)
EXPECT_EQ(view, "hello");
}
-TEST(string_ref, constexpr_)
+TEST(string_ref, Constexpr)
{
constexpr StringRef sref("World");
BLI_STATIC_ASSERT(sref[2] == 'r', "");