Fixed initialization order of test framework.
This commit is contained in:
parent
e4d6e18de0
commit
4238530db6
@ -2,13 +2,19 @@
|
||||
|
||||
#include "test.h"
|
||||
|
||||
Suite* global_suite = suite_create("cxxmph_test_suite");
|
||||
TCase* global_tc_core = tcase_create("Core");
|
||||
Suite* global_suite() {
|
||||
static Suite* gs = suite_create("cxxmph_test_suite");
|
||||
return gs;
|
||||
}
|
||||
TCase* global_tc_core() {
|
||||
static TCase* gtc = tcase_create("Core");
|
||||
return gtc;
|
||||
}
|
||||
|
||||
int main (void) {
|
||||
suite_add_tcase(global_suite, global_tc_core);
|
||||
suite_add_tcase(global_suite(), global_tc_core());
|
||||
int number_failed;
|
||||
SRunner *sr = srunner_create (global_suite);
|
||||
SRunner *sr = srunner_create (global_suite());
|
||||
srunner_run_all (sr, CK_NORMAL);
|
||||
number_failed = srunner_ntests_failed (sr);
|
||||
srunner_free (sr);
|
||||
|
@ -9,9 +9,10 @@
|
||||
// included last.
|
||||
|
||||
#include <check.h>
|
||||
#include <stdio.h>
|
||||
|
||||
extern Suite* global_suite;
|
||||
extern TCase* global_tc_core;
|
||||
Suite* global_suite();
|
||||
TCase* global_tc_core();
|
||||
|
||||
// Creates a new test case calling boolean_function. Name must be a valid,
|
||||
// unique c identifier when prefixed with tc_.
|
||||
@ -24,7 +25,7 @@ extern TCase* global_tc_core;
|
||||
|
||||
struct TestCase {
|
||||
TestCase(void (*f)(int)) {
|
||||
tcase_add_test(global_tc_core, f);
|
||||
tcase_add_test(global_tc_core(), f);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user