make testing more robust
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
snippet testfile
|
||||||
|
#include <criterion/criterion.h>
|
||||||
|
#include "allocator.h"
|
||||||
|
|
||||||
|
Test($1, $2) {
|
||||||
|
$0
|
||||||
|
}
|
||||||
@@ -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"
|
||||||
@@ -18,7 +18,7 @@ test:
|
|||||||
echo "No test files found!"; \
|
echo "No test files found!"; \
|
||||||
else \
|
else \
|
||||||
echo "Compiling all test files into $(TESTBIN)..."; \
|
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..."; \
|
echo "Running tests..."; \
|
||||||
$(TESTBIN); \
|
$(TESTBIN); \
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <criterion/criterion.h>
|
#include <criterion/criterion.h>
|
||||||
#define ALLOCATOR_IMPLEMENTATION
|
|
||||||
#include "allocator.h"
|
#include "allocator.h"
|
||||||
|
|
||||||
|
|
||||||
Test(std_allocator, test) {
|
Test(std_allocator, test) {
|
||||||
allocator_t this = allocator_stdlib;
|
allocator_t this = allocator_stdlib;
|
||||||
void *ptr = allocator_alloc(this, 10);
|
void *ptr = allocator_alloc(this, 10);
|
||||||
|
|||||||
Reference in New Issue
Block a user