25 enum class Color { white, gray, black, blue };
30 { Color::black,
"black" },
31 { Color::gray,
"gray",
"grey" }
34 BOOST_TEST(
options.size() == 2U);
37 options.addAlias(Color::white,
"blanche"),
38 OptionSelector_t::UnknownOptionError
41 auto const& opWhite0 =
options.addOption(Color::white,
"white");
42 auto const& opWhite0again =
options.addAlias(Color::white,
"blanche");
43 BOOST_TEST(&opWhite0again == &opWhite0);
44 BOOST_TEST(
options.size() == 3U);
48 BOOST_TEST(
options.hasOption(Color::white));
49 BOOST_TEST(
options.hasOption(Color::gray));
50 BOOST_TEST(!
options.hasOption(Color::blue));
51 BOOST_TEST(
options.hasOption(
"white"));
52 BOOST_TEST(
options.hasOption(
"blanche"));
53 BOOST_TEST(
options.hasOption(
"wHite"));
54 BOOST_TEST(!
options.hasOption(
"blue"));
59 BOOST_TEST(
options.hasOption(opWhite0));
61 auto const opWhite1 =
options.parse(
"white");
62 static_assert(std::is_same_v
63 <std::decay_t<decltype(opWhite1)>, OptionSelector_t::Option_t>
65 BOOST_TEST((opWhite1 == Color::white));
66 BOOST_TEST(opWhite1 ==
"white");
67 BOOST_TEST(opWhite1 == opWhite0);
69 auto const opWhite2 =
options.parse(
"blanche");
70 static_assert(std::is_same_v
71 <std::decay_t<decltype(opWhite2)>, OptionSelector_t::Option_t>
73 BOOST_TEST((opWhite2 == Color::white));
74 BOOST_TEST(opWhite2 ==
"white");
75 BOOST_TEST(opWhite2 ==
"blanche");
76 BOOST_TEST(opWhite2 ==
"Blanche");
77 BOOST_TEST(opWhite2 == opWhite0);
79 auto const opWhite3 =
options.get(
"white");
80 static_assert(std::is_same_v
81 <std::decay_t<decltype(opWhite1)>, OptionSelector_t::Option_t>
83 BOOST_TEST(opWhite3 ==
"white");
88 auto const opGray0 =
options.get(
"gray");
89 static_assert(std::is_same_v
90 <std::decay_t<decltype(opWhite1)>, OptionSelector_t::Option_t>
92 BOOST_TEST(opWhite0 ==
"white");
94 auto const opGray1 =
options.parse(
"gray");
95 static_assert(std::is_same_v
96 <std::decay_t<decltype(opWhite1)>, OptionSelector_t::Option_t>
98 BOOST_TEST((opGray1 == Color::gray));
99 BOOST_TEST(opGray1 ==
"gray");
100 BOOST_TEST(opGray1 ==
"grey");
101 BOOST_TEST(opGray1 == opGray0);
103 Color color = opGray1;
104 BOOST_TEST((color == Color::gray));
109 BOOST_CHECK_THROW(
options.get(
"blue"), OptionSelector_t::UnknownOptionError);
111 (
options.parse(
"blue"), OptionSelector_t::UnknownOptionError);
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker options
Helper to select one among multiple choices via strings.
BEGIN_PROLOG could also be cout