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.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenlib/tests/BLI_string_ref_test.cc b/source/blender/blenlib/tests/BLI_string_ref_test.cc
index 2d488feff71..401a7bc1118 100644
--- a/source/blender/blenlib/tests/BLI_string_ref_test.cc
+++ b/source/blender/blenlib/tests/BLI_string_ref_test.cc
@@ -298,4 +298,12 @@ TEST(string_ref, ToStringView)
EXPECT_EQ(view, "hello");
}
+TEST(string_ref, constexpr_)
+{
+ constexpr StringRef sref("World");
+ BLI_STATIC_ASSERT(sref[2] == 'r', "");
+ BLI_STATIC_ASSERT(sref.size() == 5, "");
+ std::array<int, static_cast<std::size_t>(sref.find_first_of('o'))> compiles = {1};
+ EXPECT_EQ(compiles[0], 1);
+}
} // namespace blender::tests