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

Function testFromCharArray

Tests/CMakeLib/testString.cxx:95–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93static char const charArray[] = "abc";
94
95static bool testFromCharArray(cm::String str)
96{
97 cm::String const& str_const = str;
98 ASSERT_TRUE(str_const.data() != charArray);
99 ASSERT_TRUE(str_const.size() == sizeof(charArray) - 1);
100 ASSERT_TRUE(str_const.is_stable());
101 ASSERT_TRUE(str.c_str() != charArray);
102 ASSERT_TRUE(str.is_stable());
103 cm::String substr = str.substr(1);
104 cm::String const& substr_const = substr;
105 ASSERT_TRUE(substr_const.data() != &charArray[1]);
106 ASSERT_TRUE(substr_const.size() == 2);
107 ASSERT_TRUE(!substr_const.is_stable());
108 ASSERT_TRUE(substr.c_str() != &charArray[1]);
109 ASSERT_TRUE(!substr.is_stable());
110 return true;
111}
112
113static bool testConstructFromCharArray()
114{

Callers 2

testAssignFromCharArrayFunction · 0.85

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…