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

Side by Side Diff: tests/TestClassDef.h

Issue 23828008: Add an even more convenient way to declare tests, with example. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: DEF_TEST Created 7 years, 3 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/AAClipTest.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 /* 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 /* This file is meant to be included by .cpp files, so it can spew out a 8 /* This file is meant to be included by .cpp files, so it can spew out a
9 customized class + global definition. 9 customized class + global definition.
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 public: \ 48 public: \
49 static Test* Factory(void*) { return SkNEW(classname); } \ 49 static Test* Factory(void*) { return SkNEW(classname); } \
50 protected: \ 50 protected: \
51 virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(uinam e); } \ 51 virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(uinam e); } \
52 virtual void onRun(Reporter* reporter) SK_OVERRIDE { \ 52 virtual void onRun(Reporter* reporter) SK_OVERRIDE { \
53 function(reporter, GetGrContextFactory()); \ 53 function(reporter, GetGrContextFactory()); \
54 } \ 54 } \
55 }; \ 55 }; \
56 static TestRegistry gReg_##classname(classname::Factory); \ 56 static TestRegistry gReg_##classname(classname::Factory); \
57 } 57 }
58
59
60 // Yet shorter way to define a test. E.g.
61 //
62 // DEF_TEST(some_test_name, r) {
63 // ...
64 // REPORTER_ASSERT(r, x == 15);
65 // }
66 #define DEF_TEST(name, reporter) \
67 static void name(skiatest::Reporter* reporter); \
68 DEFINE_TESTCLASS_SHORT(name) \
69 static void name(skiatest::Reporter* reporter)
OLDNEW
« no previous file with comments | « tests/AAClipTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698