Modules/CommandLine/tests/TestInterpreter.cpp
2024-11-24 22:36:45 +03:00

34 lines
657 B
C++

#include "Tests.hpp"
#include "CmdLineInterpreter.hpp"
using namespace tp;
TEST_DEF_STATIC(Simple) {
struct TestStruct {
int val = 0;
static bool print(TestStruct* self, const CommandLine& args) {
printf("Test Val - %i\n", (int) args.getBool("bool"));
return false;
}
};
TestStruct self;
CmdLineInterpreter interp;
interp.addCommand("test", new CommandLine{ { "bool", CommandLine::Arg::BOOL } }, (CmdLineInterpreter::CommandFunction) TestStruct::print);
printf("test false\n", stdin);
printf("help\n", stdin);
printf("help test\n", stdin);
printf("exit\n", stdin);
interp.run();
}
TEST_DEF(Interpreter) {
//testSimple();
}