Skip to content

Commit

Permalink
Test Framework Modify : Remove JSONTEST_REGISTER_FIXTURE (open-source…
Browse files Browse the repository at this point in the history
…-parsers#1050)

* add JSONTEST_FIXTURE_V2 to automatically register

* fix clang-format

* revert singleton
  • Loading branch information
dota17 authored and baylesj committed Oct 15, 2019
1 parent bcad4e4 commit c5f66ab
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 182 deletions.
22 changes: 22 additions & 0 deletions src/test_lib_json/jsontest.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,26 @@ TestResult& checkStringEqual(TestResult& result, const Json::String& expected,
#define JSONTEST_REGISTER_FIXTURE(runner, FixtureType, name) \
(runner).add(JSONTEST_FIXTURE_FACTORY(FixtureType, name))

/// \brief Begin a fixture test case.
#define JSONTEST_FIXTURE_V2(FixtureType, name, collections) \
class Test##FixtureType##name : public FixtureType { \
public: \
static JsonTest::TestCase* factory() { \
return new Test##FixtureType##name(); \
} \
static bool collect() { \
(collections).push_back(JSONTEST_FIXTURE_FACTORY(FixtureType, name)); \
return true; \
} \
\
public: /* overridden from TestCase */ \
const char* testName() const override { return #FixtureType "/" #name; } \
void runTestCase() override; \
}; \
\
static bool test##FixtureType##name##collect = \
Test##FixtureType##name::collect(); \
\
void Test##FixtureType##name::runTestCase()

#endif // ifndef JSONTEST_H_INCLUDED
Loading

0 comments on commit c5f66ab

Please sign in to comment.