[complement-svn] SF.net SVN: complement: [1898] trunk/complement/explore/lib/exam/ut/ exam_self_tes
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2008-06-16 10:39:12
|
Revision: 1898 http://complement.svn.sourceforge.net/complement/?rev=1898&view=rev Author: complement Date: 2008-06-16 03:39:08 -0700 (Mon, 16 Jun 2008) Log Message: ----------- Review options, exit status (coupled with options) and coding style. Modified Paths: -------------- trunk/complement/explore/lib/exam/ut/exam_self_test.cc Modified: trunk/complement/explore/lib/exam/ut/exam_self_test.cc =================================================================== --- trunk/complement/explore/lib/exam/ut/exam_self_test.cc 2008-06-16 10:38:45 UTC (rev 1897) +++ trunk/complement/explore/lib/exam/ut/exam_self_test.cc 2008-06-16 10:39:08 UTC (rev 1898) @@ -40,32 +40,43 @@ Opts opts; - opts.addflag('h',"help","print this help message"); - opts.addflag('l',"list","list all test cases"); - opts.add('n',0,"num","run tests by number"); + opts.addflag( 'h', "help", "print this help message" ); + opts.addflag( 'l', "list", "list all test cases" ); + opts.add( 'r', 0, "run", "run tests by number" ); + opts.addflag( 'v', "verbose", "print status of tests within test suite" ); + opts.addflag( 't', "trace", "trace checks" ); - try - { - opts.parse(argc,argv); + try { + opts.parse( argc, argv ); } - catch(...) - { - cout << "there were errors" << endl; + catch (...) { + opts.help( cerr ); + return 1; } - if (opts.is_set('h')) - opts.help(cout); + if ( opts.is_set( 'h' ) ) { + opts.help( cerr ); + return 0; + } - if (opts.is_set('l')) - t.print_graph(cout); + if ( opts.is_set( 'l' ) ) { + t.print_graph( cerr ); + return 0; + } - if (opts.is_set('n')) - { - stringstream ss(opts.get('n')); + if ( opts.is_set( 'v' ) ) { + t.flags( t.flags() | exam::base_logger::verbose ); + } + + if ( opts.is_set( 't' ) ) { + t.flags( t.flags() | exam::base_logger::trace ); + } + + if ( opts.is_set( 'r' ) ) { + stringstream ss( opts.get( 'r' ) ); int n; - while (ss >> n) - { - t.single(n); + while ( ss >> n ) { + t.single( n ); } return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |