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

Side by Side Diff: tests/Test.h

Issue 14063005: add extended option to Test (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | « no previous file | tests/Test.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #ifndef skiatest_Test_DEFINED 8 #ifndef skiatest_Test_DEFINED
9 #define skiatest_Test_DEFINED 9 #define skiatest_Test_DEFINED
10 10
(...skipping 13 matching lines...) Expand all
24 Reporter(); 24 Reporter();
25 25
26 enum Result { 26 enum Result {
27 kPassed, // must begin with 0 27 kPassed, // must begin with 0
28 kFailed, 28 kFailed,
29 ///// 29 /////
30 kLastResult = kFailed 30 kLastResult = kFailed
31 }; 31 };
32 32
33 void resetReporting(); 33 void resetReporting();
34 void bumpTestCount() { ++fTestCount; }
34 int countTests() const { return fTestCount; } 35 int countTests() const { return fTestCount; }
35 int countResults(Result r) { 36 int countResults(Result r) {
36 SkASSERT((unsigned)r <= kLastResult); 37 SkASSERT((unsigned)r <= kLastResult);
37 return fResultCount[r]; 38 return fResultCount[r];
38 } 39 }
39 40
40 void startTest(Test*); 41 void startTest(Test*);
41 void report(const char testDesc[], Result); 42 void report(const char testDesc[], Result);
42 void endTest(Test*); 43 void endTest(Test*);
44 virtual bool allowExtendedTest() const { return false; }
43 45
44 // helpers for tests 46 // helpers for tests
45 void assertTrue(bool cond, const char desc[]) { 47 void assertTrue(bool cond, const char desc[]) {
46 if (!cond) { 48 if (!cond) {
47 this->report(desc, kFailed); 49 this->report(desc, kFailed);
48 } 50 }
49 } 51 }
50 void assertFalse(bool cond, const char desc[]) { 52 void assertFalse(bool cond, const char desc[]) {
51 if (cond) { 53 if (cond) {
52 this->report(desc, kFailed); 54 this->report(desc, kFailed);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 do { \ 127 do { \
126 if (!(cond)) { \ 128 if (!(cond)) { \
127 SkString desc; \ 129 SkString desc; \
128 desc.printf("%s %s:%d: %s", message, __FILE__, __LINE__, #cond); \ 130 desc.printf("%s %s:%d: %s", message, __FILE__, __LINE__, #cond); \
129 r->reportFailed(desc); \ 131 r->reportFailed(desc); \
130 } \ 132 } \
131 } while(0) 133 } while(0)
132 134
133 135
134 #endif 136 #endif
OLDNEW
« no previous file with comments | « no previous file | tests/Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698