From 9ea53f93e79ba312c4b3943923450a8b4aa57c82 Mon Sep 17 00:00:00 2001 From: tfarina Date: Tue, 24 Jun 2014 06:50:39 -0700 Subject: Preprend Test to test function name generated by DEF_TEST() macro. That way when declaring a test with DEF_TEST() macro, you don't have to uniquify the test name because it might colide with the class it is being testing. For example, if you are testing SkBase64 and do: DEF_TEST(SkBase64, reporter) { } That will generate an error because the macro will declare a function named SkBase64 which colides with the type SkBase64. By adding Test to the function name we avoid this problem. Fixed the entries found with the following command line: $ git grep "Test, r" | grep DEF BUG=None TEST=make tests && out/Debug/tests R=mtklein@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/345753007 --- tests/Test.h | 66 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'tests/Test.h') diff --git a/tests/Test.h b/tests/Test.h index fc1890096e..72b0bee126 100644 --- a/tests/Test.h +++ b/tests/Test.h @@ -138,38 +138,38 @@ namespace skiatest { (reporter)->reportFailed(desc); \ } while(0) -#define DEF_TEST(name, reporter) \ - static void name(skiatest::Reporter*); \ - namespace skiatest { \ - class name##Class : public Test { \ - public: \ - static Test* Factory(void*) { return SkNEW(name##Class); } \ - protected: \ - virtual void onGetName(SkString* name) SK_OVERRIDE { \ - name->set(#name); \ - } \ - virtual void onRun(Reporter* r) SK_OVERRIDE { name(r); } \ - }; \ - static TestRegistry gReg_##name##Class(name##Class::Factory); \ - } \ - static void name(skiatest::Reporter* reporter) - -#define DEF_GPUTEST(name, reporter, factory) \ - static void name(skiatest::Reporter*, GrContextFactory*); \ - namespace skiatest { \ - class name##Class : public GpuTest { \ - public: \ - static Test* Factory(void*) { return SkNEW(name##Class); } \ - protected: \ - virtual void onGetName(SkString* name) SK_OVERRIDE { \ - name->set(#name); \ - } \ - virtual void onRun(Reporter* r) SK_OVERRIDE { \ - name(r, fGrContextFactory); \ - } \ - }; \ - static TestRegistry gReg_##name##Class(name##Class::Factory); \ - } \ - static void name(skiatest::Reporter* reporter, GrContextFactory* factory) +#define DEF_TEST(name, reporter) \ + static void test_##name(skiatest::Reporter*); \ + namespace skiatest { \ + class name##Class : public Test { \ + public: \ + static Test* Factory(void*) { return SkNEW(name##Class); } \ + protected: \ + virtual void onGetName(SkString* name) SK_OVERRIDE { \ + name->set(#name); \ + } \ + virtual void onRun(Reporter* r) SK_OVERRIDE { test_##name(r); } \ + }; \ + static TestRegistry gReg_##name##Class(name##Class::Factory); \ + } \ + static void test_##name(skiatest::Reporter* reporter) + +#define DEF_GPUTEST(name, reporter, factory) \ + static void test_##name(skiatest::Reporter*, GrContextFactory*); \ + namespace skiatest { \ + class name##Class : public GpuTest { \ + public: \ + static Test* Factory(void*) { return SkNEW(name##Class); } \ + protected: \ + virtual void onGetName(SkString* name) SK_OVERRIDE { \ + name->set(#name); \ + } \ + virtual void onRun(Reporter* r) SK_OVERRIDE { \ + test_##name(r, fGrContextFactory); \ + } \ + }; \ + static TestRegistry gReg_##name##Class(name##Class::Factory); \ + } \ + static void test_##name(skiatest::Reporter* reporter, GrContextFactory* factory) #endif -- cgit v1.2.3