OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/string_piece.h" | 5 #include "base/strings/string_piece.h" |
6 #include "net/base/big_endian.h" | 6 #include "net/base/big_endian.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
11 TEST(BigEndianReaderTest, ReadsValues) { | 11 TEST(BigEndianReaderTest, ReadsValues) { |
12 char data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC }; | 12 char data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC }; |
13 char buf[2]; | 13 char buf[2]; |
14 uint8 u8; | 14 uint8 u8; |
15 uint16 u16; | 15 uint16 u16; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 EXPECT_FALSE(writer.WriteU16(u16)); | 91 EXPECT_FALSE(writer.WriteU16(u16)); |
92 EXPECT_FALSE(writer.WriteBytes(buf, 2)); | 92 EXPECT_FALSE(writer.WriteBytes(buf, 2)); |
93 EXPECT_TRUE(writer.Skip(1)); | 93 EXPECT_TRUE(writer.Skip(1)); |
94 // 0 left | 94 // 0 left |
95 EXPECT_FALSE(writer.WriteU8(u8)); | 95 EXPECT_FALSE(writer.WriteU8(u8)); |
96 EXPECT_EQ(0, writer.remaining()); | 96 EXPECT_EQ(0, writer.remaining()); |
97 } | 97 } |
98 | 98 |
99 } // namespace net | 99 } // namespace net |
100 | 100 |
OLD | NEW |