| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/filters/vp8_bool_decoder.h" | 5 #include "media/filters/vp8_bool_decoder.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 7 #include <limits> | 10 #include <limits> |
| 8 | 11 |
| 12 #include "base/macros.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 14 |
| 11 namespace media { | 15 namespace media { |
| 12 | 16 |
| 13 const static size_t NUM_BITS_TO_TEST = 100; | 17 const static size_t NUM_BITS_TO_TEST = 100; |
| 14 | 18 |
| 15 namespace { | 19 namespace { |
| 16 | 20 |
| 17 // 100 zeros with probability of 0x80. | 21 // 100 zeros with probability of 0x80. |
| 18 const uint8_t kDataZerosAndEvenProbabilities[] = { | 22 const uint8_t kDataZerosAndEvenProbabilities[] = { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 117 |
| 114 for (size_t i = 0; i < NUM_BITS_TO_TEST; ++i) { | 118 for (size_t i = 0; i < NUM_BITS_TO_TEST; ++i) { |
| 115 bool out = !(i & 1); | 119 bool out = !(i & 1); |
| 116 ASSERT_LE(i, std::numeric_limits<uint8_t>::max()); | 120 ASSERT_LE(i, std::numeric_limits<uint8_t>::max()); |
| 117 ASSERT_TRUE(bd_.ReadBool(&out, static_cast<uint8_t>(i))); | 121 ASSERT_TRUE(bd_.ReadBool(&out, static_cast<uint8_t>(i))); |
| 118 EXPECT_EQ(out, !!(i & 1)); | 122 EXPECT_EQ(out, !!(i & 1)); |
| 119 } | 123 } |
| 120 } | 124 } |
| 121 | 125 |
| 122 } // namespace media | 126 } // namespace media |
| OLD | NEW |