Suggested by James Zern to clear out cpplint warnings for all unit test code.
Showing the changes to test/vp8_boolcoder_test.cc (1 of 27 files). Show all
Unified · Split
| @@ -8,10 +8,6 @@ · 7 unmodified lines | ||
| 8 | 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | −extern "C" { | |
| 12 | −#include "vp8/encoder/boolhuff.h" | |
| 13 | −#include "vp8/decoder/dboolhuff.h" | |
| 14 | −} | |
| 15 | 11 | |
| 16 | 12 | #include <math.h> |
| 17 | 13 | #include <stddef.h> |
| @@ -24,6 +20,11 @@ extern "C" { · 6 unmodified lines | ||
| 24 | 20 | #include "third_party/googletest/src/include/gtest/gtest.h" |
| 25 | 21 | #include "vpx/vpx_integer.h" |
| 26 | 22 | |
| 23 | +extern "C" { | |
| 24 | +#include "vp8/encoder/boolhuff.h" | |
| 25 | +#include "vp8/decoder/dboolhuff.h" | |
| 26 | +} | |
| 27 | + | |
| 27 | 28 | namespace { |
| 28 | 29 | const int num_tests = 10; |
| 29 | 30 | |
| @@ -44,7 +45,7 @@ void encrypt_buffer(uint8_t *buffer, int size) { · 14 unmodified lines | ||
| 44 | 45 | |
| 45 | 46 | void test_decrypt_cb(void *decrypt_state, const uint8_t *input, |
| 46 | 47 | uint8_t *output, int count) { |
| 47 | − int offset = input - (uint8_t *)decrypt_state; | |
| 48 | + int offset = input - reinterpret_cast<uint8_t *>(decrypt_state); | |
| 48 | 49 | for (int i = 0; i < count; i++) { |
| 49 | 50 | output[i] = input[i] ^ secret_key[(offset + i) & 15]; |
| 50 | 51 | } |
| @@ -58,10 +59,10 @@ TEST(VP8, TestBitIO) { · 7 unmodified lines | ||
| 58 | 59 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 59 | 60 | for (int n = 0; n < num_tests; ++n) { |
| 60 | 61 | for (int method = 0; method <= 7; ++method) { // we generate various proba |
| 61 | − const int bits_to_test = 1000; | |
| 62 | − uint8_t probas[bits_to_test]; | |
| 62 | + const int kBitsToTest = 1000; | |
| 63 | + uint8_t probas[kBitsToTest]; | |
| 63 | 64 | |
| 64 | − for (int i = 0; i < bits_to_test; ++i) { | |
| 65 | + for (int i = 0; i < kBitsToTest; ++i) { | |
| 65 | 66 | const int parity = i & 1; |
| 66 | 67 | probas[i] = |
| 67 | 68 | (method == 0) ? 0 : (method == 1) ? 255 : |
| @@ -76,14 +77,14 @@ TEST(VP8, TestBitIO) { · 8 unmodified lines | ||
| 76 | 77 | } |
| 77 | 78 | for (int bit_method = 0; bit_method <= 3; ++bit_method) { |
| 78 | 79 | const int random_seed = 6432; |
| 79 | − const int buffer_size = 10000; | |
| 80 | + const int kBufferSize = 10000; | |
| 80 | 81 | ACMRandom bit_rnd(random_seed); |
| 81 | 82 | BOOL_CODER bw; |
| 82 | − uint8_t bw_buffer[buffer_size]; | |
| 83 | − vp8_start_encode(&bw, bw_buffer, bw_buffer + buffer_size); | |
| 83 | + uint8_t bw_buffer[kBufferSize]; | |
| 84 | + vp8_start_encode(&bw, bw_buffer, bw_buffer + kBufferSize); | |
| 84 | 85 | |
| 85 | 86 | int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0; |
| 86 | − for (int i = 0; i < bits_to_test; ++i) { | |
| 87 | + for (int i = 0; i < kBitsToTest; ++i) { | |
| 87 | 88 | if (bit_method == 2) { |
| 88 | 89 | bit = (i & 1); |
| 89 | 90 | } else if (bit_method == 3) { |
| @@ -98,19 +99,20 @@ TEST(VP8, TestBitIO) { · 8 unmodified lines | ||
| 98 | 99 | #if CONFIG_DECRYPT |
| 99 | 100 | encrypt_buffer(bw_buffer, buffer_size); |
| 100 | 101 | vp8dx_start_decode(&br, bw_buffer, buffer_size, |
| 101 | − test_decrypt_cb, (void *)bw_buffer); | |
| 102 | + test_decrypt_cb, | |
| 103 | + reinterpret_cast<void *>(bw_buffer)); | |
| 102 | 104 | #else |
| 103 | − vp8dx_start_decode(&br, bw_buffer, buffer_size, NULL, NULL); | |
| 105 | + vp8dx_start_decode(&br, bw_buffer, kBufferSize, NULL, NULL); | |
| 104 | 106 | #endif |
| 105 | 107 | bit_rnd.Reset(random_seed); |
| 106 | − for (int i = 0; i < bits_to_test; ++i) { | |
| 108 | + for (int i = 0; i < kBitsToTest; ++i) { | |
| 107 | 109 | if (bit_method == 2) { |
| 108 | 110 | bit = (i & 1); |
| 109 | 111 | } else if (bit_method == 3) { |
| 110 | 112 | bit = bit_rnd(2); |
| 111 | 113 | } |
| 112 | 114 | GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit) |
| 113 | − << "pos: "<< i << " / " << bits_to_test | |
| 115 | + << "pos: "<< i << " / " << kBitsToTest | |
| 114 | 116 | << " bit_method: " << bit_method |
| 115 | 117 | << " method: " << method; |
| 116 | 118 | } |