CommandLine parser initial

This commit is contained in:
IlushaShurupov 2023-07-15 13:12:51 +03:00 committed by Ilya Shurupov
parent 3846b91662
commit f5cab30f21
11 changed files with 592 additions and 22 deletions

View file

@ -0,0 +1,23 @@
#include "Tests.hpp"
using namespace tp;
static CommandLine createCmdLine() {
CommandLine cmd({
{ "bool", CommandLine::Arg::BOOL },
{ "int", CommandLine::Arg::INT },
{ "string", CommandLine::Arg::STR },
{ "float", CommandLine::Arg::FLOAT },
});
return cmd;
}
TEST_DEF_STATIC(Simple) {
auto cmd = createCmdLine();
const char* args[] = { "false", "2", "'str'", "-0.15" };
cmd.parse(4, args, true, 0);
}
TEST_DEF(CommandLine) {
testSimple();
}

View file

@ -0,0 +1,18 @@
#include "Tests.hpp"
#include "Testing.hpp"
int main() {
tp::ModuleManifest* deps[] = { &tp::gModuleUtils, &tp::gModuleTokenizer, nullptr };
tp::ModuleManifest testModule("CommandLineTest", nullptr, nullptr, deps);
if (!testModule.initialize()) {
return 1;
}
testCommandLine();
testModule.deinitialize();
}

View file

@ -0,0 +1,7 @@
#pragma once
#include "Testing.hpp"
#include "Allocators.hpp"
#include "CommandLine.hpp"
void testCommandLine();