diff --git a/tests/test_parse_args.hpp b/tests/test_parse_args.hpp index 91130d2..722e621 100644 --- a/tests/test_parse_args.hpp +++ b/tests/test_parse_args.hpp @@ -82,4 +82,21 @@ TEST_CASE("Parse a double argument with default value", "[parse_args]") { auto arguments = program.get_arguments(); REQUIRE(arguments.size() == 1); REQUIRE(program.get("--ratio") == 3.14); +} + +TEST_CASE("Parse a vector of integer arguments", "[parse_args]") { + argparse::ArgumentParser program("test"); + program.add_argument("--vector") + .nargs(5) + .action([](const std::string& value) { return std::stoi(value); }); + program.parse_args({ "test", "--vector", "1", "2", "3", "4", "5" }); + auto arguments = program.get_arguments(); + REQUIRE(arguments.size() == 1); + auto vector = program.get>("--vector"); + REQUIRE(vector.size() == 5); + REQUIRE(vector[0] == 1); + REQUIRE(vector[1] == 2); + REQUIRE(vector[2] == 3); + REQUIRE(vector[3] == 4); + REQUIRE(vector[4] == 5); } \ No newline at end of file