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

Side by Side Diff: tests/Sk64Test.cpp

Issue 100113004: Use DEFINE_TESTCLASS_SHORT macro in tests. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « tests/ShaderOpacityTest.cpp ('k') | tests/SortTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1
2 /* 1 /*
3 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
4 * 3 *
5 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
7
8 #include "Test.h" 8 #include "Test.h"
9 #include "TestClassDef.h"
9 #include "SkRandom.h" 10 #include "SkRandom.h"
10 #include <math.h> 11 #include <math.h>
11 12
12 struct BoolTable { 13 struct BoolTable {
13 int8_t zero, pos, neg, toBool, sign; 14 int8_t zero, pos, neg, toBool, sign;
14 }; 15 };
15 16
16 static void bool_table_test(skiatest::Reporter* reporter, 17 static void bool_table_test(skiatest::Reporter* reporter,
17 const Sk64& a, const BoolTable& table) 18 const Sk64& a, const BoolTable& table)
18 { 19 {
19 REPORTER_ASSERT(reporter, a.isZero() != a.nonZero()); 20 REPORTER_ASSERT(reporter, a.isZero() != a.nonZero());
20 21
21 REPORTER_ASSERT(reporter, !a.isZero() == !table.zero); 22 REPORTER_ASSERT(reporter, !a.isZero() == !table.zero);
22 REPORTER_ASSERT(reporter, !a.isPos() == !table.pos); 23 REPORTER_ASSERT(reporter, !a.isPos() == !table.pos);
23 REPORTER_ASSERT(reporter, !a.isNeg() == !table.neg); 24 REPORTER_ASSERT(reporter, !a.isNeg() == !table.neg);
24 REPORTER_ASSERT(reporter, a.getSign() == table.sign); 25 REPORTER_ASSERT(reporter, a.getSign() == table.sign);
25 } 26 }
26 27
27 #ifdef SkLONGLONG 28 #ifdef SkLONGLONG
28 static SkLONGLONG asLL(const Sk64& a) 29 static SkLONGLONG asLL(const Sk64& a)
29 { 30 {
30 return ((SkLONGLONG)a.fHi << 32) | a.fLo; 31 return ((SkLONGLONG)a.fHi << 32) | a.fLo;
31 } 32 }
32 #endif 33 #endif
33 34
34 static void TestSk64(skiatest::Reporter* reporter) { 35 DEF_TEST(Sk64Test, reporter) {
35 enum BoolTests { 36 enum BoolTests {
36 kZero_BoolTest, 37 kZero_BoolTest,
37 kPos_BoolTest, 38 kPos_BoolTest,
38 kNeg_BoolTest 39 kNeg_BoolTest
39 }; 40 };
40 static const BoolTable gBoolTable[] = { 41 static const BoolTable gBoolTable[] = {
41 { 1, 0, 0, 0, 0 }, 42 { 1, 0, 0, 0, 0 },
42 { 0, 1, 0, 1, 1 }, 43 { 0, 1, 0, 1, 1 },
43 { 0, 0, 1, 1, -1 } 44 { 0, 0, 1, 1, -1 }
44 }; 45 };
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 diff = fixdiv - dfixdiv; 192 diff = fixdiv - dfixdiv;
192 193
193 if (SkAbs32(diff) > 1) { 194 if (SkAbs32(diff) > 1) {
194 SkDebugf(" %d === numer %g denom %g div %g xdiv %x fxdiv %x\n", 195 SkDebugf(" %d === numer %g denom %g div %g xdiv %x fxdiv %x\n",
195 i, dnumer, ddenom, ddiv, dfixdiv, fixdiv); 196 i, dnumer, ddenom, ddiv, dfixdiv, fixdiv);
196 } 197 }
197 REPORTER_ASSERT(reporter, SkAbs32(diff) <= 1); 198 REPORTER_ASSERT(reporter, SkAbs32(diff) <= 1);
198 } 199 }
199 #endif 200 #endif
200 } 201 }
201
202 #include "TestClassDef.h"
203 DEFINE_TESTCLASS("Sk64", Sk64TestClass, TestSk64)
OLDNEW
« no previous file with comments | « tests/ShaderOpacityTest.cpp ('k') | tests/SortTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698