diff --git a/Makefile b/Makefile index 26048b6..e9fd873 100644 --- a/Makefile +++ b/Makefile @@ -13,9 +13,10 @@ else TARGET_EXTENSION=out endif -.PHONY: runners +.PHONY: cleandep .PHONY: clean .PHONY: test +.PHONY: runners PATHU = unity/src/ PATHS = src/ @@ -29,12 +30,6 @@ PATHR = build/results/ BUILD_PATHS = $(PATHB) $(PATHD) $(PATHO) $(PATHR) $(PATHL) -RUNNERS = $(patsubst $(PATHT)%.c,$(PATHTR)%_Runner.c, $(wildcard $(PATHT)*.c)) - -runners: $(RUNNERS) test - -SRCTR = $(wildcard $(PATHTR)*.c) - COMPILE = gcc -c LINK = gcc DEPEND = gcc -MM -MG -MF @@ -55,13 +50,18 @@ CFLAGS += -Wstrict-prototypes CFLAGS += -Wundef CFLAGS += -Wold-style-definition -RESULTS = $(patsubst $(PATHTR)test_%_Runner.c,$(PATHR)test_%.txt,$(SRCTR)) +RUNNERS = $(patsubst $(PATHT)%.c,$(PATHTR)%_Runner.c, $(wildcard $(PATHT)*.c)) + +runners: $(RUNNERS) test + +RESULTS = $(patsubst $(PATHTR)test_%_Runner.c,$(PATHR)test_%.txt, $(RUNNERS)) +DEPS = $(patsubst $(PATHT)test_%.c,$(PATHD)test_%.d, $(wildcard $(PATHT)*.c)) PASSED = `grep -s PASS $(PATHR)*.txt` FAIL = `grep -s FAIL $(PATHR)*.txt` IGNORE = `grep -s IGNORE $(PATHR)*.txt` -test: $(BUILD_PATHS) $(RESULTS) +test: $(BUILD_PATHS) $(RESULTS) $(DEPS) @echo "===============UNIT TEST RESULTS===============\n" @echo "---------------IGNORES---------------" @echo "$(IGNORE)" @@ -114,6 +114,10 @@ clean: $(CLEANUP) $(PATHO)*.o $(CLEANUP) $(PATHB)*.$(TARGET_EXTENSION) $(CLEANUP) $(PATHR)*.txt + $(CLEANUP) $(PATHTR)*.c + +cleandep: + $(CLEANUP) $(PATHD)*.d .PRECIOUS: $(PATHB)test_%.$(TARGET_EXTENSION) .PRECIOUS: $(PATHD)%.d diff --git a/test/runners/test_circ_buff_Runner.c b/test/runners/test_circ_buff_Runner.c deleted file mode 100644 index 4d10e2b..0000000 --- a/test/runners/test_circ_buff_Runner.c +++ /dev/null @@ -1,92 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - UNITY_EXEC_TIME_START(); \ - if (TEST_PROTECT()) \ - { \ - setUp(); \ - TestFunc(); \ - } \ - if (TEST_PROTECT()) \ - { \ - tearDown(); \ - } \ - UNITY_EXEC_TIME_STOP(); \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#ifdef __WIN32__ -#define UNITY_INCLUDE_SETUP_STUBS -#endif -#include "unity.h" -#ifndef UNITY_EXCLUDE_SETJMP_H -#include -#endif -#include -#include "circ_buff.h" -#include -#include -#include - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_circ_buf_init(void); -extern void test_circ_buf_put(void); -extern void test_circ_buf_get(void); -extern void test_circ_buf_empty(void); -extern void test_circ_buf_full(void); -extern void test_circ_buf_capacity(void); -extern void test_circ_buf_size(void); -extern void test_circ_buf_reset(void); - - -/*=======Suite Setup=====*/ -static void suite_setup(void) -{ -#if defined(UNITY_WEAK_ATTRIBUTE) || defined(UNITY_WEAK_PRAGMA) - suiteSetUp(); -#endif -} - -/*=======Suite Teardown=====*/ -static int suite_teardown(int num_failures) -{ -#if defined(UNITY_WEAK_ATTRIBUTE) || defined(UNITY_WEAK_PRAGMA) - return suiteTearDown(num_failures); -#else - return num_failures; -#endif -} - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - tearDown(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - suite_setup(); - UnityBegin("test/test_circ_buff.c"); - RUN_TEST(test_circ_buf_init, 17); - RUN_TEST(test_circ_buf_put, 29); - RUN_TEST(test_circ_buf_get, 73); - RUN_TEST(test_circ_buf_empty, 110); - RUN_TEST(test_circ_buf_full, 142); - RUN_TEST(test_circ_buf_capacity, 164); - RUN_TEST(test_circ_buf_size, 191); - RUN_TEST(test_circ_buf_reset, 220); - - return suite_teardown(UnityEnd()); -}