Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(831)

Unified Diff: net/quic/quic_data_writer_test.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/quic/quic_data_writer_test.cc
diff --git a/net/quic/quic_data_writer_test.cc b/net/quic/quic_data_writer_test.cc
index 07346c78891a2c598e9a52441d2d181166e77b83..459f1b614197b2f45367195efdeb01a6bd29cfd8 100644
--- a/net/quic/quic_data_writer_test.cc
+++ b/net/quic/quic_data_writer_test.cc
@@ -51,31 +51,67 @@ TEST(QuicDataWriterTest, WriteUFloat16) {
uint64 decoded;
uint16 encoded;
};
- TestCase test_cases[] = {
- // Small numbers represent themselves.
- { 0, 0 }, { 1, 1 }, { 2, 2 }, { 3, 3 }, { 4, 4 }, { 5, 5 }, { 6, 6 },
- { 7, 7 }, { 15, 15 }, { 31, 31 }, { 42, 42 }, { 123, 123 }, { 1234, 1234 },
- // Check transition through 2^11.
- { 2046, 2046 }, { 2047, 2047 }, { 2048, 2048 }, { 2049, 2049 },
- // Running out of mantissa at 2^12.
- { 4094, 4094 }, { 4095, 4095 }, { 4096, 4096 }, { 4097, 4096 },
- { 4098, 4097 }, { 4099, 4097 }, { 4100, 4098 }, { 4101, 4098 },
- // Check transition through 2^13.
- { 8190, 6143 }, { 8191, 6143 }, { 8192, 6144 }, { 8193, 6144 },
- { 8194, 6144 }, { 8195, 6144 }, { 8196, 6145 }, { 8197, 6145 },
- // Half-way through the exponents.
- { 0x7FF8000, 0x87FF }, { 0x7FFFFFF, 0x87FF }, { 0x8000000, 0x8800 },
- { 0xFFF0000, 0x8FFF }, { 0xFFFFFFF, 0x8FFF }, { 0x10000000, 0x9000 },
- // Transition into the largest exponent.
- { 0x1FFFFFFFFFE, 0xF7FF}, { 0x1FFFFFFFFFF, 0xF7FF},
- { 0x20000000000, 0xF800}, { 0x20000000001, 0xF800},
- { 0x2003FFFFFFE, 0xF800}, { 0x2003FFFFFFF, 0xF800},
- { 0x20040000000, 0xF801}, { 0x20040000001, 0xF801},
- // Transition into the max value and clamping.
- { 0x3FF80000000, 0xFFFE}, { 0x3FFBFFFFFFF, 0xFFFE},
- { 0x3FFC0000000, 0xFFFF}, { 0x3FFC0000001, 0xFFFF},
- { 0x3FFFFFFFFFF, 0xFFFF}, { 0x40000000000, 0xFFFF},
- { 0xFFFFFFFFFFFFFFFF, 0xFFFF},
+ TestCase test_cases[] = {// Small numbers represent themselves.
+ {0, 0},
+ {1, 1},
+ {2, 2},
+ {3, 3},
+ {4, 4},
+ {5, 5},
+ {6, 6},
+ {7, 7},
+ {15, 15},
+ {31, 31},
+ {42, 42},
+ {123, 123},
+ {1234, 1234},
+ // Check transition through 2^11.
+ {2046, 2046},
+ {2047, 2047},
+ {2048, 2048},
+ {2049, 2049},
+ // Running out of mantissa at 2^12.
+ {4094, 4094},
+ {4095, 4095},
+ {4096, 4096},
+ {4097, 4096},
+ {4098, 4097},
+ {4099, 4097},
+ {4100, 4098},
+ {4101, 4098},
+ // Check transition through 2^13.
+ {8190, 6143},
+ {8191, 6143},
+ {8192, 6144},
+ {8193, 6144},
+ {8194, 6144},
+ {8195, 6144},
+ {8196, 6145},
+ {8197, 6145},
+ // Half-way through the exponents.
+ {0x7FF8000, 0x87FF},
+ {0x7FFFFFF, 0x87FF},
+ {0x8000000, 0x8800},
+ {0xFFF0000, 0x8FFF},
+ {0xFFFFFFF, 0x8FFF},
+ {0x10000000, 0x9000},
+ // Transition into the largest exponent.
+ {0x1FFFFFFFFFE, 0xF7FF},
+ {0x1FFFFFFFFFF, 0xF7FF},
+ {0x20000000000, 0xF800},
+ {0x20000000001, 0xF800},
+ {0x2003FFFFFFE, 0xF800},
+ {0x2003FFFFFFF, 0xF800},
+ {0x20040000000, 0xF801},
+ {0x20040000001, 0xF801},
+ // Transition into the max value and clamping.
+ {0x3FF80000000, 0xFFFE},
+ {0x3FFBFFFFFFF, 0xFFFE},
+ {0x3FFC0000000, 0xFFFF},
+ {0x3FFC0000001, 0xFFFF},
+ {0x3FFFFFFFFFF, 0xFFFF},
+ {0x40000000000, 0xFFFF},
+ {0xFFFFFFFFFFFFFFFF, 0xFFFF},
};
int num_test_cases = sizeof(test_cases) / sizeof(test_cases[0]);
@@ -93,26 +129,49 @@ TEST(QuicDataWriterTest, ReadUFloat16) {
uint16 encoded;
};
TestCase test_cases[] = {
- // There are fewer decoding test cases because encoding truncates, and
- // decoding returns the smallest expansion.
- // Small numbers represent themselves.
- { 0, 0 }, { 1, 1 }, { 2, 2 }, { 3, 3 }, { 4, 4 }, { 5, 5 }, { 6, 6 },
- { 7, 7 }, { 15, 15 }, { 31, 31 }, { 42, 42 }, { 123, 123 }, { 1234, 1234 },
- // Check transition through 2^11.
- { 2046, 2046 }, { 2047, 2047 }, { 2048, 2048 }, { 2049, 2049 },
- // Running out of mantissa at 2^12.
- { 4094, 4094 }, { 4095, 4095 }, { 4096, 4096 },
- { 4098, 4097 }, { 4100, 4098 },
- // Check transition through 2^13.
- { 8190, 6143 }, { 8192, 6144 }, { 8196, 6145 },
- // Half-way through the exponents.
- { 0x7FF8000, 0x87FF }, { 0x8000000, 0x8800 },
- { 0xFFF0000, 0x8FFF }, { 0x10000000, 0x9000 },
- // Transition into the largest exponent.
- { 0x1FFE0000000, 0xF7FF}, { 0x20000000000, 0xF800},
- { 0x20040000000, 0xF801},
- // Transition into the max value.
- { 0x3FF80000000, 0xFFFE}, { 0x3FFC0000000, 0xFFFF},
+ // There are fewer decoding test cases because encoding truncates, and
+ // decoding returns the smallest expansion.
+ // Small numbers represent themselves.
+ {0, 0},
+ {1, 1},
+ {2, 2},
+ {3, 3},
+ {4, 4},
+ {5, 5},
+ {6, 6},
+ {7, 7},
+ {15, 15},
+ {31, 31},
+ {42, 42},
+ {123, 123},
+ {1234, 1234},
+ // Check transition through 2^11.
+ {2046, 2046},
+ {2047, 2047},
+ {2048, 2048},
+ {2049, 2049},
+ // Running out of mantissa at 2^12.
+ {4094, 4094},
+ {4095, 4095},
+ {4096, 4096},
+ {4098, 4097},
+ {4100, 4098},
+ // Check transition through 2^13.
+ {8190, 6143},
+ {8192, 6144},
+ {8196, 6145},
+ // Half-way through the exponents.
+ {0x7FF8000, 0x87FF},
+ {0x8000000, 0x8800},
+ {0xFFF0000, 0x8FFF},
+ {0x10000000, 0x9000},
+ // Transition into the largest exponent.
+ {0x1FFE0000000, 0xF7FF},
+ {0x20000000000, 0xF800},
+ {0x20040000000, 0xF801},
+ // Transition into the max value.
+ {0x3FF80000000, 0xFFFE},
+ {0x3FFC0000000, 0xFFFF},
};
int num_test_cases = sizeof(test_cases) / sizeof(test_cases[0]);
@@ -150,11 +209,11 @@ TEST(QuicDataWriterTest, RoundTripUFloat16) {
EXPECT_TRUE(writer.WriteUFloat16(value + 1));
scoped_ptr<char[]> data(writer.take());
// Check minimal decoding (previous decoding has previous encoding).
- EXPECT_EQ(i-1, *reinterpret_cast<uint16*>(data.get()));
+ EXPECT_EQ(i - 1, *reinterpret_cast<uint16*>(data.get()));
// Check roundtrip.
EXPECT_EQ(i, *reinterpret_cast<uint16*>(data.get() + 2));
// Check next decoding.
- EXPECT_EQ(i < 4096? i+1 : i, *reinterpret_cast<uint16*>(data.get() + 4));
+ EXPECT_EQ(i < 4096 ? i + 1 : i, *reinterpret_cast<uint16*>(data.get() + 4));
}
}

Powered by Google App Engine
This is Rietveld 408576698