diff --git a/build.bat b/build.bat index 5f5097b..549c7c1 100644 --- a/build.bat +++ b/build.bat @@ -6,6 +6,6 @@ if not exist ".\build" mkdir ".\build" pushd .\build -cl /Zi ..\src\main.c /Feapp.exe /Od /nologo /I..\src +cl /Zi ..\src\main.c /Feapp.exe /Od /nologo popd .\build diff --git a/src/main.c b/src/main.c index 7ad85f2..f6a385c 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,32 @@ +#include "base.h" + +#include "arena.h" +#include "string.h" +#include "hash-store.h" + +#include "arena.c" +#include "string.c" +#include "hash-store.c" + int main(void) { + Table store = hash_store_initialize(); + Key a = hash_store_string8_to_key(&store, str8_lit("Hello")); + Key b = hash_store_string8_to_key(&store, str8_lit("Beautiful")); + Key c = hash_store_string8_to_key(&store, str8_lit("World")); + + String8 str_a = hash_store_string8_from_key(&store, a); + String8 str_b = hash_store_string8_from_key(&store, b); + String8 str_c = hash_store_string8_from_key(&store, c); + + ASSERT(hash_store_string8_to_key(&store, str8_lit("Hello")) == a); + ASSERT(hash_store_string8_to_key(&store, str8_lit("Beautiful")) == b); + ASSERT(hash_store_string8_to_key(&store, str8_lit("World")) == c); + + ASSERT(string8_match(hash_store_string8_from_key(&store, a), str8_lit("Hello"))); + ASSERT(string8_match(hash_store_string8_from_key(&store, b), str8_lit("Beautiful"))); + ASSERT(string8_match(hash_store_string8_from_key(&store, c), str8_lit("World"))); + return 0; };