Skip to content

Commit 5034a4e

Browse files
committed
Make tmc-check files backwards compatible
1 parent f4cbfed commit 5034a4e

File tree

8 files changed

+60
-0
lines changed

8 files changed

+60
-0
lines changed

plugins/make/tests/data/failing-exercise/test/tmc-check.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,23 @@ void tmc_set_tcase_points(TCase *tc, const char *tc_name, const char *points)
5151
parse_points(points, &all_points);
5252
}
5353

54+
#if CHECK_MINOR_VERSION < 15
55+
void _tmc_register_test(Suite *s, TFun tf, const char *fname, const char *points)
56+
{
57+
TCase *tc = tcase_create(fname);
58+
tmc_set_tcase_points(tc, fname, points);
59+
_tcase_add_test(tc, tf, tname, 0, 0, 0, 1);
60+
suite_add_tcase(s, tc);
61+
}
62+
#else
5463
void _tmc_register_test(Suite *s, const TTest *tt, const char *fname, const char *points)
5564
{
5665
TCase *tc = tcase_create(fname);
5766
tmc_set_tcase_points(tc, fname, points);
5867
_tcase_add_test(tc, tt, 0, 0, 0, 1);
5968
suite_add_tcase(s, tc);
6069
}
70+
#endif
6171

6272
void tmc_set_suite_points(Suite *s, const char *s_name, const char *points)
6373
{

plugins/make/tests/data/failing-exercise/test/tmc-check.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ Suite* tmc_suite_create(const char *name, const char *points);
1616
*
1717
* One can also register the test function normally and then call tmc_set_tcase_points.
1818
*/
19+
#if CHECK_MINOR_VERSION < 15
20+
#define tmc_register_test(suite, tf, points) _tmc_register_test((suite), (tf), "" # tf, points)
21+
void _tmc_register_test(Suite *s, TFun tf, const char *fname, const char *points);
22+
#else
1923
#define tmc_register_test(suite, tt, points) _tmc_register_test((suite), (tt), "" # tt, points)
2024
void _tmc_register_test(Suite *s, const TTest *tt, const char *fname, const char *points);
25+
#endif
2126

2227

2328
/**

plugins/make/tests/data/passing-exercise/test/tmc-check.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,23 @@ void tmc_set_tcase_points(TCase *tc, const char *tc_name, const char *points)
5151
parse_points(points, &all_points);
5252
}
5353

54+
#if CHECK_MINOR_VERSION < 15
55+
void _tmc_register_test(Suite *s, TFun tf, const char *fname, const char *points)
56+
{
57+
TCase *tc = tcase_create(fname);
58+
tmc_set_tcase_points(tc, fname, points);
59+
_tcase_add_test(tc, tf, tname, 0, 0, 0, 1);
60+
suite_add_tcase(s, tc);
61+
}
62+
#else
5463
void _tmc_register_test(Suite *s, const TTest *tt, const char *fname, const char *points)
5564
{
5665
TCase *tc = tcase_create(fname);
5766
tmc_set_tcase_points(tc, fname, points);
5867
_tcase_add_test(tc, tt, 0, 0, 0, 1);
5968
suite_add_tcase(s, tc);
6069
}
70+
#endif
6171

6272
void tmc_set_suite_points(Suite *s, const char *s_name, const char *points)
6373
{

plugins/make/tests/data/passing-exercise/test/tmc-check.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ Suite* tmc_suite_create(const char *name, const char *points);
1616
*
1717
* One can also register the test function normally and then call tmc_set_tcase_points.
1818
*/
19+
#if CHECK_MINOR_VERSION < 15
20+
#define tmc_register_test(suite, tf, points) _tmc_register_test((suite), (tf), "" # tf, points)
21+
void _tmc_register_test(Suite *s, TFun tf, const char *fname, const char *points);
22+
#else
1923
#define tmc_register_test(suite, tt, points) _tmc_register_test((suite), (tt), "" # tt, points)
2024
void _tmc_register_test(Suite *s, const TTest *tt, const char *fname, const char *points);
25+
#endif
2126

2227

2328
/**

plugins/make/tests/data/valgrind-failing-exercise/test/tmc-check.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,23 @@ void tmc_set_tcase_points(TCase *tc, const char *tc_name, const char *points)
5151
parse_points(points, &all_points);
5252
}
5353

54+
#if CHECK_MINOR_VERSION < 15
55+
void _tmc_register_test(Suite *s, TFun tf, const char *fname, const char *points)
56+
{
57+
TCase *tc = tcase_create(fname);
58+
tmc_set_tcase_points(tc, fname, points);
59+
_tcase_add_test(tc, tf, tname, 0, 0, 0, 1);
60+
suite_add_tcase(s, tc);
61+
}
62+
#else
5463
void _tmc_register_test(Suite *s, const TTest *tt, const char *fname, const char *points)
5564
{
5665
TCase *tc = tcase_create(fname);
5766
tmc_set_tcase_points(tc, fname, points);
5867
_tcase_add_test(tc, tt, 0, 0, 0, 1);
5968
suite_add_tcase(s, tc);
6069
}
70+
#endif
6171

6272
void tmc_set_suite_points(Suite *s, const char *s_name, const char *points)
6373
{

plugins/make/tests/data/valgrind-failing-exercise/test/tmc-check.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ Suite* tmc_suite_create(const char *name, const char *points);
1616
*
1717
* One can also register the test function normally and then call tmc_set_tcase_points.
1818
*/
19+
#if CHECK_MINOR_VERSION < 15
20+
#define tmc_register_test(suite, tf, points) _tmc_register_test((suite), (tf), "" # tf, points)
21+
void _tmc_register_test(Suite *s, TFun tf, const char *fname, const char *points);
22+
#else
1923
#define tmc_register_test(suite, tt, points) _tmc_register_test((suite), (tt), "" # tt, points)
2024
void _tmc_register_test(Suite *s, const TTest *tt, const char *fname, const char *points);
25+
#endif
2126

2227

2328
/**

tmc-langs/tests/data/some_course/MakeExercise/test/tmc-check.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,23 @@ void tmc_set_tcase_points(TCase *tc, const char *tc_name, const char *points)
5151
parse_points(points, &all_points);
5252
}
5353

54+
#if CHECK_MINOR_VERSION < 15
55+
void _tmc_register_test(Suite *s, TFun tf, const char *fname, const char *points)
56+
{
57+
TCase *tc = tcase_create(fname);
58+
tmc_set_tcase_points(tc, fname, points);
59+
_tcase_add_test(tc, tf, tname, 0, 0, 0, 1);
60+
suite_add_tcase(s, tc);
61+
}
62+
#else
5463
void _tmc_register_test(Suite *s, const TTest *tt, const char *fname, const char *points)
5564
{
5665
TCase *tc = tcase_create(fname);
5766
tmc_set_tcase_points(tc, fname, points);
5867
_tcase_add_test(tc, tt, 0, 0, 0, 1);
5968
suite_add_tcase(s, tc);
6069
}
70+
#endif
6171

6272
void tmc_set_suite_points(Suite *s, const char *s_name, const char *points)
6373
{

tmc-langs/tests/data/some_course/MakeExercise/test/tmc-check.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ Suite* tmc_suite_create(const char *name, const char *points);
1616
*
1717
* One can also register the test function normally and then call tmc_set_tcase_points.
1818
*/
19+
#if CHECK_MINOR_VERSION < 15
20+
#define tmc_register_test(suite, tf, points) _tmc_register_test((suite), (tf), "" # tf, points)
21+
void _tmc_register_test(Suite *s, TFun tf, const char *fname, const char *points);
22+
#else
1923
#define tmc_register_test(suite, tt, points) _tmc_register_test((suite), (tt), "" # tt, points)
2024
void _tmc_register_test(Suite *s, const TTest *tt, const char *fname, const char *points);
25+
#endif
2126

2227

2328
/**

0 commit comments

Comments
 (0)