Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <vector>
- typedef void (*TestFunction)();
- static std::vector<TestFunction>collectionOfTestFunction;
- int registerFunction(TestFunction f){
- collectionOfTestFunction.push_back(f);
- return 1;
- }
- #define ADD_TEST(TEST_NAME) void test_##TEST_NAME(void); \
- static int t_##TEST_NAME = registerFunction(test_##TEST_NAME); \
- void test_##TEST_NAME (void)
- ADD_TEST(SimpleTest){
- printf("my test\n");
- }
- int main(int argc, char *argv[]) {
- for (auto f : collectionOfTestFunction){
- f();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement