Fix QUIC core test display
Tests names will now display a pretty name instead of the test index.
For example new string is:
QuicStreamTests/QuicStreamTest.PendingStreamStaticness/Q048
as opposed to old:
QuicStreamTests/QuicStreamTest.PendingStreamStaticness/33
gfe-relnote: n/a, test-only
PiperOrigin-RevId: 269934211
Change-Id: I44552e9730c57e00a3829f5a15ba10d8af2dc207
diff --git a/quic/core/quic_data_writer_test.cc b/quic/core/quic_data_writer_test.cc
index 64ad5dd..60abf96 100644
--- a/quic/core/quic_data_writer_test.cc
+++ b/quic/core/quic_data_writer_test.cc
@@ -27,15 +27,15 @@
struct TestParams {
explicit TestParams(Endianness endianness) : endianness(endianness) {}
- friend std::ostream& operator<<(std::ostream& os, const TestParams& p) {
- os << "{ " << (p.endianness == NETWORK_BYTE_ORDER ? "network" : "host")
- << " byte order }";
- return os;
- }
-
Endianness endianness;
};
+// Used by ::testing::PrintToStringParamName().
+std::string PrintToString(const TestParams& p) {
+ return QuicStrCat((p.endianness == NETWORK_BYTE_ORDER ? "Network" : "Host"),
+ "ByteOrder");
+}
+
std::vector<TestParams> GetTestParams() {
std::vector<TestParams> params;
for (Endianness endianness : {NETWORK_BYTE_ORDER, HOST_BYTE_ORDER}) {
@@ -48,7 +48,8 @@
INSTANTIATE_TEST_SUITE_P(QuicDataWriterTests,
QuicDataWriterTest,
- ::testing::ValuesIn(GetTestParams()));
+ ::testing::ValuesIn(GetTestParams()),
+ ::testing::PrintToStringParamName());
TEST_P(QuicDataWriterTest, SanityCheckUFloat16Consts) {
// Check the arithmetic on the constants - otherwise the values below make