Add arena test

This commit is contained in:
Krzosa Karol
2023-12-31 10:20:23 +01:00
parent dcb9a9bfaa
commit 556c38d572
3 changed files with 21 additions and 0 deletions

View File

@@ -13,6 +13,12 @@ set RELEASE_LINE=%RELEASE% %WRN% %COMMON% -link -incremental:no %LINK_RELEASE%
mkdir build mkdir build
cd build cd build
cl.exe -Fe:test_arena.exe ../test/test_arena.cpp %DEBUG_LINE%
if %errorlevel% neq 0 exit /b %errorlevel%
test_arena.exe
if %errorlevel% neq 0 exit /b %errorlevel%
cl.exe -Fe:cpp_debug.exe ../test/main.cpp %DEBUG_LINE% cl.exe -Fe:cpp_debug.exe ../test/main.cpp %DEBUG_LINE%
if %errorlevel% neq 0 exit /b %errorlevel% if %errorlevel% neq 0 exit /b %errorlevel%
cl.exe -Fe:cpp_release.exe ../test/main.cpp %RELEASE_LINE% cl.exe -Fe:cpp_release.exe ../test/main.cpp %RELEASE_LINE%

1
io.c
View File

@@ -1,4 +1,5 @@
#include "io.h" #include "io.h"
#include <stdarg.h>
#ifndef IO_SNPRINTF #ifndef IO_SNPRINTF
#include <stdio.h> #include <stdio.h>

14
test/test_arena.cpp Normal file
View File

@@ -0,0 +1,14 @@
#include "../io.c"
#define MA_ASSERT(x) IO_Assert(x)
#include "../arena.c"
int main() {
MA_Scratch scratch;
int *thing = MA_PushStruct(scratch, int);
*thing = 10;
MA_Arena *arena = MA_Bootstrap();
float *thingf = MA_PushStruct(arena, float);
*thingf = 10.0f;
}