1#ifndef _GLUCAT_CONTROL_H
2#define _GLUCAT_CONTROL_H
72 {
static const control_t c(argc, argv);
return c; }
92 bool print_help =
false;
93 const std::string& arg_0_str = argv[0];
94 const std::string program_name = arg_0_str.substr(arg_0_str.find_last_of(
'/')+1);
95 for (
int arg_ndx = 1; arg_ndx < argc; ++arg_ndx)
97 const std::string& arg_str = argv[arg_ndx];
99 if (arg_str.substr(0,2) ==
"--")
102 const std::string& arg_name = arg_str.substr(2);
103 if (arg_name ==
"help")
108 else if (arg_name ==
"verbose")
110 else if (arg_name ==
"no-catch")
117 std::cout <<
"Invalid argument: " << arg_str << std::endl;
125 std::cout <<
"Usage: " << program_name <<
" [option ...]" << std::endl;
126 std::cout <<
"Options:" << std::endl;
127 std::cout <<
" --help : Print this summary." << std::endl;
128 std::cout <<
" --no-catch : Do not catch exceptions." << std::endl;
129 std::cout <<
" --verbose : Produce more detailed test output." << std::endl;
int call(intfn f) const
Call a function that returns int.
friend class friend_for_private_destructor
static const control_t & control(int argc, char **argv)
bool m_valid
Test parameters are valid.
control_t(int argc, char **argv)
Constructor from program arguments.
control_t(const control_t &)=delete
static bool verbose()
Produce more detailed output from tests.
bool m_catch_exceptions
Catch exceptions.
static bool m_verbose_output
Produce more detailed output from tests.
control_t & operator=(const control_t &)=delete
bool catch_exceptions() const
#define GLUCAT_PACKAGE_NAME
int(* intintfn)(int)
For exception catching: pointer to function of int returning int.
int(* intfn)()
For exception catching: pointer to function returning int.
int try_catch(intfn f)
Exception catching for functions returning int.