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

Side by Side Diff: tests/MathTest.cpp

Issue 132843002: Add REPORTF test macro. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: final rebase 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/ImageDecodingTest.cpp ('k') | tests/PathCoverageTest.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 /* 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 "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 218 }
219 if (x < -SK_MaxS32) { 219 if (x < -SK_MaxS32) {
220 return ((int32_t)si) == SK_MinS32; 220 return ((int32_t)si) == SK_MinS32;
221 } 221 }
222 return si == ni; 222 return si == ni;
223 } 223 }
224 224
225 static void assert_float_equal(skiatest::Reporter* reporter, const char op[], 225 static void assert_float_equal(skiatest::Reporter* reporter, const char op[],
226 float x, uint32_t ni, uint32_t si) { 226 float x, uint32_t ni, uint32_t si) {
227 if (!equal_float_native_skia(x, ni, si)) { 227 if (!equal_float_native_skia(x, ni, si)) {
228 SkString desc; 228 ERRORF(reporter, "%s float %g bits %x native %x skia %x\n",
229 uint32_t xi = SkFloat2Bits(x); 229 op, x, SkFloat2Bits(x), ni, si);
230 desc.printf("%s float %g bits %x native %x skia %x\n", op, x, xi, ni, si );
231 reporter->reportFailed(desc);
232 } 230 }
233 } 231 }
234 232
235 static void test_float_cast(skiatest::Reporter* reporter, float x) { 233 static void test_float_cast(skiatest::Reporter* reporter, float x) {
236 int ix = (int)x; 234 int ix = (int)x;
237 int iix = SkFloatToIntCast(x); 235 int iix = SkFloatToIntCast(x);
238 assert_float_equal(reporter, "cast", x, ix, iix); 236 assert_float_equal(reporter, "cast", x, ix, iix);
239 } 237 }
240 238
241 static void test_float_floor(skiatest::Reporter* reporter, float x) { 239 static void test_float_floor(skiatest::Reporter* reporter, float x) {
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 test_divmod<int16_t>(r); 597 test_divmod<int16_t>(r);
600 } 598 }
601 599
602 DEF_TEST(divmod_s32, r) { 600 DEF_TEST(divmod_s32, r) {
603 test_divmod<int32_t>(r); 601 test_divmod<int32_t>(r);
604 } 602 }
605 603
606 DEF_TEST(divmod_s64, r) { 604 DEF_TEST(divmod_s64, r) {
607 test_divmod<int64_t>(r); 605 test_divmod<int64_t>(r);
608 } 606 }
OLDNEW
« no previous file with comments | « tests/ImageDecodingTest.cpp ('k') | tests/PathCoverageTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698