Add an even more convenient way to declare tests, with example.
authormtklein@google.com <mtklein@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 19 Sep 2013 20:56:46 +0000 (20:56 +0000)
committermtklein@google.com <mtklein@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 19 Sep 2013 20:56:46 +0000 (20:56 +0000)
BUG=
R=reed@google.com

Review URL: https://codereview.chromium.org/23828008

git-svn-id: http://skia.googlecode.com/svn/trunk@11405 2bbb7eff-a529-9590-31e7-b0007b416f81

tests/AAClipTest.cpp
tests/TestClassDef.h

index e3be006..f70cfd6 100644 (file)
@@ -394,7 +394,8 @@ static void test_regressions() {
     }
 }
 
-static void TestAAClip(skiatest::Reporter* reporter) {
+#include "TestClassDef.h"
+DEF_TEST(AAClip, reporter) {
     test_empty(reporter);
     test_path_bounds(reporter);
     test_irect(reporter);
@@ -403,6 +404,3 @@ static void TestAAClip(skiatest::Reporter* reporter) {
     test_regressions();
     test_nearly_integral(reporter);
 }
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS("AAClip", AAClipTestClass, TestAAClip)
index 70d6039..89124c7 100644 (file)
         };                                                                              \
         static TestRegistry gReg_##classname(classname::Factory);                       \
     }
+
+
+// Yet shorter way to define a test.  E.g.
+//
+// DEF_TEST(some_test_name, r) {
+//   ...
+//   REPORTER_ASSERT(r, x == 15);
+// }
+#define DEF_TEST(name, reporter) \
+    static void name(skiatest::Reporter* reporter); \
+    DEFINE_TESTCLASS_SHORT(name) \
+    static void name(skiatest::Reporter* reporter)