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

Function testWithNulls

Source/kwsys/testEncoding.cxx:131–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131static int testWithNulls()
132{
133 int ret = 0;
134 std::vector<std::string> strings;
135 strings.push_back(std::string("ab") + '\0' + 'c');
136 strings.push_back(std::string("d") + '\0' + '\0' + 'e');
137 strings.push_back(std::string() + '\0' + 'f');
138 strings.push_back(std::string() + '\0' + '\0' + "gh");
139 strings.push_back(std::string("ij") + '\0');
140 strings.push_back(std::string("k") + '\0' + '\0');
141 strings.push_back(std::string("\0\0\0\0", 4) + "lmn" +
142 std::string("\0\0\0\0", 4));
143 for (auto& string : strings) {
144 std::wstring wstr = kwsys::Encoding::ToWide(string);
145 std::string str = kwsys::Encoding::ToNarrow(wstr);
146 std::string s(string);
147 std::replace(s.begin(), s.end(), '\0', ' ');
148 std::cout << "'" << s << "' (" << string.size() << ")" << std::endl;
149 if (str != string) {
150 std::replace(str.begin(), str.end(), '\0', ' ');
151 std::cout << "string with null was different: '" << str << "' ("
152 << str.size() << ")" << std::endl;
153 ret++;
154 }
155 }
156 return ret;
157}
158
159static int testCommandLineArguments()
160{

Callers 1

testEncodingFunction · 0.85

Calls 4

push_backMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…