| 50 | }; |
| 51 | |
| 52 | static 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 | |
| 73 | static int testRobustEncoding() |
| 74 | { |
no test coverage detected
searching dependent graphs…