From 556c38d57244c549769f6bad94ac5693f3cc669d Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Sun, 31 Dec 2023 10:20:23 +0100 Subject: [PATCH] Add arena test --- build.bat | 6 ++++++ io.c | 1 + test/test_arena.cpp | 14 ++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 test/test_arena.cpp diff --git a/build.bat b/build.bat index 045574c..c035605 100644 --- a/build.bat +++ b/build.bat @@ -13,6 +13,12 @@ set RELEASE_LINE=%RELEASE% %WRN% %COMMON% -link -incremental:no %LINK_RELEASE% mkdir 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% if %errorlevel% neq 0 exit /b %errorlevel% cl.exe -Fe:cpp_release.exe ../test/main.cpp %RELEASE_LINE% diff --git a/io.c b/io.c index b360c3c..ff8e4f5 100644 --- a/io.c +++ b/io.c @@ -1,4 +1,5 @@ #include "io.h" +#include #ifndef IO_SNPRINTF #include diff --git a/test/test_arena.cpp b/test/test_arena.cpp new file mode 100644 index 0000000..8d1c9d7 --- /dev/null +++ b/test/test_arena.cpp @@ -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; +} \ No newline at end of file