From da575e8877237ed874aa5e1dd6f769c5e2ea963b Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Sat, 16 Mar 2024 11:51:13 +0100 Subject: [PATCH] Fix warnings --- core/cmd.c | 45 ------------------------------------------- tests/test_main.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/core/cmd.c b/core/cmd.c index d25e5f3..68cc10a 100644 --- a/core/cmd.c +++ b/core/cmd.c @@ -184,48 +184,3 @@ bool ParseCmd(MA_Arena *arg_arena, CmdParser *p) { return true; } - -// ./a.exe -scratch -// ./a.exe -quick -// ./a.exe -run_tests a.test b.test c.test -// ./a.exe --break_on_error -// ./a.exe -build=release -// ./a.exe --help -// -void TestCmdParser() { - char *argv[] = { - "exe", - "--build_scratch", - "-tests", - "a", - "b", - "c", - "--things", - "1234", - "asdsa", - "-build", - "release", - }; - int argc = MA_Lengthof(argv); - - MA_Checkpoint scratch = MA_GetScratch(); - bool build_scratch = false; - S8_List test_list = {0}; - S8_List test_things = {0}; - int build_profile = 0; - const char *build_profiles[] = {"debug", "release"}; - int build_profiles_count = MA_Lengthof(build_profiles); - - CmdParser p = MakeCmdParser(scratch.arena, argc, argv, "this is a test"); - AddBool(&p, &build_scratch, "build_scratch", "builds a sandbox where I experiment with things"); - AddList(&p, &test_list, "tests", "list of specific tests to run"); - AddList(&p, &test_things, "things", "list of things"); - AddEnum(&p, &build_profile, "build", "choose build profile", build_profiles, build_profiles_count); - bool success = ParseCmd(scratch.arena, &p); - IO_Assertf(success, "failed to parse cmd"); - IO_Assert(build_scratch); - IO_Assert(test_list.node_count == 3); - IO_Assert(test_things.node_count == 2); - IO_Assert(build_profile == 1); - MA_ReleaseScratch(scratch); -} diff --git a/tests/test_main.cpp b/tests/test_main.cpp index 80e1270..6f3d132 100644 --- a/tests/test_main.cpp +++ b/tests/test_main.cpp @@ -4,6 +4,51 @@ #include "test_arena.cpp" #include "test_lexer.cpp" +// ./a.exe -scratch +// ./a.exe -quick +// ./a.exe -run_tests a.test b.test c.test +// ./a.exe --break_on_error +// ./a.exe -build=release +// ./a.exe --help +// +void TestCmdParser() { + const char *argv[] = { + "exe", + "--build_scratch", + "-tests", + "a", + "b", + "c", + "--things", + "1234", + "asdsa", + "-build", + "release", + }; + int argc = MA_Lengthof(argv); + + MA_Checkpoint scratch = MA_GetScratch(); + bool build_scratch = false; + S8_List test_list = {0}; + S8_List test_things = {0}; + int build_profile = 0; + const char *build_profiles[] = {"debug", "release"}; + int build_profiles_count = MA_Lengthof(build_profiles); + + CmdParser p = MakeCmdParser(scratch.arena, argc, (char **)argv, "this is a test"); + AddBool(&p, &build_scratch, "build_scratch", "builds a sandbox where I experiment with things"); + AddList(&p, &test_list, "tests", "list of specific tests to run"); + AddList(&p, &test_things, "things", "list of things"); + AddEnum(&p, &build_profile, "build", "choose build profile", build_profiles, build_profiles_count); + bool success = ParseCmd(scratch.arena, &p); + IO_Assertf(success, "failed to parse cmd"); + IO_Assert(build_scratch); + IO_Assert(test_list.node_count == 3); + IO_Assert(test_things.node_count == 2); + IO_Assert(build_profile == 1); + MA_ReleaseScratch(scratch); +} + int main() { TestSimpleInsertAndIntegrity(); TestStrings(); @@ -39,7 +84,7 @@ int main() { // List iteration using For { MA_Scratch scratch; - S8_List list = {}; + S8_List list = {}; S8_AddF(scratch, &list, "1"); S8_AddF(scratch, &list, "2"); S8_AddF(scratch, &list, "3");