| 129 | } |
| 130 | |
| 131 | static 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 | |
| 159 | static int testCommandLineArguments() |
| 160 | { |
no test coverage detected
searching dependent graphs…