/** @file
* Test of the CCLAP routines.
*/
#include <iostream>
#include "cclap.h"
int main ( int argc, char *argv[] )
{
bool append = false;
bool verbose;
int time = 5;
std::string filename = "";
bool test_wrap;
cclap::set_version ( "0.1 beta" );
cclap::add_switch ( 'a', "append", "append rather than overwrite the file",
&append );
cclap::add_switch ( 'v', "verbose", "print verbose messages",
&verbose );
cclap::add_value ( 't', "time", "time to run the simulation", &time, false );
cclap::add_argument ( "filename", "name of the file", &filename, true );
cclap::add_switch ( 'w', "test-wrap", "test the word wrapping routine",
&test_wrap );
if ( cclap::arguments_valid ( argc, argv ) )
{
std::cout << "success" << std::endl;
std::cout << "- append = " << append << std::endl;
std::cout << "- verbose = " << verbose << std::endl;
std::cout << "- time = " << time << std::endl;
std::cout << "- filename = " << filename << std::endl;
}
if ( test_wrap )
{
std::cout << "\nTesting the line wrap routine:" << std::endl;
std::string test_string = "really long string that needs to be wrapped"
" a few times to be able to fit into the given"
" space"
" andhereisacompositewordthatwillnotfit into the"
" allocated line length";
std::cout << " "
<< cclap::wrap_string ( test_string, 30, 5 )
<< std::endl;
}
}