From 7bb8f7debae158d08820c7b9a71f415432c74447 Mon Sep 17 00:00:00 2001 From: Aleksei Chubukov Date: Thu, 30 Nov 2023 22:26:01 +0400 Subject: [PATCH] preparing to switch to Unity test framework --- .gitmodules | 3 +++ Makefile | 2 +- common/tests.h | 5 ++++- contrib/Unity | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .gitmodules create mode 160000 contrib/Unity diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2be9459 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "contrib/Unity"] + path = contrib/Unity + url = https://github.com/ThrowTheSwitch/Unity.git diff --git a/Makefile b/Makefile index 8e56739..c60debd 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,6 @@ clean: .SECONDEXPANSION: build/c%: $(OFFSHORE_PROJECTS)/c$$*/*.c $$(OFFSHORE_MAINS)/c$$*.c $$(wildcard $(OFFSHORE_MAINS)/common/*.c) mkdir -p $(@D) - $(CC) -o $@ $(CFLAGS_MANDATORY) -Icommon $(CFLAGS) $^ + $(CC) -o $@ $(CFLAGS_MANDATORY) -Icommon -I contrib/Unity/src $(CFLAGS) $^ norme: $$(wildcard $(OFFSHORE_PROJECTS)/c*) norminette $^ || true diff --git a/common/tests.h b/common/tests.h index df6b22f..eb55946 100644 --- a/common/tests.h +++ b/common/tests.h @@ -38,6 +38,7 @@ TEST_PRINT_BUFCMP(TEST_FUNC_CASE, TEST_BUF_ORIG_SRC, TEST_BUF_ORIG_DEST, TEST_BUF_MOD_SRC, TEST_BUF_MOD_DEST); \ TEST_PRINT_RETVALS; \ TEST_RESET_BUFFERS(TEST_BUF_PRISCINE_SRC, TEST_BUF_PRISCINE_DEST, TEST_BUF_ORIG_SRC, TEST_BUF_ORIG_DEST, TEST_BUF_MOD_SRC, TEST_BUF_MOD_DEST); + #define TEST_SEED(type) \ char s[TEST_BUF_SIZE] = TEST_SOURCE; \ char d[TEST_BUF_SIZE] = TEST_DESTINATION; \ @@ -51,7 +52,9 @@ #define FG_WHT "\x1B[37m" #define FG_MAG "\x1B[35m" #define COLOR_RESET "\x1B[0m" -#endif int bufcmp(char*, char*, int); void dump(char*, int); + +#endif + diff --git a/contrib/Unity b/contrib/Unity new file mode 160000 index 0000000..bf56029 --- /dev/null +++ b/contrib/Unity @@ -0,0 +1 @@ +Subproject commit bf560290f6020737eafaa8b5cbd2177c3956c03f