mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
Add coverage measurement and fix unity variant for c99
This commit is contained in:
parent
ae2fde9fe1
commit
40404d9217
7
c99/.gitignore
vendored
Normal file
7
c99/.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
golden_rose
|
||||
test_gildedrose
|
||||
*.gcov
|
||||
*.gcda
|
||||
*.gcno
|
||||
*.o
|
||||
build/
|
||||
10
c99/Makefile
10
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
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user