| 43 | } // namespace |
| 44 | |
| 45 | TEST(UTFStringConversionsTest, ConvertUTF8AndWide) { |
| 46 | // we round-trip all the wide strings through UTF-8 to make sure everything |
| 47 | // agrees on the conversion. This uses the stream operators to test them |
| 48 | // simultaneously. |
| 49 | for (size_t i = 0; i < arraysize(kConvertRoundtripCases); ++i) { |
| 50 | std::ostringstream utf8; |
| 51 | utf8 << WideToUTF8(kConvertRoundtripCases[i]); |
| 52 | std::wostringstream wide; |
| 53 | wide << UTF8ToWide(utf8.str()); |
| 54 | |
| 55 | EXPECT_EQ(kConvertRoundtripCases[i], wide.str()); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | TEST(UTFStringConversionsTest, ConvertUTF8AndWideEmptyString) { |
| 60 | // An empty std::wstring should be converted to an empty std::string, |
nothing calls this directly
no test coverage detected