Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: unit_test/math_test.cc

Issue 1399523004: break up unittests into categories (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: bump version Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « unit_test/cpu_test.cc ('k') | unit_test/planar_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 The LibYuv Project Authors. All rights reserved. 2 * Copyright 2013 The LibYuv Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <stdlib.h> 11 #include <stdlib.h>
12 #include <string.h> 12 #include <string.h>
13 #include <time.h> 13 #include <time.h>
14 14
15 #include "libyuv/basic_types.h" 15 #include "libyuv/basic_types.h"
16 #include "libyuv/cpu_id.h" 16 #include "libyuv/cpu_id.h"
17 #include "libyuv/row.h" 17 #include "libyuv/row.h"
18 #include "libyuv/scale.h" 18 #include "libyuv/scale.h"
19 #include "libyuv/scale_row.h" 19 #include "libyuv/scale_row.h"
20 #include "../unit_test/unit_test.h" 20 #include "../unit_test/unit_test.h"
21 21
22 namespace libyuv { 22 namespace libyuv {
23 23
24 TEST_F(libyuvTest, TestFixedDiv) { 24 TEST_F(LibYUVBaseTest, TestFixedDiv) {
25 int num[1280]; 25 int num[1280];
26 int div[1280]; 26 int div[1280];
27 int result_opt[1280]; 27 int result_opt[1280];
28 int result_c[1280]; 28 int result_c[1280];
29 29
30 EXPECT_EQ(0x10000, libyuv::FixedDiv(1, 1)); 30 EXPECT_EQ(0x10000, libyuv::FixedDiv(1, 1));
31 EXPECT_EQ(0x7fff0000, libyuv::FixedDiv(0x7fff, 1)); 31 EXPECT_EQ(0x7fff0000, libyuv::FixedDiv(0x7fff, 1));
32 // TODO(fbarchard): Avoid the following that throw exceptions. 32 // TODO(fbarchard): Avoid the following that throw exceptions.
33 // EXPECT_EQ(0x100000000, libyuv::FixedDiv(0x10000, 1)); 33 // EXPECT_EQ(0x100000000, libyuv::FixedDiv(0x10000, 1));
34 // EXPECT_EQ(0x80000000, libyuv::FixedDiv(0x8000, 1)); 34 // EXPECT_EQ(0x80000000, libyuv::FixedDiv(0x8000, 1));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 for (int j = 0; j < 1280; ++j) { 78 for (int j = 0; j < 1280; ++j) {
79 result_opt[j] = libyuv::FixedDiv(num[j], div[j]); 79 result_opt[j] = libyuv::FixedDiv(num[j], div[j]);
80 } 80 }
81 } 81 }
82 for (int j = 0; j < 1280; ++j) { 82 for (int j = 0; j < 1280; ++j) {
83 result_c[j] = libyuv::FixedDiv_C(num[j], div[j]); 83 result_c[j] = libyuv::FixedDiv_C(num[j], div[j]);
84 EXPECT_NEAR(result_c[j], result_opt[j], 1); 84 EXPECT_NEAR(result_c[j], result_opt[j], 1);
85 } 85 }
86 } 86 }
87 87
88 TEST_F(libyuvTest, TestFixedDiv_Opt) { 88 TEST_F(LibYUVBaseTest, TestFixedDiv_Opt) {
89 int num[1280]; 89 int num[1280];
90 int div[1280]; 90 int div[1280];
91 int result_opt[1280]; 91 int result_opt[1280];
92 int result_c[1280]; 92 int result_c[1280];
93 93
94 MemRandomize(reinterpret_cast<uint8*>(&num[0]), sizeof(num)); 94 MemRandomize(reinterpret_cast<uint8*>(&num[0]), sizeof(num));
95 MemRandomize(reinterpret_cast<uint8*>(&div[0]), sizeof(div)); 95 MemRandomize(reinterpret_cast<uint8*>(&div[0]), sizeof(div));
96 for (int j = 0; j < 1280; ++j) { 96 for (int j = 0; j < 1280; ++j) {
97 num[j] &= 4095; // Make numerator smaller. 97 num[j] &= 4095; // Make numerator smaller.
98 div[j] &= 4095; // Make divisor smaller. 98 div[j] &= 4095; // Make divisor smaller.
(...skipping 13 matching lines...) Expand all
112 result_opt[j] = libyuv::FixedDiv_C(num[j], div[j]); 112 result_opt[j] = libyuv::FixedDiv_C(num[j], div[j]);
113 } 113 }
114 } 114 }
115 } 115 }
116 for (int j = 0; j < 1280; ++j) { 116 for (int j = 0; j < 1280; ++j) {
117 result_c[j] = libyuv::FixedDiv_C(num[j], div[j]); 117 result_c[j] = libyuv::FixedDiv_C(num[j], div[j]);
118 EXPECT_NEAR(result_c[j], result_opt[j], 1); 118 EXPECT_NEAR(result_c[j], result_opt[j], 1);
119 } 119 }
120 } 120 }
121 121
122 TEST_F(libyuvTest, TestFixedDiv1_Opt) { 122 TEST_F(LibYUVBaseTest, TestFixedDiv1_Opt) {
123 int num[1280]; 123 int num[1280];
124 int div[1280]; 124 int div[1280];
125 int result_opt[1280]; 125 int result_opt[1280];
126 int result_c[1280]; 126 int result_c[1280];
127 127
128 MemRandomize(reinterpret_cast<uint8*>(&num[0]), sizeof(num)); 128 MemRandomize(reinterpret_cast<uint8*>(&num[0]), sizeof(num));
129 MemRandomize(reinterpret_cast<uint8*>(&div[0]), sizeof(div)); 129 MemRandomize(reinterpret_cast<uint8*>(&div[0]), sizeof(div));
130 for (int j = 0; j < 1280; ++j) { 130 for (int j = 0; j < 1280; ++j) {
131 num[j] &= 4095; // Make numerator smaller. 131 num[j] &= 4095; // Make numerator smaller.
132 div[j] &= 4095; // Make divisor smaller. 132 div[j] &= 4095; // Make divisor smaller.
(...skipping 14 matching lines...) Expand all
147 } 147 }
148 } 148 }
149 } 149 }
150 for (int j = 0; j < 1280; ++j) { 150 for (int j = 0; j < 1280; ++j) {
151 result_c[j] = libyuv::FixedDiv1_C(num[j], div[j]); 151 result_c[j] = libyuv::FixedDiv1_C(num[j], div[j]);
152 EXPECT_NEAR(result_c[j], result_opt[j], 1); 152 EXPECT_NEAR(result_c[j], result_opt[j], 1);
153 } 153 }
154 } 154 }
155 155
156 } // namespace libyuv 156 } // namespace libyuv
OLDNEW
« no previous file with comments | « unit_test/cpu_test.cc ('k') | unit_test/planar_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698