MCPcopy Create free account
hub / github.com/Kitware/CMake / testFromStaticStringView

Function testFromStaticStringView

Tests/CMakeLib/testString.cxx:270–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268static auto const staticStringView = "abc"_s;
269
270static bool testFromStaticStringView(cm::String str)
271{
272 cm::String const& str_const = str;
273 ASSERT_TRUE(str_const.data() == staticStringView.data());
274 ASSERT_TRUE(str_const.size() == staticStringView.size());
275 ASSERT_TRUE(!str_const.is_stable());
276 ASSERT_TRUE(str.c_str() == staticStringView);
277 ASSERT_TRUE(!str.is_stable());
278 cm::String substr = str.substr(1);
279 cm::String const& substr_const = substr;
280 ASSERT_TRUE(substr_const.data() == &staticStringView[1]);
281 ASSERT_TRUE(substr_const.size() == 2);
282 ASSERT_TRUE(!substr_const.is_stable());
283 ASSERT_TRUE(substr.c_str() == &staticStringView[1]);
284 ASSERT_TRUE(!substr.is_stable());
285 return true;
286}
287
288static bool testConstructFromStaticStringView()
289{

Calls 5

is_stableMethod · 0.80
c_strMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…