History

cleanup cpplint warnings

Suggested by James Zern to clear out cpplint warnings for all unit test code.

Yaowu Xu committed 13 years ago

Commit afffa3d1 parent e4e864527 files · +112 −102Browse files

Showing the changes to test/vp8_boolcoder_test.cc (1 of 27 files). Show all

Unified · Split

test/vp8_boolcoder_test.cc+18−16
@@ -8,10 +8,6 @@ · 7 unmodified lines
88 * be found in the AUTHORS file in the root of the source tree.
99 */
1010
11−extern "C" {
12−#include "vp8/encoder/boolhuff.h"
13−#include "vp8/decoder/dboolhuff.h"
14−}
1511
1612 #include <math.h>
1713 #include <stddef.h>
@@ -24,6 +20,11 @@ extern "C" { · 6 unmodified lines
2420 #include "third_party/googletest/src/include/gtest/gtest.h"
2521 #include "vpx/vpx_integer.h"
2622
23+extern "C" {
24+#include "vp8/encoder/boolhuff.h"
25+#include "vp8/decoder/dboolhuff.h"
26+}
27+
2728 namespace {
2829 const int num_tests = 10;
2930
@@ -44,7 +45,7 @@ void encrypt_buffer(uint8_t *buffer, int size) { · 14 unmodified lines
4445
4546 void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
4647 uint8_t *output, int count) {
47− int offset = input - (uint8_t *)decrypt_state;
48+ int offset = input - reinterpret_cast<uint8_t *>(decrypt_state);
4849 for (int i = 0; i < count; i++) {
4950 output[i] = input[i] ^ secret_key[(offset + i) & 15];
5051 }
@@ -58,10 +59,10 @@ TEST(VP8, TestBitIO) { · 7 unmodified lines
5859 ACMRandom rnd(ACMRandom::DeterministicSeed());
5960 for (int n = 0; n < num_tests; ++n) {
6061 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];
6364
64− for (int i = 0; i < bits_to_test; ++i) {
65+ for (int i = 0; i < kBitsToTest; ++i) {
6566 const int parity = i & 1;
6667 probas[i] =
6768 (method == 0) ? 0 : (method == 1) ? 255 :
@@ -76,14 +77,14 @@ TEST(VP8, TestBitIO) { · 8 unmodified lines
7677 }
7778 for (int bit_method = 0; bit_method <= 3; ++bit_method) {
7879 const int random_seed = 6432;
79− const int buffer_size = 10000;
80+ const int kBufferSize = 10000;
8081 ACMRandom bit_rnd(random_seed);
8182 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);
8485
8586 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) {
8788 if (bit_method == 2) {
8889 bit = (i & 1);
8990 } else if (bit_method == 3) {
@@ -98,19 +99,20 @@ TEST(VP8, TestBitIO) { · 8 unmodified lines
9899 #if CONFIG_DECRYPT
99100 encrypt_buffer(bw_buffer, buffer_size);
100101 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));
102104 #else
103− vp8dx_start_decode(&br, bw_buffer, buffer_size, NULL, NULL);
105+ vp8dx_start_decode(&br, bw_buffer, kBufferSize, NULL, NULL);
104106 #endif
105107 bit_rnd.Reset(random_seed);
106− for (int i = 0; i < bits_to_test; ++i) {
108+ for (int i = 0; i < kBitsToTest; ++i) {
107109 if (bit_method == 2) {
108110 bit = (i & 1);
109111 } else if (bit_method == 3) {
110112 bit = bit_rnd(2);
111113 }
112114 GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)
113− << "pos: "<< i << " / " << bits_to_test
115+ << "pos: "<< i << " / " << kBitsToTest
114116 << " bit_method: " << bit_method
115117 << " method: " << method;
116118 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t