OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/base/bit_reader.h" | 5 #include "media/base/bit_reader.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace media { | 9 namespace media { |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... | |
38 uint8 value8; | 38 uint8 value8; |
39 uint8 buffer[] = {0x12}; | 39 uint8 buffer[] = {0x12}; |
40 BitReader reader1(buffer, sizeof(buffer)); | 40 BitReader reader1(buffer, sizeof(buffer)); |
41 | 41 |
42 EXPECT_TRUE(reader1.ReadBits(4, &value8)); | 42 EXPECT_TRUE(reader1.ReadBits(4, &value8)); |
43 EXPECT_FALSE(reader1.ReadBits(5, &value8)); | 43 EXPECT_FALSE(reader1.ReadBits(5, &value8)); |
44 EXPECT_FALSE(reader1.ReadBits(1, &value8)); | 44 EXPECT_FALSE(reader1.ReadBits(1, &value8)); |
45 EXPECT_TRUE(reader1.ReadBits(0, &value8)); | 45 EXPECT_TRUE(reader1.ReadBits(0, &value8)); |
46 } | 46 } |
47 | 47 |
48 TEST(BitReaderTest, SkipBitsTest) { | |
49 uint8 value8; | |
50 uint8 buffer[] = {0x0a}; | |
51 BitReader reader1(buffer, sizeof(buffer)); | |
52 | |
53 EXPECT_TRUE(reader1.SkipBits(2)); | |
54 EXPECT_TRUE(reader1.ReadBits(3, &value8)); | |
55 EXPECT_EQ(value8, 1); | |
56 EXPECT_FALSE(reader1.SkipBits(8)); | |
57 EXPECT_TRUE(reader1.SkipBits(0)); | |
acolwell GONE FROM CHROMIUM
2013/05/18 01:22:09
Isn't this supposed to return false since the prev
jrummell
2013/05/22 18:27:39
The original comment for ReadBits states "When ret
| |
58 } | |
59 | |
48 } // namespace media | 60 } // namespace media |
OLD | NEW |