How can libraries such as GTest use a single macro G_TEST(...)
to both define the function and register it as a test function? I'm looking for a way to do the same for my C99 project.
Example
TEST_MACRO(mytest)
{
printf("Hello, world\n");
return 0;
}
TEST_MACRO(mytest2)
{
printf("Hello, world 2\n");
return 2;
}
void main(int argc, char** argv)
{
RUN_TESTS();
}
Can't figure out how to register the tests so they are known from RUN_TESTS()
Aucun commentaire:
Enregistrer un commentaire