diff --git a/c99/.gitignore b/c99/.gitignore new file mode 100644 index 00000000..b60b5cc6 --- /dev/null +++ b/c99/.gitignore @@ -0,0 +1,7 @@ +golden_rose +test_gildedrose +*.gcov +*.gcda +*.gcno +*.o +build/ diff --git a/c99/Makefile b/c99/Makefile index 113d1552..b8673289 100644 --- a/c99/Makefile +++ b/c99/Makefile @@ -8,11 +8,11 @@ # make memtest - run memory leak analysis # The _POSIX_C_SOURCE definition prevents the compiler from throwing warnings -CFLAGS = `pkg-config --cflags check` -g --std=c99 -D_POSIX_C_SOURCE=200809L +CFLAGS = `pkg-config --cflags check` -g --std=c99 -D_POSIX_C_SOURCE=200809L -fprofile-arcs -ftest-coverage LIBS = `pkg-config --libs check` # All files that should be part of your test should start with 'test_' -TEST_SRC = $(wildcard test_*.c) +TEST_SRC = $(filter-out $(wildcard test_unity_*.c), $(wildcard test_*.c)) # Don't include unity test suite here. Run that via `./run-once-cmake.sh` TEST_BASE = $(basename ${TEST_SRC}) TEST_OBJECTS = $(addsuffix .o, ${TEST_BASE}) @@ -32,7 +32,10 @@ TEST_APP = test_gildedrose GOLDEN_APP = golden_rose all: ${TEST_APP} ${GOLDEN_APP} + rm -f *.gcda + rm -f *.gcov ./${TEST_APP} + gcov GildedRose.c ${TEST_APP}: ${TEST_OBJECTS} ${OBJECT_UNDER_TEST} $(CC) $(CFLAGS) -o $@ $^ $(LIBS) @@ -49,3 +52,6 @@ clean: rm -f *.o rm -f ${TEST_APP} rm -f ${GOLDEN_APP} + rm -f *.gcda + rm -f *.gcno + rm -f *.gcov diff --git a/c99/test_unity_gildedrose.c b/c99/test_unity_gildedrose.c index 5e0d8b98..438ce3a3 100644 --- a/c99/test_unity_gildedrose.c +++ b/c99/test_unity_gildedrose.c @@ -1,6 +1,9 @@ #include "unity.h" #include "GildedRose.h" +void setUp (void) {} /* Is run before every test, put unit init calls here. */ +void tearDown (void) {} /* Is run after every test, put unit clean-up calls here. */ + void test_NameOfItem(void) { Item items[1]; @@ -15,4 +18,3 @@ int main(void) RUN_TEST(test_NameOfItem); return UNITY_END(); } -