added munit tests
This commit is contained in:
parent
9cc790d17a
commit
8086d576e4
5 changed files with 34 additions and 12 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
ft_ssl
|
||||
ft_ssl_test
|
||||
*.o
|
||||
*.a
|
||||
|
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "lib/munit"]
|
||||
path = lib/munit
|
||||
url = git@github.com:nemequ/munit.git
|
33
Makefile
33
Makefile
|
@ -31,6 +31,9 @@ LIBFT_INC := -I $(LIBFT_DIR)includes/
|
|||
LIBFT_LIB := -lft -L $(LIBFT_DIR)
|
||||
LIBFT = $(LIBFT_DIR)libft.a
|
||||
|
||||
MUINUT_DIR := $(LIB_DIR)munit/
|
||||
MUINUT_INC := -I $(MUINUT_DIR)
|
||||
|
||||
# project source files
|
||||
|
||||
SRC = main.c
|
||||
|
@ -42,6 +45,13 @@ OBJ = $(addprefix $(OBJ_DIR), $(SRC:.c=.o))
|
|||
|
||||
# project test files
|
||||
|
||||
TEST_BIN = ft_ssl_test
|
||||
|
||||
TEST_SRC = test_test.c
|
||||
|
||||
TEST_SRC += munit.c
|
||||
|
||||
TEST_OBJ = $(addprefix $(OBJ_DIR), $(TEST_SRC:.c=.o))
|
||||
|
||||
# compilation flags
|
||||
|
||||
|
@ -73,7 +83,7 @@ LINK_FLAGS = ""
|
|||
|
||||
# header flags
|
||||
|
||||
HEADER_FLAGS = ""
|
||||
HEADER_FLAGS = $(MUINUT_INC)
|
||||
|
||||
# compiler
|
||||
|
||||
|
@ -83,15 +93,16 @@ CC := clang
|
|||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME): $(LIBFT) $(OBJ)
|
||||
$(NAME): check $(LIBFT) $(OBJ)
|
||||
$(CC) $(OBJ) $(LINK_FLAGS) -o $(NAME)
|
||||
|
||||
$(TEST_NAME): $(LIBFT) $(TEST_OBJ)
|
||||
$(CC) $(TEST_OBJ) $(LINK_FLAGS) -o $(TEST_NAME)
|
||||
check: $(TEST_BIN)
|
||||
./$(TEST_BIN)
|
||||
|
||||
$(OBJ): | $(OBJ_DIR)
|
||||
$(TEST_BIN): $(LIBFT) $(TEST_OBJ)
|
||||
$(CC) $(TEST_OBJ) $(LINK_FLAGS) -o $(TEST_BIN)
|
||||
|
||||
$(TEST_OBJ): | $(OBJ_DIR)
|
||||
$(TEST_OBJ) $(OBJ): | $(OBJ_DIR)
|
||||
|
||||
$(OBJ_DIR):
|
||||
mkdir $(OBJ_DIR)
|
||||
|
@ -102,10 +113,6 @@ $(OBJ_DIR)%.o: %.c
|
|||
$(LIBFT):
|
||||
$(MAKE) -C $(LIBFT_DIR)
|
||||
|
||||
check: $(TEST_NAME)
|
||||
clear
|
||||
./$(TEST_NAME)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ)
|
||||
rm -f $(TEST_OBJ)
|
||||
|
@ -113,7 +120,6 @@ clean:
|
|||
|
||||
fclean: clean
|
||||
rm -f $(NAME)
|
||||
rm -f $(TEST_NAME)
|
||||
rm -rf $(OBJ_DIR)
|
||||
$(MAKE) -C $(LIBFT_DIR) fclean
|
||||
|
||||
|
@ -126,6 +132,9 @@ multi:
|
|||
|
||||
# special stuff
|
||||
|
||||
vpath %.c $(SRC_DIR)
|
||||
vpath %.c $(SRC_DIR) \
|
||||
$(TST_DIR) \
|
||||
$(MUINUT_DIR)
|
||||
|
||||
|
||||
.PHONY: all check clean fclean re multi
|
||||
|
|
1
lib/munit
Submodule
1
lib/munit
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 439de4a9b136bc3b5163e73d4caf37c590bef875
|
8
t/test_test.c
Normal file
8
t/test_test.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
#define MUNIT_ENABLE_ASSERT_ALIASES
|
||||
#include "munit.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
assert_int(argc, ==, 1);
|
||||
}
|
Loading…
Reference in a new issue