mirror of
https://github.com/unittest-cpp/unittest-cpp
synced 2026-09-26 16:19:30 +03:00
added long/short macro
This commit is contained in:
parent
264799129b
commit
b48bd9852e
2 changed files with 20 additions and 4 deletions
|
|
@ -4,7 +4,7 @@
|
|||
#include "TestParameter.h"
|
||||
|
||||
|
||||
#define SET_TEST_PARAMETER_LISTENER(Type, Name, ListenerPtr, SetUpBody) \
|
||||
#define UNITTEST_SET_TEST_PARAMETER_LISTENER(Type, Name, ListenerPtr, SetUpBody) \
|
||||
class ParameterizedCreator##Name \
|
||||
{ \
|
||||
public: \
|
||||
|
|
@ -22,8 +22,22 @@
|
|||
static UnitTest::TestParameter<Type> & Name(parameterizedCreator##Name##Instance.globalInstance)
|
||||
|
||||
|
||||
#define SET_TEST_PARAMETER(Type, Name, SetUpBody) \
|
||||
SET_TEST_PARAMETER_LISTENER(Type, Name, nullptr, SetUpBody)
|
||||
#define UNITTEST_SET_TEST_PARAMETER(Type, Name, SetUpBody) \
|
||||
UNITTEST_SET_TEST_PARAMETER_LISTENER(Type, Name, nullptr, SetUpBody)
|
||||
|
||||
|
||||
#ifndef UNITTEST_DISABLE_SHORT_MACROS
|
||||
#ifdef SET_TEST_PARAMETER_LISTENER
|
||||
#error SET_TEST_PARAMETER_LISTENER already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_SET_TEST_PARAMETER_LISTENER instead
|
||||
#else
|
||||
#define SET_TEST_PARAMETER_LISTENER UNITTEST_SET_TEST_PARAMETER_LISTENER
|
||||
#endif
|
||||
|
||||
#ifdef SET_TEST_PARAMETER
|
||||
#error SET_TEST_PARAMETER already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_SET_TEST_PARAMETER instead
|
||||
#else
|
||||
#define SET_TEST_PARAMETER UNITTEST_SET_TEST_PARAMETER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -37,7 +37,9 @@ UNITTEST_SUITE(LongMacros)
|
|||
defined(SUITE) || \
|
||||
defined(TEST) || \
|
||||
defined(TEST_FIXTURE) || \
|
||||
defined(REQUIRE)
|
||||
defined(REQUIRE) || \
|
||||
defined(SET_TEST_PARAMETER_LISTENER) || \
|
||||
defined(SET_TEST_PARAMETER)
|
||||
|
||||
UNITTEST_CHECK(false);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue