aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-10-21 16:08:41 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-10-21 16:36:47 +0200
commit4bb8708bbbb4fa9b5fa947c1be6c02adc3dc94c2 (patch)
tree436a74de65b1824a37291340f5f9af4a1148a96c
parentca5071168115e5cd272978e13ddb9fbb1365afbc (diff)
downloadlibasm_test-4bb8708bbbb4fa9b5fa947c1be6c02adc3dc94c2.tar.gz
libasm_test-4bb8708bbbb4fa9b5fa947c1be6c02adc3dc94c2.tar.bz2
libasm_test-4bb8708bbbb4fa9b5fa947c1be6c02adc3dc94c2.zip
Cleaning Makfile, Fixing missing TO_STRING in ft_atoi_base test
-rw-r--r--Makefile24
-rw-r--r--README.md14
-rw-r--r--test/ft_atoi_base_test.c4
3 files changed, 19 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 206544b..c13f5a9 100644
--- a/Makefile
+++ b/Makefile
@@ -6,13 +6,14 @@
# By: cacharle <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/02/08 03:06:59 by cacharle #+# #+# #
-# Updated: 2020/10/21 15:57:34 by charles ### ########.fr #
+# Updated: 2020/10/21 16:36:37 by charles ### ########.fr #
# #
# **************************************************************************** #
-LIBASM_PATH = ../pg
+LIBASM_PATH = ../libasm
RM = rm -f
+MAKE = make --no-print-directory
PYTHON = python3
CC = gcc
@@ -27,7 +28,7 @@ SRC = main.c \
test/ft_strcmp_test.c \
test/ft_write_test.c \
test/ft_read_test.c \
- test/ft_strdup_test.c \
+ test/ft_strdup_test.c
SRCBONUS = helper_list.c \
test/ft_atoi_base_test.c \
@@ -46,34 +47,23 @@ ifeq ($(LIBASM_TEST_BONUS),yes)
CCFLAGS += -D LIBASM_TEST_BONUS
endif
-# CCFLAGS += -fPIE -fPIC
-
OBJ = $(SRC:.c=.o)
-OBJBONUS = $(SRCBONUS:.c=.o)
-OBJBONUS += $(OBJ)
-
run: pretty
-# runbonus: prettybonus
-# prettybonus: allbonus pretty
pretty: all
./$(NAME) 2> /dev/null | $(PYTHON) prettier.py
-# run_rawbonus: allbonus run_raw
run_raw: all
./$(NAME) 2> /dev/null
-# run_debugbonus: allbonus run_debug
run_debug: all
./$(NAME)
all: $(NAME)
-# allbonus:
-# allbonus: all
$(NAME): libasm_all $(OBJ)
- $(CC) -fPIE -fPIC -o $@ $(OBJ) $(LDFLAGS)
+ $(CC) -o $@ $(OBJ) $(LDFLAGS)
%.o: %.c
$(CC) $(CCFLAGS) -c -o $@ $<
@@ -88,9 +78,9 @@ re: libasm_fclean libasm_all fclean all
libasm_all:
- make -C $(LIBASM_PATH) all
+ $(MAKE) -C $(LIBASM_PATH) all
libasm_fclean:
- make -C $(LIBASM_PATH) fclean
+ $(MAKE) -C $(LIBASM_PATH) fclean
.PHONY: run pretty run_raw run_debug all clean fclean re libasm_all libasm_fclean
diff --git a/README.md b/README.md
index b94eac4..da5313f 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# libasm test
+# libasm\_test
Unit tests for the libasm project.
@@ -8,12 +8,16 @@ Unit tests for the libasm project.
The default path to your libasm is `../libasm`. You can modify it in the Makefile.
-- `> make run` show regular pretty output.
-- `> make run_raw` show parsable output.
+```
+$ make
+```
-### Bonus
+## Bonus
-Suffix all Makefile commands with `bonus` (i.e `> make runbonus`).
+Set the environment variable `LIBASM_TEST_BONUS` to `yes`.
+```
+$ echo 'export LIBASM_TEST_BONUS=yes' >> ~/.zshrc
+```
## Help, ft\_write and ft\_read crash for no reason
diff --git a/test/ft_atoi_base_test.c b/test/ft_atoi_base_test.c
index dfb8671..1c4e1ef 100644
--- a/test/ft_atoi_base_test.c
+++ b/test/ft_atoi_base_test.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/08 03:07:27 by cacharle #+# #+# */
-/* Updated: 2020/04/13 14:52:28 by charles ### ########.fr */
+/* Updated: 2020/10/21 16:01:31 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,6 +15,8 @@
static int expected_ret;
static int actual_ret;
+#define TO_STRING(x) (#x)
+
#define FT_ATOI_BASE_EXPECT(str, base) do { \
actual_ret = ft_atoi_base(str, base); \
expected_ret = ref_ft_atoi_base(str, base); \