testsuite: macronify main function
This commit is contained in:
parent
d35e8832a6
commit
e9fa9de3c9
|
@ -74,30 +74,4 @@ static const struct test *tests[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
TESTSUITE_MAIN(tests);
|
||||||
{
|
|
||||||
const struct test *t;
|
|
||||||
int arg;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
arg = test_init(argc, argv, tests);
|
|
||||||
if (arg == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (arg < argc) {
|
|
||||||
t = test_find(tests, argv[arg]);
|
|
||||||
if (t == NULL) {
|
|
||||||
fprintf(stderr, "could not find test %s\n", argv[arg]);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return test_run(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; tests[i] != NULL; i++) {
|
|
||||||
if (test_run(tests[i]) != 0)
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
|
@ -125,30 +125,4 @@ static const struct test *tests[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
TESTSUITE_MAIN(tests);
|
||||||
{
|
|
||||||
const struct test *t;
|
|
||||||
int arg;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
arg = test_init(argc, argv, tests);
|
|
||||||
if (arg == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (arg < argc) {
|
|
||||||
t = test_find(tests, argv[arg]);
|
|
||||||
if (t == NULL) {
|
|
||||||
fprintf(stderr, "could not find test %s\n", argv[arg]);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return test_run(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; tests[i] != NULL; i++) {
|
|
||||||
if (test_run(tests[i]) != 0)
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
|
@ -95,30 +95,4 @@ static const struct test *tests[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
TESTSUITE_MAIN(tests);
|
||||||
{
|
|
||||||
const struct test *t;
|
|
||||||
int arg;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
arg = test_init(argc, argv, tests);
|
|
||||||
if (arg == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (arg < argc) {
|
|
||||||
t = test_find(tests, argv[arg]);
|
|
||||||
if (t == NULL) {
|
|
||||||
fprintf(stderr, "could not find test %s\n", argv[arg]);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return test_run(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; tests[i] != NULL; i++) {
|
|
||||||
if (test_run(tests[i]) != 0)
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
|
@ -55,30 +55,4 @@ static const struct test *tests[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
TESTSUITE_MAIN(tests);
|
||||||
{
|
|
||||||
const struct test *t;
|
|
||||||
int arg;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
arg = test_init(argc, argv, tests);
|
|
||||||
if (arg == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (arg < argc) {
|
|
||||||
t = test_find(tests, argv[arg]);
|
|
||||||
if (t == NULL) {
|
|
||||||
fprintf(stderr, "could not find test %s\n", argv[arg]);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return test_run(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; tests[i] != NULL; i++) {
|
|
||||||
if (test_run(tests[i]) != 0)
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
|
@ -127,30 +127,4 @@ static const struct test *tests[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
TESTSUITE_MAIN(tests);
|
||||||
{
|
|
||||||
const struct test *t;
|
|
||||||
int arg;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
arg = test_init(argc, argv, tests);
|
|
||||||
if (arg == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (arg < argc) {
|
|
||||||
t = test_find(tests, argv[arg]);
|
|
||||||
if (t == NULL) {
|
|
||||||
fprintf(stderr, "could not find test %s\n", argv[arg]);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return test_run(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; tests[i] != NULL; i++) {
|
|
||||||
if (test_run(tests[i]) != 0)
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
|
@ -181,30 +181,4 @@ static const struct test *tests[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
TESTSUITE_MAIN(tests);
|
||||||
{
|
|
||||||
const struct test *t;
|
|
||||||
int arg;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
arg = test_init(argc, argv, tests);
|
|
||||||
if (arg == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (arg < argc) {
|
|
||||||
t = test_find(tests, argv[arg]);
|
|
||||||
if (t == NULL) {
|
|
||||||
fprintf(stderr, "could not find test %s\n", argv[arg]);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return test_run(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; tests[i] != NULL; i++) {
|
|
||||||
if (test_run(tests[i]) != 0)
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
|
@ -107,4 +107,33 @@ int test_run(const struct test *t);
|
||||||
.func = _name, \
|
.func = _name, \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define TESTSUITE_MAIN(_tests) \
|
||||||
|
int main(int argc, char *argv[]) \
|
||||||
|
{ \
|
||||||
|
const struct test *t; \
|
||||||
|
int arg; \
|
||||||
|
size_t i; \
|
||||||
|
\
|
||||||
|
arg = test_init(argc, argv, tests); \
|
||||||
|
if (arg == 0) \
|
||||||
|
return 0; \
|
||||||
|
\
|
||||||
|
if (arg < argc) { \
|
||||||
|
t = test_find(tests, argv[arg]); \
|
||||||
|
if (t == NULL) { \
|
||||||
|
fprintf(stderr, "could not find test %s\n", argv[arg]);\
|
||||||
|
exit(EXIT_FAILURE); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
return test_run(t); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
for (i = 0; tests[i] != NULL; i++) { \
|
||||||
|
if (test_run(tests[i]) != 0) \
|
||||||
|
exit(EXIT_FAILURE); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
exit(EXIT_SUCCESS); \
|
||||||
|
} \
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue