MCPcopy Create free account
hub / github.com/apache/brpc / TEST

Function TEST

test/utf_string_conversions_unittest.cc:45–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43} // namespace
44
45TEST(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
59TEST(UTFStringConversionsTest, ConvertUTF8AndWideEmptyString) {
60 // An empty std::wstring should be converted to an empty std::string,

Callers

nothing calls this directly

Calls 4

WideToUTF8Function · 0.85
UTF8ToWideFunction · 0.85
WriteIntoFunction · 0.85
lengthMethod · 0.45

Tested by

no test coverage detected