14 int main(
int argc,
char* argv[] )
21 bool parse_successful =
true;
23 std::string test_arg[4];
24 std::string test_title[4];
25 test_arg[0] =
"--method=Name_of_Method"; test_title[0] =
"without Quotes";
26 test_arg[1] =
"--method=\"Name_of_Method\""; test_title[1] =
"with Quotes";
27 test_arg[2] =
"--method=\"Name_of_Method"; test_title[2] =
"with Leading Quote";
28 test_arg[3] =
"--method=Name_of_Method\""; test_title[3] =
"with Trailing Quote";
30 for (
int i=0; i<4; i++) {
33 std::cout <<
"Test "<<i<<
" : CLP - remove_quotes() " << test_title[i] << std::endl;
35 argv[1] = &(test_arg[i][0]);
36 CommandLineProcessor CLP(
true,
true);
38 std::string method_name =
"";
40 CLP.setOption(
"method", &method_name,
"Name of Method");
41 CLP.parse(argc, argv);
44 std::cout <<
"Test "<<i<<
" : CLP - remove_quotes() " << test_title[i] <<
": ";
45 if (method_name !=
"Name_of_Method")
47 parse_successful =
false;
48 if (verbose) std::cout <<
"FAILED" << std::endl;
51 if (verbose) std::cout <<
"PASSED" << std::endl;
53 catch( CommandLineProcessor::UnrecognizedOption &excpt ) {
55 std::cout <<
"*** Caught EXPECTED standard exception : " << excpt.what() << std::endl
56 <<
"Test "<<i<<
" : CLP - remove_quotes() " << test_title[i] <<
": PASSED" << std::endl;
60 std::cout <<
"*** Caught UNEXPECTED unknown exception" << std::endl
61 <<
"Test "<<i<<
" : CLP - remove_quotes() " << test_title[i] <<
": FAILED" << std::endl;
62 parse_successful =
false;
67 if (parse_successful) {
68 std::cout <<
"End Result: TEST PASSED" << std::endl;
72 std::cout <<
"End Result: TEST FAILED" << std::endl;
Initialize, finalize, and query the global MPI session.
int main(int argc, char *argv[])
A MPI utilities class, providing methods for initializing, finalizing, and querying the global MPI se...
Basic command line parser for input from (argc,argv[])
Class that helps parse command line input arguments from (argc,argv[]) and set options.