Skip to content

Commit c5f66ab

Browse files
dota17baylesj
authored andcommitted
Test Framework Modify : Remove JSONTEST_REGISTER_FIXTURE (#1050)
* add JSONTEST_FIXTURE_V2 to automatically register * fix clang-format * revert singleton
1 parent bcad4e4 commit c5f66ab

File tree

2 files changed

+112
-182
lines changed

2 files changed

+112
-182
lines changed

src/test_lib_json/jsontest.h

+22
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,26 @@ TestResult& checkStringEqual(TestResult& result, const Json::String& expected,
264264
#define JSONTEST_REGISTER_FIXTURE(runner, FixtureType, name) \
265265
(runner).add(JSONTEST_FIXTURE_FACTORY(FixtureType, name))
266266

267+
/// \brief Begin a fixture test case.
268+
#define JSONTEST_FIXTURE_V2(FixtureType, name, collections) \
269+
class Test##FixtureType##name : public FixtureType { \
270+
public: \
271+
static JsonTest::TestCase* factory() { \
272+
return new Test##FixtureType##name(); \
273+
} \
274+
static bool collect() { \
275+
(collections).push_back(JSONTEST_FIXTURE_FACTORY(FixtureType, name)); \
276+
return true; \
277+
} \
278+
\
279+
public: /* overridden from TestCase */ \
280+
const char* testName() const override { return #FixtureType "/" #name; } \
281+
void runTestCase() override; \
282+
}; \
283+
\
284+
static bool test##FixtureType##name##collect = \
285+
Test##FixtureType##name::collect(); \
286+
\
287+
void Test##FixtureType##name::runTestCase()
288+
267289
#endif // ifndef JSONTEST_H_INCLUDED

0 commit comments

Comments
 (0)