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

Side by Side Diff: tests/PathCoverageTest.cpp

Issue 132843002: Add REPORTF test macro. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: factor 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
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 "SkMath.h" 10 #include "SkMath.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 quadraticPointCount_EC(path, SkIntToScalar(1)); 130 quadraticPointCount_EC(path, SkIntToScalar(1));
131 estimatedCount = 131 estimatedCount =
132 quadraticPointCount_CE(path); 132 quadraticPointCount_CE(path);
133 } 133 }
134 // Allow estimated to be high by a factor of two, but no less than 134 // Allow estimated to be high by a factor of two, but no less than
135 // the computed value. 135 // the computed value.
136 bool isAccurate = (estimatedCount >= computedCount) && 136 bool isAccurate = (estimatedCount >= computedCount) &&
137 (estimatedCount <= 2 * computedCount); 137 (estimatedCount <= 2 * computedCount);
138 138
139 if (!isAccurate) { 139 if (!isAccurate) {
140 SkString errorDescription; 140 REPORTF(reporter,
141 errorDescription.printf( 141 ("Curve from %.2f %.2f through %.2f %.2f to %.2f %.2f "
142 "Curve from %.2f %.2f through %.2f %.2f to %.2f %.2f " 142 "computes %d, estimates %d\n",
143 "computes %d, estimates %d\n", 143 path[0].fX, path[0].fY, path[1].fX, path[1].fY,
144 path[0].fX, path[0].fY, path[1].fX, path[1].fY, 144 path[2].fX, path[2].fY, computedCount, estimatedCount));
145 path[2].fX, path[2].fY, computedCount, estimatedCount);
146 numErrors++; 145 numErrors++;
147 reporter->reportFailed(errorDescription);
148 } 146 }
149 } 147 }
150 148
151 return (numErrors == 0); 149 return (numErrors == 0);
152 } 150 }
153 151
154 152
155 153
156 static void TestQuadPointCount(skiatest::Reporter* reporter) { 154 static void TestQuadPointCount(skiatest::Reporter* reporter) {
157 one_d_pe(gXY, SK_ARRAY_COUNT(gXY), reporter); 155 one_d_pe(gXY, SK_ARRAY_COUNT(gXY), reporter);
158 one_d_pe(gSawtooth, SK_ARRAY_COUNT(gSawtooth), reporter); 156 one_d_pe(gSawtooth, SK_ARRAY_COUNT(gSawtooth), reporter);
159 one_d_pe(gOvalish, SK_ARRAY_COUNT(gOvalish), reporter); 157 one_d_pe(gOvalish, SK_ARRAY_COUNT(gOvalish), reporter);
160 one_d_pe(gSharpSawtooth, SK_ARRAY_COUNT(gSharpSawtooth), reporter); 158 one_d_pe(gSharpSawtooth, SK_ARRAY_COUNT(gSharpSawtooth), reporter);
161 one_d_pe(gRibbon, SK_ARRAY_COUNT(gRibbon), reporter); 159 one_d_pe(gRibbon, SK_ARRAY_COUNT(gRibbon), reporter);
162 } 160 }
163 161
164 DEF_TEST(PathCoverage, reporter) { 162 DEF_TEST(PathCoverage, reporter) {
165 TestQuadPointCount(reporter); 163 TestQuadPointCount(reporter);
166 164
167 } 165 }
OLDNEW
« no previous file with comments | « tests/MathTest.cpp ('k') | tests/SortTest.cpp » ('j') | tests/Test.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698