OLD | NEW |
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 25 matching lines...) Expand all Loading... |
36 int countTests() const { return fTestCount; } | 36 int countTests() const { return fTestCount; } |
37 int countResults(Result r) { | 37 int countResults(Result r) { |
38 SkASSERT((unsigned)r <= kLastResult); | 38 SkASSERT((unsigned)r <= kLastResult); |
39 return fResultCount[r]; | 39 return fResultCount[r]; |
40 } | 40 } |
41 | 41 |
42 void startTest(Test*); | 42 void startTest(Test*); |
43 void report(const char testDesc[], Result); | 43 void report(const char testDesc[], Result); |
44 void endTest(Test*); | 44 void endTest(Test*); |
45 virtual bool allowExtendedTest() const { return false; } | 45 virtual bool allowExtendedTest() const { return false; } |
46 | 46 virtual bool allowThreaded() const { return false; } |
47 // helpers for tests | 47 // helpers for tests |
48 void assertTrue(bool cond, const char desc[]) { | 48 void assertTrue(bool cond, const char desc[]) { |
49 if (!cond) { | 49 if (!cond) { |
50 this->report(desc, kFailed); | 50 this->report(desc, kFailed); |
51 } | 51 } |
52 } | 52 } |
53 void assertFalse(bool cond, const char desc[]) { | 53 void assertFalse(bool cond, const char desc[]) { |
54 if (cond) { | 54 if (cond) { |
55 this->report(desc, kFailed); | 55 this->report(desc, kFailed); |
56 } | 56 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 do { \ | 128 do { \ |
129 if (!(cond)) { \ | 129 if (!(cond)) { \ |
130 SkString desc; \ | 130 SkString desc; \ |
131 desc.printf("%s %s:%d: %s", message, __FILE__, __LINE__, #cond); \ | 131 desc.printf("%s %s:%d: %s", message, __FILE__, __LINE__, #cond); \ |
132 r->reportFailed(desc); \ | 132 r->reportFailed(desc); \ |
133 } \ | 133 } \ |
134 } while(0) | 134 } while(0) |
135 | 135 |
136 | 136 |
137 #endif | 137 #endif |
OLD | NEW |