Fix warnings
This commit is contained in:
45
core/cmd.c
45
core/cmd.c
@@ -184,48 +184,3 @@ bool ParseCmd(MA_Arena *arg_arena, CmdParser *p) {
|
|||||||
|
|
||||||
return true;
|
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);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -4,6 +4,51 @@
|
|||||||
#include "test_arena.cpp"
|
#include "test_arena.cpp"
|
||||||
#include "test_lexer.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() {
|
int main() {
|
||||||
TestSimpleInsertAndIntegrity();
|
TestSimpleInsertAndIntegrity();
|
||||||
TestStrings();
|
TestStrings();
|
||||||
@@ -39,7 +84,7 @@ int main() {
|
|||||||
// List iteration using For
|
// List iteration using For
|
||||||
{
|
{
|
||||||
MA_Scratch scratch;
|
MA_Scratch scratch;
|
||||||
S8_List list = {};
|
S8_List list = {};
|
||||||
S8_AddF(scratch, &list, "1");
|
S8_AddF(scratch, &list, "1");
|
||||||
S8_AddF(scratch, &list, "2");
|
S8_AddF(scratch, &list, "2");
|
||||||
S8_AddF(scratch, &list, "3");
|
S8_AddF(scratch, &list, "3");
|
||||||
|
|||||||
Reference in New Issue
Block a user