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

Function testHelloWorldEncoding

Source/kwsys/testEncoding.cxx:52–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50};
51
52static int testHelloWorldEncoding()
53{
54 int ret = 0;
55 for (int i = 0; helloWorldStrings[i][0] != 0; i++) {
56 std::string str = reinterpret_cast<char const*>(helloWorldStrings[i]);
57 std::cout << str << std::endl;
58 std::wstring wstr = kwsys::Encoding::ToWide(str);
59 std::string str2 = kwsys::Encoding::ToNarrow(wstr);
60 wchar_t* c_wstr = kwsysEncoding_DupToWide(str.c_str());
61 char* c_str2 = kwsysEncoding_DupToNarrow(c_wstr);
62 if (!wstr.empty() && (str != str2 || strcmp(c_str2, str.c_str()) != 0)) {
63 std::cout << "converted string was different: " << str2 << std::endl;
64 std::cout << "converted string was different: " << c_str2 << std::endl;
65 ret++;
66 }
67 free(c_wstr);
68 free(c_str2);
69 }
70 return ret;
71}
72
73static int testRobustEncoding()
74{

Callers 1

testEncodingFunction · 0.85

Calls 4

kwsysEncoding_DupToWideFunction · 0.85
c_strMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…