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

Side by Side Diff: tests/Sk64Test.cpp

Issue 122283002: Revert of remove Sk64 from public API, and start to remove usage internally (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « tests/BitmapCopyTest.cpp ('k') | no next file » | 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 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * 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
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Test.h" 8 #include "Test.h"
9 #include "TestClassDef.h" 9 #include "TestClassDef.h"
10 #include "Sk64.h"
11 #include "SkRandom.h" 10 #include "SkRandom.h"
12 #include <math.h> 11 #include <math.h>
13 12
14 struct BoolTable { 13 struct BoolTable {
15 int8_t zero, pos, neg, toBool, sign; 14 int8_t zero, pos, neg, toBool, sign;
16 }; 15 };
17 16
18 static void bool_table_test(skiatest::Reporter* reporter, 17 static void bool_table_test(skiatest::Reporter* reporter,
19 const Sk64& a, const BoolTable& table) 18 const Sk64& a, const BoolTable& table)
20 { 19 {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 REPORTER_ASSERT(reporter, c.get32() == aa + bb); 85 REPORTER_ASSERT(reporter, c.get32() == aa + bb);
87 c = a; c.add(-bb); 86 c = a; c.add(-bb);
88 REPORTER_ASSERT(reporter, c.get32() == aa - bb); 87 REPORTER_ASSERT(reporter, c.get32() == aa - bb);
89 c = a; c.add(b); 88 c = a; c.add(b);
90 REPORTER_ASSERT(reporter, c.get32() == aa + bb); 89 REPORTER_ASSERT(reporter, c.get32() == aa + bb);
91 c = a; c.sub(b); 90 c = a; c.sub(b);
92 REPORTER_ASSERT(reporter, c.get32() == aa - bb); 91 REPORTER_ASSERT(reporter, c.get32() == aa - bb);
93 } 92 }
94 93
95 for (i = 0; i < 1000; i++) { 94 for (i = 0; i < 1000; i++) {
96 a.set64(rand.next64()); 95 rand.next64(&a); //a.fHi >>= 1; // avoid overflow
97 b.set64(rand.next64()); 96 rand.next64(&b); //b.fHi >>= 1; // avoid overflow
98 97
99 if (!(i & 3)) // want to explicitly test these cases 98 if (!(i & 3)) // want to explicitly test these cases
100 { 99 {
101 a.fLo = 0; 100 a.fLo = 0;
102 b.fLo = 0; 101 b.fLo = 0;
103 } 102 }
104 else if (!(i & 7)) // want to explicitly test these cases 103 else if (!(i & 7)) // want to explicitly test these cases
105 { 104 {
106 a.fHi = 0; 105 a.fHi = 0;
107 b.fHi = 0; 106 b.fHi = 0;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 denom = wide.getSqrt(); 166 denom = wide.getSqrt();
168 int32_t ck = (int32_t)sqrt((double)wide.getLongLong()); 167 int32_t ck = (int32_t)sqrt((double)wide.getLongLong());
169 int diff = denom - ck; 168 int diff = denom - ck;
170 REPORTER_ASSERT(reporter, SkAbs32(diff) <= 1); 169 REPORTER_ASSERT(reporter, SkAbs32(diff) <= 1);
171 } 170 }
172 } 171 }
173 172
174 DEF_TEST(Sk64Test, reporter) { 173 DEF_TEST(Sk64Test, reporter) {
175 Sk64::UnitTestWithReporter(reporter); 174 Sk64::UnitTestWithReporter(reporter);
176 } 175 }
OLDNEW
« no previous file with comments | « tests/BitmapCopyTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698