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

Function testMethod_substr_AtEnd

Tests/CMakeLib/testString.cxx:767–789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

765}
766
767static bool testMethod_substr_AtEnd(cm::String str)
768{
769 cm::String substr = str.substr(1);
770 ASSERT_TRUE(substr.data() == str.data() + 1);
771 ASSERT_TRUE(substr.size() == 2);
772 ASSERT_TRUE(!substr.is_stable());
773
774 // c_str() at the end of the buffer does not internally mutate.
775 ASSERT_TRUE(std::strcmp(substr.c_str(), "bc") == 0);
776 ASSERT_TRUE(substr.c_str() == str.data() + 1);
777 ASSERT_TRUE(substr.data() == str.data() + 1);
778 ASSERT_TRUE(substr.size() == 2);
779 ASSERT_TRUE(!substr.is_stable());
780
781 // str() internally mutates.
782 ASSERT_TRUE(substr.str() == "bc");
783 ASSERT_TRUE(substr.is_stable());
784 ASSERT_TRUE(substr.data() != str.data() + 1);
785 ASSERT_TRUE(substr.size() == 2);
786 ASSERT_TRUE(substr.c_str() != str.data() + 1);
787 ASSERT_TRUE(std::strcmp(substr.c_str(), "bc") == 0);
788 return true;
789}
790
791static bool testMethod_substr_AtEndBorrowed()
792{

Callers 2

Calls 6

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…