R
Ryan
Below I have a series of defined macros. When ISVALID_TEST is called the compiler is complaining the macro doesn't have enough actual parameters. This means NOINPUT isn't expanding. The definition of ISVALID_TEST uses the UnitTest++ framework. This isn't an issue but unless you have it it won't compile. It is shown here to explain the macro signature.
How can I get NOINPUT to take the place of Kpos, Kvel and Kacc in the macrocall instead of all being stuffed into Kpos?
Ryan
#define P99_PROTECT(...) __VA_ARGS__
#define NOINPUT P99PROTECT(false, false, false)
#define ISVALID_TEST(TestName, Kpos, Kvel, Kacc) \
TEST(TestName) \
{ \
point = std::make_shared<KinematicState>(); \
if (Kpos) point->set(position); \
}
//This line complains the macro doesn't have enough actual parameters
ISVALID_TEST(NoInput, NOINPUT);
//Works fine.
ISVALID_TEST(NoInput2, false, false, false);
How can I get NOINPUT to take the place of Kpos, Kvel and Kacc in the macrocall instead of all being stuffed into Kpos?
Ryan
#define P99_PROTECT(...) __VA_ARGS__
#define NOINPUT P99PROTECT(false, false, false)
#define ISVALID_TEST(TestName, Kpos, Kvel, Kacc) \
TEST(TestName) \
{ \
point = std::make_shared<KinematicState>(); \
if (Kpos) point->set(position); \
}
//This line complains the macro doesn't have enough actual parameters
ISVALID_TEST(NoInput, NOINPUT);
//Works fine.
ISVALID_TEST(NoInput2, false, false, false);