aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-02-27 11:04:07 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-02-27 11:04:07 +0100
commit8849d801b9d3767390e3e1ed6b562db738ac1bcb (patch)
tree9d612726bd6b2ab5bebc536e54d9e5216443cffd /tests/src
parent7de95ddd662b52c803d307b6028fd90a1aa71892 (diff)
downloadmalloc-8849d801b9d3767390e3e1ed6b562db738ac1bcb.tar.gz
malloc-8849d801b9d3767390e3e1ed6b562db738ac1bcb.zip
Add show_alloc_mem and test_show, rename test to test_preload
Implement show_alloc_mem() to print all zones and allocations by ascending address. Add test_show binary that links directly against libft_malloc.so to exercise it.
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/test_preload.c (renamed from tests/src/main.c)0
-rw-r--r--tests/src/test_show.c25
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/src/main.c b/tests/src/test_preload.c
index 0ded605..0ded605 100644
--- a/tests/src/main.c
+++ b/tests/src/test_preload.c
diff --git a/tests/src/test_show.c b/tests/src/test_show.c
new file mode 100644
index 0000000..e5e7dca
--- /dev/null
+++ b/tests/src/test_show.c
@@ -0,0 +1,25 @@
+/**
+ * @file test_show.c
+ * @brief Test show_alloc_mem — links directly against libft_malloc.
+ */
+
+#include "malloc.h"
+
+int
+main (void)
+{
+ void *a = malloc (42);
+ void *b = malloc (100);
+ void *c = malloc (500);
+ void *d = malloc (2000);
+ (void)a;
+ (void)b;
+ (void)c;
+ (void)d;
+ show_alloc_mem ();
+ free (a);
+ free (b);
+ free (c);
+ free (d);
+ return (0);
+}