5 int main(
int argc,
char* argv[] )
12 bool parse_successful =
true;
14 std::string test_arg[4];
15 std::string test_title[4];
16 test_arg[0] =
"--method=Name_of_Method"; test_title[0] =
"without Quotes";
17 test_arg[1] =
"--method=\"Name_of_Method\""; test_title[1] =
"with Quotes";
18 test_arg[2] =
"--method=\"Name_of_Method"; test_title[2] =
"with Leading Quote";
19 test_arg[3] =
"--method=Name_of_Method\""; test_title[3] =
"with Trailing Quote";
21 for (
int i=0; i<4; i++) {
24 std::cout <<
"Test "<<i<<
" : CLP - remove_quotes() " << test_title[i] << std::endl;
26 argv[1] = &(test_arg[i][0]);
27 CommandLineProcessor CLP(
true,
true);
29 std::string method_name =
"";
31 CLP.setOption(
"method", &method_name,
"Name of Method");
32 CLP.parse(argc, argv);
35 std::cout <<
"Test "<<i<<
" : CLP - remove_quotes() " << test_title[i] <<
": ";
36 if (method_name !=
"Name_of_Method")
38 parse_successful =
false;
39 if (verbose) std::cout <<
"FAILED" << std::endl;
42 if (verbose) std::cout <<
"PASSED" << std::endl;
44 catch( CommandLineProcessor::UnrecognizedOption &excpt ) {
46 std::cout <<
"*** Caught EXPECTED standard exception : " << excpt.what() << std::endl
47 <<
"Test "<<i<<
" : CLP - remove_quotes() " << test_title[i] <<
": PASSED" << std::endl;
51 std::cout <<
"*** Caught UNEXPECTED unknown exception" << std::endl
52 <<
"Test "<<i<<
" : CLP - remove_quotes() " << test_title[i] <<
": FAILED" << std::endl;
53 parse_successful =
false;
58 if (parse_successful) {
59 std::cout <<
"End Result: TEST PASSED" << std::endl;
63 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.