diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-01-31 08:08:59 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-01-31 08:48:42 +0100 |
| commit | 9db52bc5ef545a3fa9973002e9a28a2ece68d029 (patch) | |
| tree | 0a1f36d989c6c3cb74e3bc5d5997c6a4c3f058b9 /test | |
| parent | 3b884e3836c70b1a19eb7778308fadbc608b0384 (diff) | |
| download | libft-9db52bc5ef545a3fa9973002e9a28a2ece68d029.tar.gz libft-9db52bc5ef545a3fa9973002e9a28a2ece68d029.tar.bz2 libft-9db52bc5ef545a3fa9973002e9a28a2ece68d029.zip | |
Setup unit test with unity
Diffstat (limited to 'test')
| -rw-r--r-- | test/Makefile | 48 | ||||
| -rw-r--r-- | test/include/libft_test.h | 8 | ||||
| -rwxr-xr-x | test/libft_test | bin | 0 -> 34012 bytes | |||
| -rw-r--r-- | test/src/runner/test_ft_strlen_runner.c | 6 | ||||
| -rw-r--r-- | test/src/str/test_ft_strlen.c | 14 |
5 files changed, 76 insertions, 0 deletions
diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..4d84321 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,48 @@ +MAKE = make +MAKE_ARGS = --no-print-directory + +UNITY_DIR = ../vendor/_unity +LIBFT_DIR = .. + +SRC_DIR = src +INCLUDE_DIR = include + +CC = gcc +CCFLAGS = -I$(INCLUDE_DIR) -I$(UNITY_DIR)/include -I$(LIBFT_DIR)/include -Wall -Wextra -Werror +LDFLAGS = -L$(UNITY_DIR) -lunity -L$(LIBFT_DIR) -lft + +NAME = libft_test + +SRC = $(shell find $(SRC_DIR) -type f -name "*.c") +OBJ = $(SRC:.c=.o) + + +all: unity_all $(NAME) + +run: all + @echo "Test: Running" + @./$(NAME) + +$(NAME): $(OBJ) + @echo "Test: Linking: $@" + @$(CC) -o $@ $^ $(LDFLAGS) + +%.o: %.c + @echo "Test: Compiling: $@" + @$(CC) $(CCFLAGS) -c -o $@ $< + +clean: unity_fclean + @echo "Test: Removing object" + @$(RM) $(OBJ) + +fclean: + @echo "Test: Removing executable" + @$(RM) $(NAME) + +re: fclean all + +unity_all: + @$(MAKE) $(MAKE_ARGS) -s -C $(UNITY_DIR) all + +unity_fclean: + @$(MAKE) $(MAKE_ARGS) -s -C $(UNITY_DIR) fclean diff --git a/test/include/libft_test.h b/test/include/libft_test.h new file mode 100644 index 0000000..1c5ebb5 --- /dev/null +++ b/test/include/libft_test.h @@ -0,0 +1,8 @@ +#ifndef LIBFT_TEST_H +# define LIBFT_TEST_H + +# include "unity.h" +# include "unity_fixture.h" +# include "libft.h" + +#endif diff --git a/test/libft_test b/test/libft_test Binary files differnew file mode 100755 index 0000000..13cbab2 --- /dev/null +++ b/test/libft_test diff --git a/test/src/runner/test_ft_strlen_runner.c b/test/src/runner/test_ft_strlen_runner.c new file mode 100644 index 0000000..368c033 --- /dev/null +++ b/test/src/runner/test_ft_strlen_runner.c @@ -0,0 +1,6 @@ +#include "libft_test.h" + +TEST_GROUP_RUNNER(ft_strlen) +{ + RUN_TEST_CASE(ft_strlen, yo); +} diff --git a/test/src/str/test_ft_strlen.c b/test/src/str/test_ft_strlen.c new file mode 100644 index 0000000..1e4e1c4 --- /dev/null +++ b/test/src/str/test_ft_strlen.c @@ -0,0 +1,14 @@ +#include "libft_test.h" + +TEST_GROUP(ft_strlen); + +TEST_SETUP(ft_strlen) +{} + +TEST_TEAR_DOWN(ft_strlen) +{} + +TEST(ft_strlen, yo) +{ + TEST_ASSERT_EQUAL(0, 0); +} |
