From 13e4f40ec3e1535f46c2f3293981042af1e2776f Mon Sep 17 00:00:00 2001 From: "Taylor C. Richberger" Date: Thu, 2 Jun 2016 17:08:56 -0600 Subject: allow set use --- test.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test.cxx') diff --git a/test.cxx b/test.cxx index 7822821..b4c451b 100644 --- a/test.cxx +++ b/test.cxx @@ -137,6 +137,16 @@ TEST_CASE("Argument flag lists work as expected", "[args]") REQUIRE((args::get(foo) == std::vector{7, 2, 9, 42})); } +#include + +TEST_CASE("Argument flag lists work with sets", "[args]") +{ + args::ArgumentParser parser("This is a test program.", "This goes after the options."); + args::ValueFlagList> foo(parser, "FOO", "test flag", {'f', "foo"}); + parser.ParseArgs(std::vector{"--foo=7", "-fblah", "-f", "9", "--foo", "blah"}); + REQUIRE((args::get(foo) == std::unordered_set{"7", "9", "blah"})); +} + TEST_CASE("Positional arguments and positional argument lists work as expected", "[args]") { args::ArgumentParser parser("This is a test program.", "This goes after the options."); @@ -152,6 +162,15 @@ TEST_CASE("Positional arguments and positional argument lists work as expected", REQUIRE((args::get(baz) == std::vector{'a', 'b', 'c', 'x', 'y', 'z'})); } +TEST_CASE("Positional lists work with sets", "[args]") +{ + args::ArgumentParser parser("This is a test program.", "This goes after the options."); + args::PositionalList> foo(parser, "FOO", "test positional"); + parser.ParseArgs(std::vector{"foo", "FoO", "bar", "baz", "foo", "9", "baz"}); + REQUIRE((args::get(foo) == std::unordered_set{"foo", "FoO", "bar", "baz", "9"})); +} + + TEST_CASE("Positionals that are unspecified evaluate false", "[args]") { args::ArgumentParser parser("This is a test program.", "This goes after the options."); -- cgit v1.2.1