19#include <boost/test/unit_test.hpp>
33 Options opts{
"Unit Test options [OPTIONS] [COMMAND]"};
36 (
's',
NoOp{},
"ShortOption Description")
37 (
"long_opt",
NoOp{},
"LongOption Description")
48 const string expected{
"Usage: Unit Test options [OPTIONS] [COMMAND]\n"
50 " -o, --option Option Description\n"
51 " -s ShortOption Description\n"
52 " --long_opt LongOption Description\n"
53 " -x Switch Description\n"};
57 const char*
argv[] = {
"executable_name",
"-o",
"123",
"print",
"456"};
67 const char*
argv[] = {
"executable_name",
"-x"};
80 opts(
'l',
"long_option",
Value{
var},
"LongOption Description");
93 opts(
'l',
"long_option",
Value{
var},
"LongOption Description");
95 const char*
argv[] = {
"executable_name",
"--bad",
"123"};
104 opts(
'l',
"long_option",
Value{
var},
"LongOption Description");
106 const char*
argv[] = {
"executable_name",
"-l123",
"456"};
117 opts(
'l',
"long_option",
Value{
var},
"LongOption Description");
119 const char*
argv[] = {
"executable_name",
"-l"};
136 const char*
argv[] = {
"executable_name",
"-v",
"1",
"-s",
"2",
"-m",
"3",
"-m",
"4"};
151 const char*
argv[] = {
"executable_name",
"-s",
"1",
"-s",
"2"};
BOOST_CHECK_EQUAL(v.size(), 10U)
Command-line options parser.
BOOST_AUTO_TEST_CASE(OptionsNormalCase)