#include #include #include #include class ArgParserTest : public uUnit { public: ArgParserTest() { uTEST(ArgParserTest::test); } void test() { const char* argv[] = { "app-name", "-x", "42" }; int argc = sizeof(argv)/sizeof(*argv); ArgParser> args; args.add("-x", "--some-x", std::function([](int i) { std::cout << "int: " << i << "\n"; return 0; }), "Helptext for -x,--some-x"); args.add("-X", "--opt-x", std::function([](std::optional i) { std::cout << "opt: " << (i?std::to_string(*i):"none") << "\n"; return 0; }), "Helptext for -X,--opt-x"); args.parse(argc, argv); } }; // Registers the fixture into the 'registry' static ArgParserTest test;