|
|
|
@ -31,7 +31,7 @@ int main() {
|
|
|
|
|
// with many variations of valid input on a single command line.
|
|
|
|
|
//
|
|
|
|
|
// simulated command line:
|
|
|
|
|
// test -0 -ab -12345 --long-flag -cconcatenated -d separate-value -efdouble-concatenated "positional argument 0" -gh concatenated-separate-value --long-argument-with-value-included="included value" --long-argument-with-value-separated "separate value" "positional argument 1" "positional argument 2"
|
|
|
|
|
// test -0 -ab -12345 --long-flag -cconcatenated -d separate-value -efdouble-concatenated "argument 0" -gh concatenated-separate-value --long-argument-with-value-included="included value" --long-argument-with-value-separated "separate value" "argument 1" "argument 2"
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::Flag> validTestFlags;
|
|
|
|
|
validTestFlags.push_back(CLI::Flag('0', "00000", "a short flag on its own"));
|
|
|
|
@ -47,19 +47,19 @@ int main() {
|
|
|
|
|
validTestFlags.push_back(CLI::Flag('g', "ggggg", "short flags concatenated with an argument that has a separate value"));
|
|
|
|
|
validTestFlags.push_back(CLI::Flag('6', "66666", "unused flag"));
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::UnpositionalArgument> validTestUnpositionalArguments;
|
|
|
|
|
validTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('c', "ccccc", "VALUE", "short argument concatenated with its value"));
|
|
|
|
|
validTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('d', "ddddd", " VALUE", "short argument with separate value"));
|
|
|
|
|
validTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('f', "fffff", "VALUE", "short argument concatenated with a flag and its value"));
|
|
|
|
|
validTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('h', "hhhhh", " VALUE", "short argument concatenated with a flag with separate value"));
|
|
|
|
|
validTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('x', "long-argument-with-value-included", "VALUE", "long argument with its value included using ="));
|
|
|
|
|
validTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('y', "long-argument-with-value-separated", " VALUE", "long argument with separate value"));
|
|
|
|
|
validTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('z', "zzzzz", "NOPE", "unused argument"));
|
|
|
|
|
std::vector<CLI::Option> validTestOptions;
|
|
|
|
|
validTestOptions.push_back(CLI::Option('c', "ccccc", "VALUE", "short argument concatenated with its value"));
|
|
|
|
|
validTestOptions.push_back(CLI::Option('d', "ddddd", " VALUE", "short argument with separate value"));
|
|
|
|
|
validTestOptions.push_back(CLI::Option('f', "fffff", "VALUE", "short argument concatenated with a flag and its value"));
|
|
|
|
|
validTestOptions.push_back(CLI::Option('h', "hhhhh", " VALUE", "short argument concatenated with a flag with separate value"));
|
|
|
|
|
validTestOptions.push_back(CLI::Option('x', "long-argument-with-value-included", "VALUE", "long argument with its value included using ="));
|
|
|
|
|
validTestOptions.push_back(CLI::Option('y', "long-argument-with-value-separated", " VALUE", "long argument with separate value"));
|
|
|
|
|
validTestOptions.push_back(CLI::Option('z', "zzzzz", "NOPE", "unused argument"));
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::PositionalArgument> validTestPositionalArguments;
|
|
|
|
|
validTestPositionalArguments.push_back(CLI::PositionalArgument("argument0", "positional argument between optional parameters"));
|
|
|
|
|
validTestPositionalArguments.push_back(CLI::PositionalArgument("argument1", "positional argument"));
|
|
|
|
|
validTestPositionalArguments.push_back(CLI::PositionalArgument("argument2", "positional argument"));
|
|
|
|
|
std::vector<CLI::Argument> validTestArguments;
|
|
|
|
|
validTestArguments.push_back(CLI::Argument("argument0", "argument between optional parameters"));
|
|
|
|
|
validTestArguments.push_back(CLI::Argument("argument1", "argument"));
|
|
|
|
|
validTestArguments.push_back(CLI::Argument("argument2", "argument"));
|
|
|
|
|
|
|
|
|
|
const char** validTestParameterList = new const char*[17];
|
|
|
|
|
validTestParameterList[ 0] = "test";
|
|
|
|
@ -71,17 +71,17 @@ int main() {
|
|
|
|
|
validTestParameterList[ 6] = "-d";
|
|
|
|
|
validTestParameterList[ 7] = "separate-value";
|
|
|
|
|
validTestParameterList[ 8] = "-efdouble-concatenated";
|
|
|
|
|
validTestParameterList[ 9] = "positional argument 0";
|
|
|
|
|
validTestParameterList[ 9] = "argument 0";
|
|
|
|
|
validTestParameterList[10] = "-gh";
|
|
|
|
|
validTestParameterList[11] = "concatenated-separate-value";
|
|
|
|
|
validTestParameterList[12] = "--long-argument-with-value-included=included value";
|
|
|
|
|
validTestParameterList[13] = "--long-argument-with-value-separated";
|
|
|
|
|
validTestParameterList[14] = "separate value";
|
|
|
|
|
validTestParameterList[15] = "positional argument 1";
|
|
|
|
|
validTestParameterList[16] = "positional argument 2";
|
|
|
|
|
validTestParameterList[15] = "argument 1";
|
|
|
|
|
validTestParameterList[16] = "argument 2";
|
|
|
|
|
int validTestParameterCount = 17;
|
|
|
|
|
|
|
|
|
|
CLI::ArgumentsParser validTestParameterParser = CLI::ArgumentsParser(validTestParameterCount, validTestParameterList, validTestFlags, validTestUnpositionalArguments, validTestPositionalArguments);
|
|
|
|
|
CLI::ArgumentsParser validTestParameterParser = CLI::ArgumentsParser(validTestParameterCount, validTestParameterList, validTestFlags, validTestOptions, validTestArguments);
|
|
|
|
|
|
|
|
|
|
ASSERT(!validTestParameterParser.wrongUsage);
|
|
|
|
|
ASSERT(validTestParameterParser.programName == std::string("test"));
|
|
|
|
@ -115,50 +115,50 @@ int main() {
|
|
|
|
|
ASSERT(!validTestParameterParser.getFlag('6').isError);
|
|
|
|
|
ASSERT(!validTestParameterParser.getFlag('6').value);
|
|
|
|
|
ASSERT(!validTestParameterParser.getFlag(std::string("66666")).value);
|
|
|
|
|
ASSERT(!validTestParameterParser.getUnpositionalArgument('c').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getUnpositionalArgument('c').value==std::string("concatenated"));
|
|
|
|
|
ASSERT(validTestParameterParser.getUnpositionalArgument(std::string("ccccc")).value==std::string("concatenated"));
|
|
|
|
|
ASSERT(!validTestParameterParser.getUnpositionalArgument('d').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getUnpositionalArgument('d').value==std::string("separate-value"));
|
|
|
|
|
ASSERT(validTestParameterParser.getUnpositionalArgument(std::string("ddddd")).value==std::string("separate-value"));
|
|
|
|
|
ASSERT(!validTestParameterParser.getOption('c').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getOption('c').value==std::string("concatenated"));
|
|
|
|
|
ASSERT(validTestParameterParser.getOption(std::string("ccccc")).value==std::string("concatenated"));
|
|
|
|
|
ASSERT(!validTestParameterParser.getOption('d').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getOption('d').value==std::string("separate-value"));
|
|
|
|
|
ASSERT(validTestParameterParser.getOption(std::string("ddddd")).value==std::string("separate-value"));
|
|
|
|
|
ASSERT(!validTestParameterParser.getFlag('e').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getFlag('e').value);
|
|
|
|
|
ASSERT(validTestParameterParser.getFlag(std::string("eeeee")).value);
|
|
|
|
|
ASSERT(!validTestParameterParser.getUnpositionalArgument('f').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getUnpositionalArgument('f').value==std::string("double-concatenated"));
|
|
|
|
|
ASSERT(validTestParameterParser.getUnpositionalArgument(std::string("fffff")).value==std::string("double-concatenated"));
|
|
|
|
|
ASSERT(!validTestParameterParser.getPositionalArgument(0).isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getPositionalArgument(0).value=="positional argument 0");
|
|
|
|
|
ASSERT(!validTestParameterParser.getOption('f').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getOption('f').value==std::string("double-concatenated"));
|
|
|
|
|
ASSERT(validTestParameterParser.getOption(std::string("fffff")).value==std::string("double-concatenated"));
|
|
|
|
|
ASSERT(!validTestParameterParser.getArgument(0).isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getArgument(0).value=="argument 0");
|
|
|
|
|
ASSERT(!validTestParameterParser.getFlag('g').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getFlag('g').value);
|
|
|
|
|
ASSERT(validTestParameterParser.getFlag(std::string("ggggg")).value);
|
|
|
|
|
ASSERT(!validTestParameterParser.getUnpositionalArgument('h').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getUnpositionalArgument('h').value==std::string("concatenated-separate-value"));
|
|
|
|
|
ASSERT(validTestParameterParser.getUnpositionalArgument(std::string("hhhhh")).value==std::string("concatenated-separate-value"));
|
|
|
|
|
ASSERT(!validTestParameterParser.getUnpositionalArgument('x').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getUnpositionalArgument('x').value==std::string("included value"));
|
|
|
|
|
ASSERT(validTestParameterParser.getUnpositionalArgument(std::string("long-argument-with-value-included")).value==std::string("included value"));
|
|
|
|
|
ASSERT(!validTestParameterParser.getUnpositionalArgument('y').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getUnpositionalArgument('y').value==std::string("separate value"));
|
|
|
|
|
ASSERT(validTestParameterParser.getUnpositionalArgument(std::string("long-argument-with-value-separated")).value==std::string("separate value"));
|
|
|
|
|
ASSERT(!validTestParameterParser.getPositionalArgument(1).isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getPositionalArgument(1).value=="positional argument 1");
|
|
|
|
|
ASSERT(!validTestParameterParser.getPositionalArgument(2).isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getPositionalArgument(2).value=="positional argument 2");
|
|
|
|
|
ASSERT(!validTestParameterParser.getUnpositionalArgument('z').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getUnpositionalArgument('z').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(validTestParameterParser.getUnpositionalArgument('z').value == std::string(""));
|
|
|
|
|
ASSERT(!validTestParameterParser.getOption('h').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getOption('h').value==std::string("concatenated-separate-value"));
|
|
|
|
|
ASSERT(validTestParameterParser.getOption(std::string("hhhhh")).value==std::string("concatenated-separate-value"));
|
|
|
|
|
ASSERT(!validTestParameterParser.getOption('x').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getOption('x').value==std::string("included value"));
|
|
|
|
|
ASSERT(validTestParameterParser.getOption(std::string("long-argument-with-value-included")).value==std::string("included value"));
|
|
|
|
|
ASSERT(!validTestParameterParser.getOption('y').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getOption('y').value==std::string("separate value"));
|
|
|
|
|
ASSERT(validTestParameterParser.getOption(std::string("long-argument-with-value-separated")).value==std::string("separate value"));
|
|
|
|
|
ASSERT(!validTestParameterParser.getArgument(1).isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getArgument(1).value=="argument 1");
|
|
|
|
|
ASSERT(!validTestParameterParser.getArgument(2).isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getArgument(2).value=="argument 2");
|
|
|
|
|
ASSERT(!validTestParameterParser.getOption('z').isError);
|
|
|
|
|
ASSERT(validTestParameterParser.getOption('z').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(validTestParameterParser.getOption('z').value == std::string(""));
|
|
|
|
|
ASSERT(validTestParameterParser.wrongUsageMessages.size() == 0);
|
|
|
|
|
|
|
|
|
|
delete[] validTestParameterList;
|
|
|
|
|
std::cout << "Passed valid input test." << std::endl;
|
|
|
|
|
std::cout << "Passed valid command line test." << std::endl;
|
|
|
|
|
|
|
|
|
|
// empty input (valid and invalid) #################################
|
|
|
|
|
std::vector<CLI::Flag> emptyTestFlags;
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::UnpositionalArgument> emptyTestUnpositionalArguments;
|
|
|
|
|
std::vector<CLI::Option> emptyTestOptions;
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::PositionalArgument> emptyTestPositionalArguments;
|
|
|
|
|
std::vector<CLI::Argument> emptyTestArguments;
|
|
|
|
|
|
|
|
|
|
const char** emptyTestParameterList = new const char*[1];
|
|
|
|
|
// The command is always a part of a command line, even if it is empty
|
|
|
|
@ -168,24 +168,24 @@ int main() {
|
|
|
|
|
int emptyTestParameterCount = 1;
|
|
|
|
|
|
|
|
|
|
// valid
|
|
|
|
|
CLI::ArgumentsParser validEmptyTestParameterParser = CLI::ArgumentsParser(emptyTestParameterCount, emptyTestParameterList, emptyTestFlags, emptyTestUnpositionalArguments, emptyTestPositionalArguments);
|
|
|
|
|
CLI::ArgumentsParser validEmptyTestParameterParser = CLI::ArgumentsParser(emptyTestParameterCount, emptyTestParameterList, emptyTestFlags, emptyTestOptions, emptyTestArguments);
|
|
|
|
|
ASSERT(!validEmptyTestParameterParser.wrongUsage);
|
|
|
|
|
ASSERT(validEmptyTestParameterParser.programName == std::string("test"));
|
|
|
|
|
ASSERT(validEmptyTestParameterParser.wrongUsageMessages.size() == 0);
|
|
|
|
|
|
|
|
|
|
//invalid
|
|
|
|
|
emptyTestPositionalArguments.push_back(CLI::PositionalArgument("argument", "positional argument"));
|
|
|
|
|
emptyTestArguments.push_back(CLI::Argument("argument", "argument"));
|
|
|
|
|
|
|
|
|
|
CLI::ArgumentsParser invalidEmptyTestParameterParser = CLI::ArgumentsParser(emptyTestParameterCount, emptyTestParameterList, emptyTestFlags, emptyTestUnpositionalArguments, emptyTestPositionalArguments);
|
|
|
|
|
CLI::ArgumentsParser invalidEmptyTestParameterParser = CLI::ArgumentsParser(emptyTestParameterCount, emptyTestParameterList, emptyTestFlags, emptyTestOptions, emptyTestArguments);
|
|
|
|
|
ASSERT(invalidEmptyTestParameterParser.wrongUsage);
|
|
|
|
|
ASSERT(invalidEmptyTestParameterParser.programName == std::string("test"));
|
|
|
|
|
ASSERT(invalidEmptyTestParameterParser.getPositionalArgument(0).isError);
|
|
|
|
|
ASSERT(invalidEmptyTestParameterParser.getPositionalArgument(0).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(invalidEmptyTestParameterParser.getArgument(0).isError);
|
|
|
|
|
ASSERT(invalidEmptyTestParameterParser.getArgument(0).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(invalidEmptyTestParameterParser.wrongUsageMessages.size() == 1);
|
|
|
|
|
ASSERT(invalidEmptyTestParameterParser.wrongUsageMessages.at(0) == "Too few positional arguments! Missing: argument");
|
|
|
|
|
ASSERT(invalidEmptyTestParameterParser.wrongUsageMessages.at(0) == "Too few arguments! Missing: argument");
|
|
|
|
|
|
|
|
|
|
delete[] emptyTestParameterList;
|
|
|
|
|
std::cout << "Passed empty input test." << std::endl;
|
|
|
|
|
std::cout << "Passed empty command line test." << std::endl;
|
|
|
|
|
|
|
|
|
|
// unknown flag ####################################################
|
|
|
|
|
|
|
|
|
@ -197,9 +197,9 @@ int main() {
|
|
|
|
|
unknownFlagTestFlags.push_back(CLI::Flag('4', "four", "test flag"));
|
|
|
|
|
unknownFlagTestFlags.push_back(CLI::Flag('5', "five", "test flag"));
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::UnpositionalArgument> unknownFlagTestUnpositionalArguments;
|
|
|
|
|
std::vector<CLI::Option> unknownFlagTestOptions;
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::PositionalArgument> unknownFlagTestPositionalArguments;
|
|
|
|
|
std::vector<CLI::Argument> unknownFlagTestArguments;
|
|
|
|
|
|
|
|
|
|
const char** unknownFlagTestParameterList = new const char*[7];
|
|
|
|
|
unknownFlagTestParameterList[0] = "test";
|
|
|
|
@ -211,7 +211,7 @@ int main() {
|
|
|
|
|
unknownFlagTestParameterList[6] = "-5";
|
|
|
|
|
int unknownFlagStandaloneTestParameterCount = 2;
|
|
|
|
|
|
|
|
|
|
CLI::ArgumentsParser unknownFlagStandaloneTestParser = CLI::ArgumentsParser(unknownFlagStandaloneTestParameterCount, unknownFlagTestParameterList, unknownFlagTestFlags, unknownFlagTestUnpositionalArguments, unknownFlagTestPositionalArguments);
|
|
|
|
|
CLI::ArgumentsParser unknownFlagStandaloneTestParser = CLI::ArgumentsParser(unknownFlagStandaloneTestParameterCount, unknownFlagTestParameterList, unknownFlagTestFlags, unknownFlagTestOptions, unknownFlagTestArguments);
|
|
|
|
|
ASSERT(unknownFlagStandaloneTestParser.getFlag('1').isError);
|
|
|
|
|
ASSERT(unknownFlagStandaloneTestParser.getFlag('1').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(!unknownFlagStandaloneTestParser.getFlag('1').value);
|
|
|
|
@ -223,7 +223,7 @@ int main() {
|
|
|
|
|
|
|
|
|
|
int unknownFlagMixedTestParameterCount = 7;
|
|
|
|
|
|
|
|
|
|
CLI::ArgumentsParser unknownFlagMixedTestParser = CLI::ArgumentsParser(unknownFlagMixedTestParameterCount, unknownFlagTestParameterList, unknownFlagTestFlags, unknownFlagTestUnpositionalArguments, unknownFlagTestPositionalArguments);
|
|
|
|
|
CLI::ArgumentsParser unknownFlagMixedTestParser = CLI::ArgumentsParser(unknownFlagMixedTestParameterCount, unknownFlagTestParameterList, unknownFlagTestFlags, unknownFlagTestOptions, unknownFlagTestArguments);
|
|
|
|
|
ASSERT(unknownFlagMixedTestParser.getFlag('1').isError);
|
|
|
|
|
ASSERT(unknownFlagMixedTestParser.getFlag('1').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(unknownFlagMixedTestParser.getFlag('1').value);
|
|
|
|
@ -243,9 +243,9 @@ int main() {
|
|
|
|
|
unknownLongFlagTestFlags.push_back(CLI::Flag('4', "four", "test flag"));
|
|
|
|
|
unknownLongFlagTestFlags.push_back(CLI::Flag('5', "five", "test flag"));
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::UnpositionalArgument> unknownLongFlagTestUnpositionalArguments;
|
|
|
|
|
std::vector<CLI::Option> unknownLongFlagTestOptions;
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::PositionalArgument> unknownLongFlagTestPositionalArguments;
|
|
|
|
|
std::vector<CLI::Argument> unknownLongFlagTestArguments;
|
|
|
|
|
|
|
|
|
|
const char** unknownLongFlagTestParameterList = new const char*[7];
|
|
|
|
|
unknownLongFlagTestParameterList[0] = "test";
|
|
|
|
@ -257,7 +257,7 @@ int main() {
|
|
|
|
|
unknownLongFlagTestParameterList[6] = "-5";
|
|
|
|
|
int unknownLongFlagStandaloneTestParameterCount = 2;
|
|
|
|
|
|
|
|
|
|
CLI::ArgumentsParser unknownLongFlagStandaloneTestParser = CLI::ArgumentsParser(unknownLongFlagStandaloneTestParameterCount, unknownLongFlagTestParameterList, unknownLongFlagTestFlags, unknownLongFlagTestUnpositionalArguments, unknownLongFlagTestPositionalArguments);
|
|
|
|
|
CLI::ArgumentsParser unknownLongFlagStandaloneTestParser = CLI::ArgumentsParser(unknownLongFlagStandaloneTestParameterCount, unknownLongFlagTestParameterList, unknownLongFlagTestFlags, unknownLongFlagTestOptions, unknownLongFlagTestArguments);
|
|
|
|
|
ASSERT(unknownLongFlagStandaloneTestParser.getFlag('1').isError);
|
|
|
|
|
ASSERT(unknownLongFlagStandaloneTestParser.getFlag('1').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(!unknownLongFlagStandaloneTestParser.getFlag('1').value);
|
|
|
|
@ -269,7 +269,7 @@ int main() {
|
|
|
|
|
|
|
|
|
|
int unknownLongFlagMixedTestParameterCount = 7;
|
|
|
|
|
|
|
|
|
|
CLI::ArgumentsParser unknownLongFlagMixedTestParser = CLI::ArgumentsParser(unknownLongFlagMixedTestParameterCount, unknownLongFlagTestParameterList, unknownLongFlagTestFlags, unknownLongFlagTestUnpositionalArguments, unknownLongFlagTestPositionalArguments);
|
|
|
|
|
CLI::ArgumentsParser unknownLongFlagMixedTestParser = CLI::ArgumentsParser(unknownLongFlagMixedTestParameterCount, unknownLongFlagTestParameterList, unknownLongFlagTestFlags, unknownLongFlagTestOptions, unknownLongFlagTestArguments);
|
|
|
|
|
ASSERT(unknownLongFlagMixedTestParser.getFlag('1').isError);
|
|
|
|
|
ASSERT(unknownLongFlagMixedTestParser.getFlag('1').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(unknownLongFlagMixedTestParser.getFlag('1').value);
|
|
|
|
@ -282,359 +282,359 @@ int main() {
|
|
|
|
|
delete[] unknownLongFlagTestParameterList;
|
|
|
|
|
std::cout << "Passed unknown flag test." << std::endl;
|
|
|
|
|
|
|
|
|
|
// unknown unpositional argument ###################################
|
|
|
|
|
// unknown argument ################################################
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::Flag> unknownArgumentTestFlags;
|
|
|
|
|
std::vector<CLI::Flag> unknownOptionTestFlags;
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::UnpositionalArgument> unknownArgumentTestUnpositionalArguments;
|
|
|
|
|
unknownArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('0', "zero", "zero", "test argument"));
|
|
|
|
|
unknownArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('1', "one", "one", "test argument"));
|
|
|
|
|
unknownArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('2', "two", "two", "test argument"));
|
|
|
|
|
unknownArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('3', "three","three","test argument"));
|
|
|
|
|
unknownArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('4', "four", "four", "test argument"));
|
|
|
|
|
unknownArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('5', "five", "five", "test argument"));
|
|
|
|
|
std::vector<CLI::Option> unknownOptionTestOptions;
|
|
|
|
|
unknownOptionTestOptions.push_back(CLI::Option('0', "zero", "zero", "test argument"));
|
|
|
|
|
unknownOptionTestOptions.push_back(CLI::Option('1', "one", "one", "test argument"));
|
|
|
|
|
unknownOptionTestOptions.push_back(CLI::Option('2', "two", "two", "test argument"));
|
|
|
|
|
unknownOptionTestOptions.push_back(CLI::Option('3', "three","three","test argument"));
|
|
|
|
|
unknownOptionTestOptions.push_back(CLI::Option('4', "four", "four", "test argument"));
|
|
|
|
|
unknownOptionTestOptions.push_back(CLI::Option('5', "five", "five", "test argument"));
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::PositionalArgument> unknownArgumentTestPositionalArguments;
|
|
|
|
|
std::vector<CLI::Argument> unknownOptionTestArguments;
|
|
|
|
|
|
|
|
|
|
const char** unknownArgumentTestParameterList = new const char*[7];
|
|
|
|
|
unknownArgumentTestParameterList[0] = "test";
|
|
|
|
|
unknownArgumentTestParameterList[1] = "-a123";
|
|
|
|
|
unknownArgumentTestParameterList[2] = "-1a";
|
|
|
|
|
unknownArgumentTestParameterList[3] = "-2b";
|
|
|
|
|
unknownArgumentTestParameterList[4] = "-3c";
|
|
|
|
|
unknownArgumentTestParameterList[5] = "-4d";
|
|
|
|
|
unknownArgumentTestParameterList[6] = "-5e";
|
|
|
|
|
int unknownArgumentStandaloneTestParameterCount = 2;
|
|
|
|
|
const char** unknownOptionTestParameterList = new const char*[7];
|
|
|
|
|
unknownOptionTestParameterList[0] = "test";
|
|
|
|
|
unknownOptionTestParameterList[1] = "-a123";
|
|
|
|
|
unknownOptionTestParameterList[2] = "-1a";
|
|
|
|
|
unknownOptionTestParameterList[3] = "-2b";
|
|
|
|
|
unknownOptionTestParameterList[4] = "-3c";
|
|
|
|
|
unknownOptionTestParameterList[5] = "-4d";
|
|
|
|
|
unknownOptionTestParameterList[6] = "-5e";
|
|
|
|
|
int unknownOptionStandaloneTestParameterCount = 2;
|
|
|
|
|
|
|
|
|
|
CLI::ArgumentsParser unknownArgumentStandaloneTestParser = CLI::ArgumentsParser(unknownArgumentStandaloneTestParameterCount, unknownArgumentTestParameterList, unknownArgumentTestFlags, unknownArgumentTestUnpositionalArguments, unknownArgumentTestPositionalArguments);
|
|
|
|
|
ASSERT(unknownArgumentStandaloneTestParser.getUnpositionalArgument('1').isError);
|
|
|
|
|
ASSERT(unknownArgumentStandaloneTestParser.getUnpositionalArgument('1').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(unknownArgumentStandaloneTestParser.getUnpositionalArgument('1').value == "");
|
|
|
|
|
ASSERT(unknownArgumentStandaloneTestParser.getUnpositionalArgument(std::string("four")).isError);
|
|
|
|
|
ASSERT(unknownArgumentStandaloneTestParser.getUnpositionalArgument(std::string("four")).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(unknownArgumentStandaloneTestParser.getUnpositionalArgument(std::string("four")).value == "");
|
|
|
|
|
ASSERT(unknownArgumentStandaloneTestParser.wrongUsageMessages.size() == 1);
|
|
|
|
|
ASSERT(unknownArgumentStandaloneTestParser.wrongUsageMessages.at(0) == "Unknown argument or flag(s): a123");
|
|
|
|
|
CLI::ArgumentsParser unknownOptionStandaloneTestParser = CLI::ArgumentsParser(unknownOptionStandaloneTestParameterCount, unknownOptionTestParameterList, unknownOptionTestFlags, unknownOptionTestOptions, unknownOptionTestArguments);
|
|
|
|
|
ASSERT(unknownOptionStandaloneTestParser.getOption('1').isError);
|
|
|
|
|
ASSERT(unknownOptionStandaloneTestParser.getOption('1').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(unknownOptionStandaloneTestParser.getOption('1').value == "");
|
|
|
|
|
ASSERT(unknownOptionStandaloneTestParser.getOption(std::string("four")).isError);
|
|
|
|
|
ASSERT(unknownOptionStandaloneTestParser.getOption(std::string("four")).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(unknownOptionStandaloneTestParser.getOption(std::string("four")).value == "");
|
|
|
|
|
ASSERT(unknownOptionStandaloneTestParser.wrongUsageMessages.size() == 1);
|
|
|
|
|
ASSERT(unknownOptionStandaloneTestParser.wrongUsageMessages.at(0) == "Unknown argument or flag(s): a123");
|
|
|
|
|
|
|
|
|
|
int unknownArgumentMixedTestParameterCount = 7;
|
|
|
|
|
int unknownOptionMixedTestParameterCount = 7;
|
|
|
|
|
|
|
|
|
|
CLI::ArgumentsParser unknownArgumentMixedTestParser = CLI::ArgumentsParser(unknownArgumentMixedTestParameterCount, unknownArgumentTestParameterList, unknownArgumentTestFlags, unknownArgumentTestUnpositionalArguments, unknownArgumentTestPositionalArguments);
|
|
|
|
|
ASSERT(unknownArgumentMixedTestParser.getUnpositionalArgument('1').isError);
|
|
|
|
|
ASSERT(unknownArgumentMixedTestParser.getUnpositionalArgument('1').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(unknownArgumentMixedTestParser.getUnpositionalArgument('1').value == "a");
|
|
|
|
|
ASSERT(unknownArgumentMixedTestParser.getUnpositionalArgument(std::string("four")).isError);
|
|
|
|
|
ASSERT(unknownArgumentMixedTestParser.getUnpositionalArgument(std::string("four")).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(unknownArgumentMixedTestParser.getUnpositionalArgument(std::string("four")).value == "d");
|
|
|
|
|
ASSERT(unknownArgumentMixedTestParser.wrongUsageMessages.size() == 1);
|
|
|
|
|
ASSERT(unknownArgumentMixedTestParser.wrongUsageMessages.at(0) == "Unknown argument or flag(s): a123");
|
|
|
|
|
CLI::ArgumentsParser unknownOptionMixedTestParser = CLI::ArgumentsParser(unknownOptionMixedTestParameterCount, unknownOptionTestParameterList, unknownOptionTestFlags, unknownOptionTestOptions, unknownOptionTestArguments);
|
|
|
|
|
ASSERT(unknownOptionMixedTestParser.getOption('1').isError);
|
|
|
|
|
ASSERT(unknownOptionMixedTestParser.getOption('1').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(unknownOptionMixedTestParser.getOption('1').value == "a");
|
|
|
|
|
ASSERT(unknownOptionMixedTestParser.getOption(std::string("four")).isError);
|
|
|
|
|
ASSERT(unknownOptionMixedTestParser.getOption(std::string("four")).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(unknownOptionMixedTestParser.getOption(std::string("four")).value == "d");
|
|
|
|
|
ASSERT(unknownOptionMixedTestParser.wrongUsageMessages.size() == 1);
|
|
|
|
|
ASSERT(unknownOptionMixedTestParser.wrongUsageMessages.at(0) == "Unknown argument or flag(s): a123");
|
|
|
|
|
|
|
|
|
|
delete[] unknownArgumentTestParameterList;
|
|
|
|
|
delete[] unknownOptionTestParameterList;
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::Flag> unknownLongArgumentTestFlags;
|
|
|
|
|
std::vector<CLI::Flag> unknownLongOptionTestFlags;
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::UnpositionalArgument> unknownLongArgumentTestUnpositionalArguments;
|
|
|
|
|
unknownLongArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('0', "zero", "zero", "test argument"));
|
|
|
|
|
unknownLongArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('1', "one", "one", "test argument"));
|
|
|
|
|
unknownLongArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('2', "two", "two", "test argument"));
|
|
|
|
|
unknownLongArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('3', "three","three","test argument"));
|
|
|
|
|
unknownLongArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('4', "four", "four", "test argument"));
|
|
|
|
|
unknownLongArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('5', "five", "five", "test argument"));
|
|
|
|
|
std::vector<CLI::Option> unknownLongOptionTestOptions;
|
|
|
|
|
unknownLongOptionTestOptions.push_back(CLI::Option('0', "zero", "zero", "test argument"));
|
|
|
|
|
unknownLongOptionTestOptions.push_back(CLI::Option('1', "one", "one", "test argument"));
|
|
|
|
|
unknownLongOptionTestOptions.push_back(CLI::Option('2', "two", "two", "test argument"));
|
|
|
|
|
unknownLongOptionTestOptions.push_back(CLI::Option('3', "three","three","test argument"));
|
|
|
|
|
unknownLongOptionTestOptions.push_back(CLI::Option('4', "four", "four", "test argument"));
|
|
|
|
|
unknownLongOptionTestOptions.push_back(CLI::Option('5', "five", "five", "test argument"));
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::PositionalArgument> unknownLongArgumentTestPositionalArguments;
|
|
|
|
|
std::vector<CLI::Argument> unknownLongOptionTestArguments;
|
|
|
|
|
|
|
|
|
|
const char** unknownLongArgumentTestParameterList = new const char*[7];
|
|
|
|
|
unknownLongArgumentTestParameterList[0] = "test";
|
|
|
|
|
unknownLongArgumentTestParameterList[1] = "--a=123";
|
|
|
|
|
unknownLongArgumentTestParameterList[2] = "-1a";
|
|
|
|
|
unknownLongArgumentTestParameterList[3] = "-2b";
|
|
|
|
|
unknownLongArgumentTestParameterList[4] = "-3c";
|
|
|
|
|
unknownLongArgumentTestParameterList[5] = "-4d";
|
|
|
|
|
unknownLongArgumentTestParameterList[6] = "-5e";
|
|
|
|
|
int unknownLongArgumentStandaloneTestParameterCount = 2;
|
|
|
|
|
const char** unknownLongOptionTestParameterList = new const char*[7];
|
|
|
|
|
unknownLongOptionTestParameterList[0] = "test";
|
|
|
|
|
unknownLongOptionTestParameterList[1] = "--a=123";
|
|
|
|
|
unknownLongOptionTestParameterList[2] = "-1a";
|
|
|
|
|
unknownLongOptionTestParameterList[3] = "-2b";
|
|
|
|
|
unknownLongOptionTestParameterList[4] = "-3c";
|
|
|
|
|
unknownLongOptionTestParameterList[5] = "-4d";
|
|
|
|
|
unknownLongOptionTestParameterList[6] = "-5e";
|
|
|
|
|
int unknownLongOptionStandaloneTestParameterCount = 2;
|
|
|
|
|
|
|
|
|
|
CLI::ArgumentsParser unknownLongArgumentStandaloneTestParser = CLI::ArgumentsParser(unknownLongArgumentStandaloneTestParameterCount, unknownLongArgumentTestParameterList, unknownLongArgumentTestFlags, unknownLongArgumentTestUnpositionalArguments, unknownLongArgumentTestPositionalArguments);
|
|
|
|
|
ASSERT(unknownLongArgumentStandaloneTestParser.getUnpositionalArgument('1').isError);
|
|
|
|
|
ASSERT(unknownLongArgumentStandaloneTestParser.getUnpositionalArgument('1').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(unknownLongArgumentStandaloneTestParser.getUnpositionalArgument('1').value == "");
|
|
|
|
|
ASSERT(unknownLongArgumentStandaloneTestParser.getUnpositionalArgument(std::string("four")).isError);
|
|
|
|
|
ASSERT(unknownLongArgumentStandaloneTestParser.getUnpositionalArgument(std::string("four")).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(unknownLongArgumentStandaloneTestParser.getUnpositionalArgument(std::string("four")).value == "");
|
|
|
|
|
ASSERT(unknownLongArgumentStandaloneTestParser.wrongUsageMessages.size() == 1);
|
|
|
|
|
ASSERT(unknownLongArgumentStandaloneTestParser.wrongUsageMessages.at(0) == "Unknown argument (or it's a flag that doesn't take a value): --a=123");
|
|
|
|
|
CLI::ArgumentsParser unknownLongOptionStandaloneTestParser = CLI::ArgumentsParser(unknownLongOptionStandaloneTestParameterCount, unknownLongOptionTestParameterList, unknownLongOptionTestFlags, unknownLongOptionTestOptions, unknownLongOptionTestArguments);
|
|
|
|
|
ASSERT(unknownLongOptionStandaloneTestParser.getOption('1').isError);
|
|
|
|
|
ASSERT(unknownLongOptionStandaloneTestParser.getOption('1').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(unknownLongOptionStandaloneTestParser.getOption('1').value == "");
|
|
|
|
|
ASSERT(unknownLongOptionStandaloneTestParser.getOption(std::string("four")).isError);
|
|
|
|
|
ASSERT(unknownLongOptionStandaloneTestParser.getOption(std::string("four")).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(unknownLongOptionStandaloneTestParser.getOption(std::string("four")).value == "");
|
|
|
|
|
ASSERT(unknownLongOptionStandaloneTestParser.wrongUsageMessages.size() == 1);
|
|
|
|
|
ASSERT(unknownLongOptionStandaloneTestParser.wrongUsageMessages.at(0) == "Unknown argument (or it's a flag that doesn't take a value): --a=123");
|
|
|
|
|
|
|
|
|
|
int unknownLongArgumentMixedTestParameterCount = 7;
|
|
|
|
|
int unknownLongOptionMixedTestParameterCount = 7;
|
|
|
|
|
|
|
|
|
|
CLI::ArgumentsParser unknownLongArgumentMixedTestParser = CLI::ArgumentsParser(unknownLongArgumentMixedTestParameterCount, unknownLongArgumentTestParameterList, unknownLongArgumentTestFlags, unknownLongArgumentTestUnpositionalArguments, unknownLongArgumentTestPositionalArguments);
|
|
|
|
|
ASSERT(unknownLongArgumentMixedTestParser.getUnpositionalArgument('1').isError);
|
|
|
|
|
ASSERT(unknownLongArgumentMixedTestParser.getUnpositionalArgument('1').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(unknownLongArgumentMixedTestParser.getUnpositionalArgument('1').value == "a");
|
|
|
|
|
ASSERT(unknownLongArgumentMixedTestParser.getUnpositionalArgument(std::string("four")).isError);
|
|
|
|
|
ASSERT(unknownLongArgumentMixedTestParser.getUnpositionalArgument(std::string("four")).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(unknownLongArgumentMixedTestParser.getUnpositionalArgument(std::string("four")).value == "d");
|
|
|
|
|
ASSERT(unknownLongArgumentMixedTestParser.wrongUsageMessages.size() == 1);
|
|
|
|
|
ASSERT(unknownLongArgumentMixedTestParser.wrongUsageMessages.at(0) == "Unknown argument (or it's a flag that doesn't take a value): --a=123");
|
|
|
|
|
CLI::ArgumentsParser unknownLongOptionMixedTestParser = CLI::ArgumentsParser(unknownLongOptionMixedTestParameterCount, unknownLongOptionTestParameterList, unknownLongOptionTestFlags, unknownLongOptionTestOptions, unknownLongOptionTestArguments);
|
|
|
|
|
ASSERT(unknownLongOptionMixedTestParser.getOption('1').isError);
|
|
|
|
|
ASSERT(unknownLongOptionMixedTestParser.getOption('1').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(unknownLongOptionMixedTestParser.getOption('1').value == "a");
|
|
|
|
|
ASSERT(unknownLongOptionMixedTestParser.getOption(std::string("four")).isError);
|
|
|
|
|
ASSERT(unknownLongOptionMixedTestParser.getOption(std::string("four")).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(unknownLongOptionMixedTestParser.getOption(std::string("four")).value == "d");
|
|
|
|
|
ASSERT(unknownLongOptionMixedTestParser.wrongUsageMessages.size() == 1);
|
|
|
|
|
ASSERT(unknownLongOptionMixedTestParser.wrongUsageMessages.at(0) == "Unknown argument (or it's a flag that doesn't take a value): --a=123");
|
|
|
|
|
|
|
|
|
|
delete[] unknownLongArgumentTestParameterList;
|
|
|
|
|
std::cout << "Passed unknown unpositional argument test." << std::endl;
|
|
|
|
|
delete[] unknownLongOptionTestParameterList;
|
|
|
|
|
std::cout << "Passed unknown option test." << std::endl;
|
|
|
|
|
|
|
|
|
|
// incomplete unpositional argument ###################################
|
|
|
|
|
// incomplete option ###############################################
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::Flag> incompleteArgumentTestFlags;
|
|
|
|
|
std::vector<CLI::Flag> incompleteOptionTestFlags;
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::UnpositionalArgument> incompleteArgumentTestUnpositionalArguments;
|
|
|
|
|
incompleteArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('0', "zero", "zero", "test argument"));
|
|
|
|
|
incompleteArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('1', "one", "one", "test argument"));
|
|
|
|
|
incompleteArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('2', "two", "two", "test argument"));
|
|
|
|
|
incompleteArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('3', "three","three","test argument"));
|
|
|
|
|
incompleteArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('4', "four", "four", "test argument"));
|
|
|
|
|
incompleteArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('5', "five", "five", "test argument"));
|
|
|
|
|
std::vector<CLI::Option> incompleteOptionTestOptions;
|
|
|
|
|
incompleteOptionTestOptions.push_back(CLI::Option('0', "zero", "zero", "test option"));
|
|
|
|
|
incompleteOptionTestOptions.push_back(CLI::Option('1', "one", "one", "test option"));
|
|
|
|
|
incompleteOptionTestOptions.push_back(CLI::Option('2', "two", "two", "test option"));
|
|
|
|
|
incompleteOptionTestOptions.push_back(CLI::Option('3', "three","three","test option"));
|
|
|
|
|
incompleteOptionTestOptions.push_back(CLI::Option('4', "four", "four", "test option"));
|
|
|
|
|
incompleteOptionTestOptions.push_back(CLI::Option('5', "five", "five", "test option"));
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::PositionalArgument> incompleteArgumentTestPositionalArguments;
|
|
|
|
|
std::vector<CLI::Argument> incompleteOptionTestArguments;
|
|
|
|
|
|
|
|
|
|
const char** incompleteArgumentTestParameterList = new const char*[6];
|
|
|
|
|
incompleteArgumentTestParameterList[0] = "test";
|
|
|
|
|
incompleteArgumentTestParameterList[1] = "-1";
|
|
|
|
|
incompleteArgumentTestParameterList[2] = "--two="; // value ""
|
|
|
|
|
incompleteArgumentTestParameterList[3] = "-3c";
|
|
|
|
|
incompleteArgumentTestParameterList[4] = "-4";
|
|
|
|
|
incompleteArgumentTestParameterList[5] = "-5e";
|
|
|
|
|
int incompleteArgumentStandaloneTestParameterCount = 2;
|
|
|
|
|
const char** incompleteOptionTestParameterList = new const char*[6];
|
|
|
|
|
incompleteOptionTestParameterList[0] = "test";
|
|
|
|
|
incompleteOptionTestParameterList[1] = "-1";
|
|
|
|
|
incompleteOptionTestParameterList[2] = "--two="; // value ""
|
|
|
|
|
incompleteOptionTestParameterList[3] = "-3c";
|
|
|
|
|
incompleteOptionTestParameterList[4] = "-4";
|
|
|
|
|
incompleteOptionTestParameterList[5] = "-5e";
|
|
|
|
|
int incompleteOptionStandaloneTestParameterCount = 2;
|
|
|
|
|
|
|
|
|
|
CLI::ArgumentsParser incompleteArgumentStandaloneTestParser = CLI::ArgumentsParser(incompleteArgumentStandaloneTestParameterCount, incompleteArgumentTestParameterList, incompleteArgumentTestFlags, incompleteArgumentTestUnpositionalArguments, incompleteArgumentTestPositionalArguments);
|
|
|
|
|
ASSERT(incompleteArgumentStandaloneTestParser.getUnpositionalArgument('1').isError);
|
|
|
|
|
ASSERT(incompleteArgumentStandaloneTestParser.getUnpositionalArgument('1').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteArgumentStandaloneTestParser.getUnpositionalArgument('1').value == "");
|
|
|
|
|
ASSERT(incompleteArgumentStandaloneTestParser.getUnpositionalArgument(std::string("four")).isError);
|
|
|
|
|
ASSERT(incompleteArgumentStandaloneTestParser.getUnpositionalArgument(std::string("four")).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(incompleteArgumentStandaloneTestParser.getUnpositionalArgument(std::string("four")).value == "");
|
|
|
|
|
ASSERT(incompleteArgumentStandaloneTestParser.wrongUsageMessages.size() == 1);
|
|
|
|
|
ASSERT(incompleteArgumentStandaloneTestParser.wrongUsageMessages.at(0) == "Argument expects value but has none: one");
|
|
|
|
|
CLI::ArgumentsParser incompleteOptionStandaloneTestParser = CLI::ArgumentsParser(incompleteOptionStandaloneTestParameterCount, incompleteOptionTestParameterList, incompleteOptionTestFlags, incompleteOptionTestOptions, incompleteOptionTestArguments);
|
|
|
|
|
ASSERT(incompleteOptionStandaloneTestParser.getOption('1').isError);
|
|
|
|
|
ASSERT(incompleteOptionStandaloneTestParser.getOption('1').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteOptionStandaloneTestParser.getOption('1').value == "");
|
|
|
|
|
ASSERT(incompleteOptionStandaloneTestParser.getOption(std::string("four")).isError);
|
|
|
|
|
ASSERT(incompleteOptionStandaloneTestParser.getOption(std::string("four")).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(incompleteOptionStandaloneTestParser.getOption(std::string("four")).value == "");
|
|
|
|
|
ASSERT(incompleteOptionStandaloneTestParser.wrongUsageMessages.size() == 1);
|
|
|
|
|
ASSERT(incompleteOptionStandaloneTestParser.wrongUsageMessages.at(0) == "Argument expects value but has none: one");
|
|
|
|
|
|
|
|
|
|
int incompleteArgumentMixedTestParameterCount = 6;
|
|
|
|
|
int incompleteOptionMixedTestParameterCount = 6;
|
|
|
|
|
|
|
|
|
|
CLI::ArgumentsParser incompleteArgumentMixedTestParser = CLI::ArgumentsParser(incompleteArgumentMixedTestParameterCount, incompleteArgumentTestParameterList, incompleteArgumentTestFlags, incompleteArgumentTestUnpositionalArguments, incompleteArgumentTestPositionalArguments);
|
|
|
|
|
ASSERT(incompleteArgumentMixedTestParser.getUnpositionalArgument('1').isError);
|
|
|
|
|
ASSERT(incompleteArgumentMixedTestParser.getUnpositionalArgument('1').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteArgumentMixedTestParser.getUnpositionalArgument('1').value == "");
|
|
|
|
|
ASSERT(incompleteArgumentMixedTestParser.getUnpositionalArgument(std::string("four")).isError);
|
|
|
|
|
ASSERT(incompleteArgumentMixedTestParser.getUnpositionalArgument(std::string("four")).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteArgumentMixedTestParser.getUnpositionalArgument(std::string("four")).value == "");
|
|
|
|
|
ASSERT(incompleteArgumentMixedTestParser.getUnpositionalArgument('5').isError);
|
|
|
|
|
ASSERT(incompleteArgumentMixedTestParser.getUnpositionalArgument('5').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteArgumentMixedTestParser.getUnpositionalArgument('5').value == "e");
|
|
|
|
|
ASSERT(incompleteArgumentMixedTestParser.wrongUsageMessages.size() == 2);
|
|
|
|
|
ASSERT(incompleteArgumentMixedTestParser.wrongUsageMessages.at(0) == "Argument expects value but has none: one");
|
|
|
|
|
ASSERT(incompleteArgumentMixedTestParser.wrongUsageMessages.at(1) == "Argument expects value but has none: four");
|
|
|
|
|
CLI::ArgumentsParser incompleteOptionMixedTestParser = CLI::ArgumentsParser(incompleteOptionMixedTestParameterCount, incompleteOptionTestParameterList, incompleteOptionTestFlags, incompleteOptionTestOptions, incompleteOptionTestArguments);
|
|
|
|
|
ASSERT(incompleteOptionMixedTestParser.getOption('1').isError);
|
|
|
|
|
ASSERT(incompleteOptionMixedTestParser.getOption('1').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteOptionMixedTestParser.getOption('1').value == "");
|
|
|
|
|
ASSERT(incompleteOptionMixedTestParser.getOption(std::string("four")).isError);
|
|
|
|
|
ASSERT(incompleteOptionMixedTestParser.getOption(std::string("four")).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteOptionMixedTestParser.getOption(std::string("four")).value == "");
|
|
|
|
|
ASSERT(incompleteOptionMixedTestParser.getOption('5').isError);
|
|
|
|
|
ASSERT(incompleteOptionMixedTestParser.getOption('5').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteOptionMixedTestParser.getOption('5').value == "e");
|
|
|
|
|
ASSERT(incompleteOptionMixedTestParser.wrongUsageMessages.size() == 2);
|
|
|
|
|
ASSERT(incompleteOptionMixedTestParser.wrongUsageMessages.at(0) == "Argument expects value but has none: one");
|
|
|
|
|
ASSERT(incompleteOptionMixedTestParser.wrongUsageMessages.at(1) == "Argument expects value but has none: four");
|
|
|
|
|
|
|
|
|
|
delete[] incompleteArgumentTestParameterList;
|
|
|
|
|
delete[] incompleteOptionTestParameterList;
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::Flag> incompleteLongArgumentTestFlags;
|
|
|
|
|
std::vector<CLI::Flag> incompleteLongOptionTestFlags;
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::UnpositionalArgument> incompleteLongArgumentTestUnpositionalArguments;
|
|
|
|
|
incompleteLongArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('0', "zero", "zero", "test argument"));
|
|
|
|
|
incompleteLongArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('1', "one", "one", "test argument"));
|
|
|
|
|
incompleteLongArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('2', "two", "two", "test argument"));
|
|
|
|
|
incompleteLongArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('3', "three","three","test argument"));
|
|
|
|
|
incompleteLongArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('4', "four", "four", "test argument"));
|
|
|
|
|
incompleteLongArgumentTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('5', "five", "five", "test argument"));
|
|
|
|
|
std::vector<CLI::Option> incompleteLongOptionTestOptions;
|
|
|
|
|
incompleteLongOptionTestOptions.push_back(CLI::Option('0', "zero", "zero", "test argument"));
|
|
|
|
|
incompleteLongOptionTestOptions.push_back(CLI::Option('1', "one", "one", "test argument"));
|
|
|
|
|
incompleteLongOptionTestOptions.push_back(CLI::Option('2', "two", "two", "test argument"));
|
|
|
|
|
incompleteLongOptionTestOptions.push_back(CLI::Option('3', "three","three","test argument"));
|
|
|
|
|
incompleteLongOptionTestOptions.push_back(CLI::Option('4', "four", "four", "test argument"));
|
|
|
|
|
incompleteLongOptionTestOptions.push_back(CLI::Option('5', "five", "five", "test argument"));
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::PositionalArgument> incompleteLongArgumentTestPositionalArguments;
|
|
|
|
|
std::vector<CLI::Argument> incompleteLongOptionTestArguments;
|
|
|
|
|
|
|
|
|
|
const char** incompleteLongArgumentTestParameterList = new const char*[8];
|
|
|
|
|
incompleteLongArgumentTestParameterList[0] = "test";
|
|
|
|
|
incompleteLongArgumentTestParameterList[1] = "--one";
|
|
|
|
|
incompleteLongArgumentTestParameterList[2] = "--two";
|
|
|
|
|
incompleteLongArgumentTestParameterList[3] = "b";
|
|
|
|
|
incompleteLongArgumentTestParameterList[4] = "-3c";
|
|
|
|
|
incompleteLongArgumentTestParameterList[5] = "positional_arg";
|
|
|
|
|
incompleteLongArgumentTestParameterList[6] = "--four";
|
|
|
|
|
incompleteLongArgumentTestParameterList[7] = "--five=e";
|
|
|
|
|
int incompleteLongArgumentStandaloneTestParameterCount = 2;
|
|
|
|
|
const char** incompleteLongOptionTestParameterList = new const char*[8];
|
|
|
|
|
incompleteLongOptionTestParameterList[0] = "test";
|
|
|
|
|
incompleteLongOptionTestParameterList[1] = "--one";
|
|
|
|
|
incompleteLongOptionTestParameterList[2] = "--two";
|
|
|
|
|
incompleteLongOptionTestParameterList[3] = "b";
|
|
|
|
|
incompleteLongOptionTestParameterList[4] = "-3c";
|
|
|
|
|
incompleteLongOptionTestParameterList[5] = "arg";
|
|
|
|
|
incompleteLongOptionTestParameterList[6] = "--four";
|
|
|
|
|
incompleteLongOptionTestParameterList[7] = "--five=e";
|
|
|
|
|
int incompleteLongOptionStandaloneTestParameterCount = 2;
|
|
|
|
|
|
|
|
|
|
CLI::ArgumentsParser incompleteLongArgumentStandaloneTestParser = CLI::ArgumentsParser(incompleteLongArgumentStandaloneTestParameterCount, incompleteLongArgumentTestParameterList, incompleteLongArgumentTestFlags, incompleteLongArgumentTestUnpositionalArguments, incompleteLongArgumentTestPositionalArguments);
|
|
|
|
|
ASSERT(incompleteLongArgumentStandaloneTestParser.getUnpositionalArgument('1').isError);
|
|
|
|
|
ASSERT(incompleteLongArgumentStandaloneTestParser.getUnpositionalArgument('1').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteLongArgumentStandaloneTestParser.getUnpositionalArgument('1').value == "");
|
|
|
|
|
ASSERT(incompleteLongArgumentStandaloneTestParser.getUnpositionalArgument(std::string("four")).isError);
|
|
|
|
|
ASSERT(incompleteLongArgumentStandaloneTestParser.getUnpositionalArgument(std::string("four")).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(incompleteLongArgumentStandaloneTestParser.getUnpositionalArgument(std::string("four")).value == "");
|
|
|
|
|
ASSERT(incompleteLongArgumentStandaloneTestParser.wrongUsageMessages.size() == 1);
|
|
|
|
|
ASSERT(incompleteLongArgumentStandaloneTestParser.wrongUsageMessages.at(0) == "Argument expects value but has none: one");
|
|
|
|
|
CLI::ArgumentsParser incompleteLongOptionStandaloneTestParser = CLI::ArgumentsParser(incompleteLongOptionStandaloneTestParameterCount, incompleteLongOptionTestParameterList, incompleteLongOptionTestFlags, incompleteLongOptionTestOptions, incompleteLongOptionTestArguments);
|
|
|
|
|
ASSERT(incompleteLongOptionStandaloneTestParser.getOption('1').isError);
|
|
|
|
|
ASSERT(incompleteLongOptionStandaloneTestParser.getOption('1').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteLongOptionStandaloneTestParser.getOption('1').value == "");
|
|
|
|
|
ASSERT(incompleteLongOptionStandaloneTestParser.getOption(std::string("four")).isError);
|
|
|
|
|
ASSERT(incompleteLongOptionStandaloneTestParser.getOption(std::string("four")).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(incompleteLongOptionStandaloneTestParser.getOption(std::string("four")).value == "");
|
|
|
|
|
ASSERT(incompleteLongOptionStandaloneTestParser.wrongUsageMessages.size() == 1);
|
|
|
|
|
ASSERT(incompleteLongOptionStandaloneTestParser.wrongUsageMessages.at(0) == "Argument expects value but has none: one");
|
|
|
|
|
|
|
|
|
|
int incompleteLongArgumentMixedTestParameterCount = 8;
|
|
|
|
|
incompleteLongArgumentTestPositionalArguments.push_back(CLI::PositionalArgument("arg", "argument"));
|
|
|
|
|
int incompleteLongOptionMixedTestParameterCount = 8;
|
|
|
|
|
incompleteLongOptionTestArguments.push_back(CLI::Argument("arg", "argument"));
|
|
|
|
|
|
|
|
|
|
CLI::ArgumentsParser incompleteLongArgumentMixedTestParser = CLI::ArgumentsParser(incompleteLongArgumentMixedTestParameterCount, incompleteLongArgumentTestParameterList, incompleteLongArgumentTestFlags, incompleteLongArgumentTestUnpositionalArguments, incompleteLongArgumentTestPositionalArguments);
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.getUnpositionalArgument('1').isError);
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.getUnpositionalArgument('1').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.getUnpositionalArgument('1').value == "");
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.getUnpositionalArgument('2').isError);
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.getUnpositionalArgument('2').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.getUnpositionalArgument('2').value == "b");
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.getUnpositionalArgument(std::string("four")).isError);
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.getUnpositionalArgument(std::string("four")).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.getUnpositionalArgument(std::string("four")).value == "");
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.getUnpositionalArgument('5').isError);
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.getUnpositionalArgument('5').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.getUnpositionalArgument('5').value == "e");
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.wrongUsageMessages.size() == 2);
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.wrongUsageMessages.at(0) == "Argument expects value but has none: one");
|
|
|
|
|
ASSERT(incompleteLongArgumentMixedTestParser.wrongUsageMessages.at(1) == "Argument expects value but has none: four");
|
|
|
|
|
CLI::ArgumentsParser incompleteLongOptionMixedTestParser = CLI::ArgumentsParser(incompleteLongOptionMixedTestParameterCount, incompleteLongOptionTestParameterList, incompleteLongOptionTestFlags, incompleteLongOptionTestOptions, incompleteLongOptionTestArguments);
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.getOption('1').isError);
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.getOption('1').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.getOption('1').value == "");
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.getOption('2').isError);
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.getOption('2').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.getOption('2').value == "b");
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.getOption(std::string("four")).isError);
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.getOption(std::string("four")).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.getOption(std::string("four")).value == "");
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.getOption('5').isError);
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.getOption('5').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.getOption('5').value == "e");
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.wrongUsageMessages.size() == 2);
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.wrongUsageMessages.at(0) == "Argument expects value but has none: one");
|
|
|
|
|
ASSERT(incompleteLongOptionMixedTestParser.wrongUsageMessages.at(1) == "Argument expects value but has none: four");
|
|
|
|
|
|
|
|
|
|
delete[] incompleteLongArgumentTestParameterList;
|
|
|
|
|
std::cout << "Passed incomplete unpositional argument test." << std::endl;
|
|
|
|
|
delete[] incompleteLongOptionTestParameterList;
|
|
|
|
|
std::cout << "Passed incomplete option test." << std::endl;
|
|
|
|
|
|
|
|
|
|
// too few positional arguments
|
|
|
|
|
// too few arguments ###############################################
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::Flag> tooFewArgumentsTestFlags;
|
|
|
|
|
tooFewArgumentsTestFlags.push_back(CLI::Flag('a', "aaaaa", "test flag"));
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::UnpositionalArgument> tooFewArgumentsTestUnpositionalArguments;
|
|
|
|
|
tooFewArgumentsTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('b', "bbbbb", "b", "test argument"));
|
|
|
|
|
tooFewArgumentsTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('c', "ccccc", "c", "test argument"));
|
|
|
|
|
tooFewArgumentsTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('d', "ddddd", "d", "test argument"));
|
|
|
|
|
std::vector<CLI::Option> tooFewArgumentsTestOptions;
|
|
|
|
|
tooFewArgumentsTestOptions.push_back(CLI::Option('b', "bbbbb", "b", "test argument"));
|
|
|
|
|
tooFewArgumentsTestOptions.push_back(CLI::Option('c', "ccccc", "c", "test argument"));
|
|
|
|
|
tooFewArgumentsTestOptions.push_back(CLI::Option('d', "ddddd", "d", "test argument"));
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::PositionalArgument> tooFewArgumentsTestPositionalArguments;
|
|
|
|
|
tooFewArgumentsTestPositionalArguments.push_back(CLI::PositionalArgument("argument0", "test argument"));
|
|
|
|
|
tooFewArgumentsTestPositionalArguments.push_back(CLI::PositionalArgument("argument1", "test argument"));
|
|
|
|
|
tooFewArgumentsTestPositionalArguments.push_back(CLI::PositionalArgument("argument2", "test argument"));
|
|
|
|
|
tooFewArgumentsTestPositionalArguments.push_back(CLI::PositionalArgument("argument3", "test argument"));
|
|
|
|
|
tooFewArgumentsTestPositionalArguments.push_back(CLI::PositionalArgument("argument4", "test argument"));
|
|
|
|
|
std::vector<CLI::Argument> tooFewArgumentsTestArguments;
|
|
|
|
|
tooFewArgumentsTestArguments.push_back(CLI::Argument("argument0", "test argument"));
|
|
|
|
|
tooFewArgumentsTestArguments.push_back(CLI::Argument("argument1", "test argument"));
|
|
|
|
|
tooFewArgumentsTestArguments.push_back(CLI::Argument("argument2", "test argument"));
|
|
|
|
|
tooFewArgumentsTestArguments.push_back(CLI::Argument("argument3", "test argument"));
|
|
|
|
|
tooFewArgumentsTestArguments.push_back(CLI::Argument("argument4", "test argument"));
|
|
|
|
|
|
|
|
|
|
const char** tooFewArgumentsTestParameterList = new const char*[10];
|
|
|
|
|
tooFewArgumentsTestParameterList[0] = "test";
|
|
|
|
|
tooFewArgumentsTestParameterList[1] = "positional_arg_0";
|
|
|
|
|
tooFewArgumentsTestParameterList[1] = "arg_0";
|
|
|
|
|
tooFewArgumentsTestParameterList[2] = "-a";//
|
|
|
|
|
tooFewArgumentsTestParameterList[3] = "-b";
|
|
|
|
|
tooFewArgumentsTestParameterList[4] = "1";
|
|
|
|
|
tooFewArgumentsTestParameterList[5] = "-c5";
|
|
|
|
|
tooFewArgumentsTestParameterList[6] = "positional_arg_1";
|
|
|
|
|
tooFewArgumentsTestParameterList[6] = "arg_1";
|
|
|
|
|
tooFewArgumentsTestParameterList[7] = "--ddddd";
|
|
|
|
|
tooFewArgumentsTestParameterList[8] = "ddd";
|
|
|
|
|
tooFewArgumentsTestParameterList[9] = "positional_arg_2";
|
|
|
|
|
tooFewArgumentsTestParameterList[9] = "arg_2";
|
|
|
|
|
|
|
|
|
|
int tooFewArgumentsStandaloneTestParameterCount = 2;
|
|
|
|
|
CLI::ArgumentsParser tooFewArgumentsStandaloneTestParser = CLI::ArgumentsParser(tooFewArgumentsStandaloneTestParameterCount, tooFewArgumentsTestParameterList, tooFewArgumentsTestFlags, tooFewArgumentsTestUnpositionalArguments, tooFewArgumentsTestPositionalArguments);
|
|
|
|
|
CLI::ArgumentsParser tooFewArgumentsStandaloneTestParser = CLI::ArgumentsParser(tooFewArgumentsStandaloneTestParameterCount, tooFewArgumentsTestParameterList, tooFewArgumentsTestFlags, tooFewArgumentsTestOptions, tooFewArgumentsTestArguments);
|
|
|
|
|
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getPositionalArgument(0).isError);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getPositionalArgument(0).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getPositionalArgument(0).value == "positional_arg_0");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getPositionalArgument(1).isError);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getPositionalArgument(1).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getPositionalArgument(1).value == "");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getUnpositionalArgument('b').isError);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getUnpositionalArgument('b').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getUnpositionalArgument('b').value == "");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getUnpositionalArgument('c').isError);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getUnpositionalArgument('c').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getUnpositionalArgument('c').value == "");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getUnpositionalArgument('d').isError);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getUnpositionalArgument('d').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getUnpositionalArgument('d').value == "");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getArgument(0).isError);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getArgument(0).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getArgument(0).value == "arg_0");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getArgument(1).isError);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getArgument(1).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getArgument(1).value == "");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getOption('b').isError);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getOption('b').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getOption('b').value == "");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getOption('c').isError);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getOption('c').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getOption('c').value == "");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getOption('d').isError);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getOption('d').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.getOption('d').value == "");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.wrongUsageMessages.size() == 4);
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.wrongUsageMessages.at(0) == "Too few positional arguments! Missing: argument1");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.wrongUsageMessages.at(1) == "Too few positional arguments! Missing: argument2");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.wrongUsageMessages.at(2) == "Too few positional arguments! Missing: argument3");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.wrongUsageMessages.at(3) == "Too few positional arguments! Missing: argument4");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.wrongUsageMessages.at(0) == "Too few arguments! Missing: argument1");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.wrongUsageMessages.at(1) == "Too few arguments! Missing: argument2");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.wrongUsageMessages.at(2) == "Too few arguments! Missing: argument3");
|
|
|
|
|
ASSERT(tooFewArgumentsStandaloneTestParser.wrongUsageMessages.at(3) == "Too few arguments! Missing: argument4");
|
|
|
|
|
|
|
|
|
|
int tooFewArgumentsMixedTestParameterCount = 10;
|
|
|
|
|
CLI::ArgumentsParser tooFewArgumentsMixedTestParser = CLI::ArgumentsParser(tooFewArgumentsMixedTestParameterCount, tooFewArgumentsTestParameterList, tooFewArgumentsTestFlags, tooFewArgumentsTestUnpositionalArguments, tooFewArgumentsTestPositionalArguments);
|
|
|
|
|
CLI::ArgumentsParser tooFewArgumentsMixedTestParser = CLI::ArgumentsParser(tooFewArgumentsMixedTestParameterCount, tooFewArgumentsTestParameterList, tooFewArgumentsTestFlags, tooFewArgumentsTestOptions, tooFewArgumentsTestArguments);
|
|
|
|
|
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(0).isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(0).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(0).value == "positional_arg_0");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(1).isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(1).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(1).value == "positional_arg_1");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(2).isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(2).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(2).value == "positional_arg_2");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(3).isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(3).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(3).value == "");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(4).isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(4).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getPositionalArgument(4).value == "");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getUnpositionalArgument('b').isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getUnpositionalArgument('b').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getUnpositionalArgument('b').value == "1");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getUnpositionalArgument('c').isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getUnpositionalArgument('c').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getUnpositionalArgument('c').value == "5");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getUnpositionalArgument('d').isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getUnpositionalArgument('d').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getUnpositionalArgument('d').value == "ddd");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(0).isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(0).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(0).value == "arg_0");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(1).isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(1).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(1).value == "arg_1");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(2).isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(2).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(2).value == "arg_2");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(3).isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(3).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(3).value == "");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(4).isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(4).errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getArgument(4).value == "");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getOption('b').isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getOption('b').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getOption('b').value == "1");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getOption('c').isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getOption('c').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getOption('c').value == "5");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getOption('d').isError);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getOption('d').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.getOption('d').value == "ddd");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.wrongUsageMessages.size() == 2);
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.wrongUsageMessages.at(0) == "Too few positional arguments! Missing: argument3");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.wrongUsageMessages.at(1) == "Too few positional arguments! Missing: argument4");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.wrongUsageMessages.at(0) == "Too few arguments! Missing: argument3");
|
|
|
|
|
ASSERT(tooFewArgumentsMixedTestParser.wrongUsageMessages.at(1) == "Too few arguments! Missing: argument4");
|
|
|
|
|
|
|
|
|
|
delete[] tooFewArgumentsTestParameterList;
|
|
|
|
|
std::cout << "Passed too few positional arguments test." << std::endl;
|
|
|
|
|
std::cout << "Passed too few arguments test." << std::endl;
|
|
|
|
|
|
|
|
|
|
// too many positional arguments
|
|
|
|
|
// too many arguments ##############################################
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::Flag> tooManyArgumentsTestFlags;
|
|
|
|
|
tooManyArgumentsTestFlags.push_back(CLI::Flag('a', "aaaaa", "test flag"));
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::UnpositionalArgument> tooManyArgumentsTestUnpositionalArguments;
|
|
|
|
|
tooManyArgumentsTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('b', "bbbbb", "b", "test argument"));
|
|
|
|
|
tooManyArgumentsTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('c', "ccccc", "c", "test argument"));
|
|
|
|
|
tooManyArgumentsTestUnpositionalArguments.push_back(CLI::UnpositionalArgument('d', "ddddd", "d", "test argument"));
|
|
|
|
|
std::vector<CLI::Option> tooManyArgumentsTestOptions;
|
|
|
|
|
tooManyArgumentsTestOptions.push_back(CLI::Option('b', "bbbbb", "b", "test argument"));
|
|
|
|
|
tooManyArgumentsTestOptions.push_back(CLI::Option('c', "ccccc", "c", "test argument"));
|
|
|
|
|
tooManyArgumentsTestOptions.push_back(CLI::Option('d', "ddddd", "d", "test argument"));
|
|
|
|
|
|
|
|
|
|
std::vector<CLI::PositionalArgument> tooManyArgumentsTestPositionalArguments;
|
|
|
|
|
tooManyArgumentsTestPositionalArguments.push_back(CLI::PositionalArgument("argument0", "test argument"));
|
|
|
|
|
std::vector<CLI::Argument> tooManyArgumentsTestArguments;
|
|
|
|
|
tooManyArgumentsTestArguments.push_back(CLI::Argument("argument0", "test argument"));
|
|
|
|
|
|
|
|
|
|
const char** tooManyArgumentsTestParameterList = new const char*[10];
|
|
|
|
|
tooManyArgumentsTestParameterList[0] = "test";
|
|
|
|
|
tooManyArgumentsTestParameterList[1] = "positional_arg_0";
|
|
|
|
|
tooManyArgumentsTestParameterList[2] = "positional_arg_1";
|
|
|
|
|
tooManyArgumentsTestParameterList[1] = "arg_0";
|
|
|
|
|
tooManyArgumentsTestParameterList[2] = "arg_1";
|
|
|
|
|
tooManyArgumentsTestParameterList[3] = "-a";//
|
|
|
|
|
tooManyArgumentsTestParameterList[4] = "-b";
|
|
|
|
|
tooManyArgumentsTestParameterList[5] = "1";
|
|
|
|
|
tooManyArgumentsTestParameterList[6] = "-c5";
|
|
|
|
|
tooManyArgumentsTestParameterList[7] = "--ddddd";
|
|
|
|
|
tooManyArgumentsTestParameterList[8] = "ddd";
|
|
|
|
|
tooManyArgumentsTestParameterList[9] = "positional_arg_2";
|
|
|
|
|
tooManyArgumentsTestParameterList[9] = "arg_2";
|
|
|
|
|
|
|
|
|
|
int tooManyArgumentsStandaloneTestParameterCount = 3;
|
|
|
|
|
CLI::ArgumentsParser tooManyArgumentsStandaloneTestParser = CLI::ArgumentsParser(tooManyArgumentsStandaloneTestParameterCount, tooManyArgumentsTestParameterList, tooManyArgumentsTestFlags, tooManyArgumentsTestUnpositionalArguments, tooManyArgumentsTestPositionalArguments);
|
|
|
|
|
CLI::ArgumentsParser tooManyArgumentsStandaloneTestParser = CLI::ArgumentsParser(tooManyArgumentsStandaloneTestParameterCount, tooManyArgumentsTestParameterList, tooManyArgumentsTestFlags, tooManyArgumentsTestOptions, tooManyArgumentsTestArguments);
|
|
|
|
|
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getPositionalArgument(0).isError);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getPositionalArgument(0).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getPositionalArgument(0).value == "positional_arg_0");
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getUnpositionalArgument('b').isError);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getUnpositionalArgument('b').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getUnpositionalArgument('b').value == "");
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getUnpositionalArgument('c').isError);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getUnpositionalArgument('c').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getUnpositionalArgument('c').value == "");
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getUnpositionalArgument('d').isError);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getUnpositionalArgument('d').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getUnpositionalArgument('d').value == "");
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getArgument(0).isError);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getArgument(0).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getArgument(0).value == "arg_0");
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getOption('b').isError);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getOption('b').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getOption('b').value == "");
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getOption('c').isError);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getOption('c').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getOption('c').value == "");
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getOption('d').isError);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getOption('d').errorCode == ErrorCodes::NOT_PRESENT);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.getOption('d').value == "");
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.wrongUsageMessages.size() == 1);
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.wrongUsageMessages.at(0) == "Too many positional arguments! Unexpected encounter of: positional_arg_1");
|
|
|
|
|
ASSERT(tooManyArgumentsStandaloneTestParser.wrongUsageMessages.at(0) == "Too many arguments! Unexpected encounter of: arg_1");
|
|
|
|
|
|
|
|
|
|
int tooManyArgumentsMixedTestParameterCount = 10;
|
|
|
|
|
CLI::ArgumentsParser tooManyArgumentsMixedTestParser = CLI::ArgumentsParser(tooManyArgumentsMixedTestParameterCount, tooManyArgumentsTestParameterList, tooManyArgumentsTestFlags, tooManyArgumentsTestUnpositionalArguments, tooManyArgumentsTestPositionalArguments);
|
|
|
|
|
CLI::ArgumentsParser tooManyArgumentsMixedTestParser = CLI::ArgumentsParser(tooManyArgumentsMixedTestParameterCount, tooManyArgumentsTestParameterList, tooManyArgumentsTestFlags, tooManyArgumentsTestOptions, tooManyArgumentsTestArguments);
|
|
|
|
|
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getPositionalArgument(0).isError);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getPositionalArgument(0).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getPositionalArgument(0).value == "positional_arg_0");
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getUnpositionalArgument('b').isError);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getUnpositionalArgument('b').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getUnpositionalArgument('b').value == "1");
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getUnpositionalArgument('c').isError);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getUnpositionalArgument('c').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getUnpositionalArgument('c').value == "5");
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getUnpositionalArgument('d').isError);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getUnpositionalArgument('d').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getUnpositionalArgument('d').value == "ddd");
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getArgument(0).isError);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getArgument(0).errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getArgument(0).value == "arg_0");
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getOption('b').isError);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getOption('b').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getOption('b').value == "1");
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getOption('c').isError);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getOption('c').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getOption('c').value == "5");
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getOption('d').isError);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getOption('d').errorCode == ErrorCodes::WRONG_USAGE);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.getOption('d').value == "ddd");
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.wrongUsageMessages.size() == 2);
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.wrongUsageMessages.at(0) == "Too many positional arguments! Unexpected encounter of: positional_arg_1");
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.wrongUsageMessages.at(1) == "Too many positional arguments! Unexpected encounter of: positional_arg_2");
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.wrongUsageMessages.at(0) == "Too many arguments! Unexpected encounter of: arg_1");
|
|
|
|
|
ASSERT(tooManyArgumentsMixedTestParser.wrongUsageMessages.at(1) == "Too many arguments! Unexpected encounter of: arg_2");
|
|
|
|
|
|
|
|
|
|
delete[] tooManyArgumentsTestParameterList;
|
|
|
|
|
std::cout << "Passed too many positional arguments test." << std::endl;
|
|
|
|
|
std::cout << "Passed too many arguments test." << std::endl;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|