aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Makefile
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-02-21 12:39:20 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-02-21 12:39:34 +0100
commitd699849b2360f90c61f645c5d4d4232cd3e1c962 (patch)
treec929ec20ca3b16fe3d34bd75e412ca49f7420125 /tests/Makefile
downloadLibft-d699849b2360f90c61f645c5d4d4232cd3e1c962.tar.gz
Libft-d699849b2360f90c61f645c5d4d4232cd3e1c962.zip
Initial commit: libft Part 1 with tests and documentation
Reimplements 24 libc functions with Doxygen-documented header and test suite comparing against libc.
Diffstat (limited to 'tests/Makefile')
-rw-r--r--tests/Makefile31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000..319fa22
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,31 @@
+CC = cc
+CFLAGS =
+LIB = ../libft.a
+
+TESTS = test_strlen test_is test_mem test_cmp test_case test_strl test_search \
+ test_atoi test_alloc
+
+all: $(TESTS)
+ @for t in $(TESTS); do \
+ echo "--- Running $$t ---"; \
+ ./$$t; \
+ done
+
+test_%: test_%.c $(LIB)
+ $(CC) $(CFLAGS) -o $@ $< $(LIB)
+
+# Tests comparing against BSD functions (strlcpy, strlcat, strnstr)
+# need -lbsd since these are not part of glibc by default.
+test_strl: test_strl.c $(LIB)
+ $(CC) $(CFLAGS) -o $@ $< $(LIB) -lbsd
+
+test_search: test_search.c $(LIB)
+ $(CC) $(CFLAGS) -o $@ $< $(LIB) -lbsd
+
+$(LIB):
+ $(MAKE) -C ..
+
+clean:
+ rm -f $(TESTS)
+
+.PHONY: all clean