History

Fix scan_build warnings in idct_test.cc

BUG=webm:1575

Angie Chiang committed 7 years ago

Commit 2d672cb1 parent 0310ebd1 file · +39 −31Browse files

Showing the changes to test (1 of 1 file). Show all

Unified · Split

test/idct_test.cc+39−31
@@ -72,49 +72,57 @@ TEST_P(IDCTTest, TestAllZeros) { · 71 unmodified lines
7272
7373 TEST_P(IDCTTest, TestAllOnes) {
7474 input->Set(0);
75− // When the first element is '4' it will fill the output buffer with '1'.
76− input->TopLeftPixel()[0] = 4;
77− predict->Set(0);
78− output->Set(0);
79−
80− ASM_REGISTER_STATE_CHECK(UUT(input->TopLeftPixel(), predict->TopLeftPixel(),
81− predict->stride(), output->TopLeftPixel(),
82− output->stride()));
83−
84− ASSERT_TRUE(output->CheckValues(1));
85− ASSERT_TRUE(output->CheckPadding());
75+ if (input->TopLeftPixel() != NULL) {
76+ // When the first element is '4' it will fill the output buffer with '1'.
77+ input->TopLeftPixel()[0] = 4;
78+ predict->Set(0);
79+ output->Set(0);
80+
81+ ASM_REGISTER_STATE_CHECK(UUT(input->TopLeftPixel(), predict->TopLeftPixel(),
82+ predict->stride(), output->TopLeftPixel(),
83+ output->stride()));
84+
85+ ASSERT_TRUE(output->CheckValues(1));
86+ ASSERT_TRUE(output->CheckPadding());
87+ } else {
88+ assert(0);
89+ }
8690 }
8791
8892 TEST_P(IDCTTest, TestAddOne) {
8993 // Set the transform output to '1' and make sure it gets added to the
9094 // prediction buffer.
9195 input->Set(0);
92− input->TopLeftPixel()[0] = 4;
93− output->Set(0);
94−
95− uint8_t *pred = predict->TopLeftPixel();
96− for (int y = 0; y < 4; ++y) {
97− for (int x = 0; x < 4; ++x) {
98− pred[y * predict->stride() + x] = y * 4 + x;
96+ if (input->TopLeftPixel() != NULL) {
97+ input->TopLeftPixel()[0] = 4;
98+ output->Set(0);
99+
100+ uint8_t *pred = predict->TopLeftPixel();
101+ for (int y = 0; y < 4; ++y) {
102+ for (int x = 0; x < 4; ++x) {
103+ pred[y * predict->stride() + x] = y * 4 + x;
104+ }
99105 }
100− }
101106
102− ASM_REGISTER_STATE_CHECK(UUT(input->TopLeftPixel(), predict->TopLeftPixel(),
103− predict->stride(), output->TopLeftPixel(),
104− output->stride()));
107+ ASM_REGISTER_STATE_CHECK(UUT(input->TopLeftPixel(), predict->TopLeftPixel(),
108+ predict->stride(), output->TopLeftPixel(),
109+ output->stride()));
105110
106− uint8_t const *out = output->TopLeftPixel();
107− for (int y = 0; y < 4; ++y) {
108− for (int x = 0; x < 4; ++x) {
109− EXPECT_EQ(1 + y * 4 + x, out[y * output->stride() + x]);
111+ uint8_t const *out = output->TopLeftPixel();
112+ for (int y = 0; y < 4; ++y) {
113+ for (int x = 0; x < 4; ++x) {
114+ EXPECT_EQ(1 + y * 4 + x, out[y * output->stride() + x]);
115+ }
110116 }
111− }
112117
113− if (HasFailure()) {
114− output->DumpBuffer();
115− }
118+ if (HasFailure()) {
119+ output->DumpBuffer();
120+ }
116121
117− ASSERT_TRUE(output->CheckPadding());
122+ ASSERT_TRUE(output->CheckPadding());
123+ } else {
124+ assert(0);
125+ }
118126 }
119127
120128 TEST_P(IDCTTest, TestWithData) {

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