Skip to content

Instantly share code, notes, and snippets.

@PeterHajdu
Last active January 22, 2016 08:20
Show Gist options
  • Save PeterHajdu/6c3334bd2024d765aa2c to your computer and use it in GitHub Desktop.
Save PeterHajdu/6c3334bd2024d765aa2c to your computer and use it in GitHub Desktop.
c_bare
SRC = *.c
HDR = *.h
default: test
valgrind ./test
test: $(SRC) $(HDR)
gcc $(SRC) -o test -lcheck
clean:
rm -rf *.o ./test
.phony: clear default
#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