make testing more robust

This commit is contained in:
2025-10-03 22:05:00 +02:00
parent 8ada613a3e
commit 89b4dfa3e8
4 changed files with 14 additions and 2 deletions
+7
View File
@@ -0,0 +1,7 @@
snippet testfile
#include <criterion/criterion.h>
#include "allocator.h"
Test($1, $2) {
$0
}
+5
View File
@@ -0,0 +1,5 @@
// This is used to have a single file that implements the allocators when all
// the test files are compiled together.
#define ALLOCATOR_IMPLEMENTATION
#include "allocator.h"
+1 -1
View File
@@ -18,7 +18,7 @@ test:
echo "No test files found!"; \
else \
echo "Compiling all test files into $(TESTBIN)..."; \
$(CC) $(CFLAGS) $$files -o $(TESTBIN) $(LDFLAGS); \
$(CC) $(CFLAGS) _allocator_impl.c $$files -o $(TESTBIN) $(LDFLAGS); \
echo "Running tests..."; \
$(TESTBIN); \
fi
+1 -1
View File
@@ -1,7 +1,7 @@
#include <criterion/criterion.h>
#define ALLOCATOR_IMPLEMENTATION
#include "allocator.h"
Test(std_allocator, test) {
allocator_t this = allocator_stdlib;
void *ptr = allocator_alloc(this, 10);