diff --git a/tests/test_positional_arguments.hpp b/tests/test_positional_arguments.hpp index a5164ac..67a1c8b 100644 --- a/tests/test_positional_arguments.hpp +++ b/tests/test_positional_arguments.hpp @@ -44,7 +44,7 @@ TEST_CASE("Parse positional arguments with optional arguments", "[positional_arg REQUIRE(outputs[1] == "output.mesh"); } -TEST_CASE("Parse positional arguments with optional arguments in the middle", "[parse_args]") { +TEST_CASE("Parse positional arguments with optional arguments in the middle", "[positional_arguments]") { argparse::ArgumentParser program("test"); program.add_argument("input"); program.add_argument("output").nargs(2); @@ -59,4 +59,14 @@ TEST_CASE("Parse positional arguments with optional arguments in the middle", "[ REQUIRE(outputs.size() == 2); REQUIRE(outputs[0] == "thrust_profile.csv"); REQUIRE(outputs[1] == "output.mesh"); +} + +TEST_CASE("Square a number", "[positional_arguments]") { + argparse::ArgumentParser program; + program.add_argument("square") + .help("display a square of a given number") + .action([](const std::string& value) { auto integer = std::stoi(value); return integer * integer; }); + + program.parse_args({"./main", "15"}); + REQUIRE(program.get("square") == 225); } \ No newline at end of file