Last active
January 22, 2016 08:20
-
-
Save PeterHajdu/6c3334bd2024d765aa2c to your computer and use it in GitHub Desktop.
c_bare
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SRC = *.c | |
HDR = *.h | |
default: test | |
valgrind ./test | |
test: $(SRC) $(HDR) | |
gcc $(SRC) -o test -lcheck | |
clean: | |
rm -rf *.o ./test | |
.phony: clear default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <check.h> | |
#include "tests.h" | |
START_TEST(test_the_test_framework) | |
{ | |
ck_assert_int_eq(1, 1); | |
} | |
END_TEST | |
Suite* gol_suite() | |
{ | |
Suite *s = suite_create("Money"); | |
TCase *tc_core = tcase_create("Core"); | |
tcase_add_test(tc_core, test_the_test_framework); | |
suite_add_tcase(s, tc_core); | |
return s; | |
} | |
int main(int argc, char * argv[] ) | |
{ | |
Suite *s = gol_suite(); | |
SRunner *sr = srunner_create(s); | |
srunner_run_all(sr, CK_NORMAL); | |
int number_failed = srunner_ntests_failed(sr); | |
srunner_free(sr); | |
return (number_failed == 0) ? 0 : 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment