From f4c20290509d7ed3a8fd5304577e7a4cc0b9d974 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 3 Apr 2007 03:49:53 +0000 Subject: Ok, no code is left in src, it's all in src/old. We'll gradually move code back into src as it's fixed and re-org'd. This includes tests, which, I may write a unit test system into libbu++ just to make my life easier. --- src/old/tests/param.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/old/tests/param.cpp (limited to 'src/old/tests/param.cpp') diff --git a/src/old/tests/param.cpp b/src/old/tests/param.cpp new file mode 100644 index 0000000..a4d2824 --- /dev/null +++ b/src/old/tests/param.cpp @@ -0,0 +1,46 @@ +#include "param.h" +#include + +Param::Param() +{ + addHelpBanner("param - A test of the libbu++ parameter systems\n" + "Enjoy with care and caution\n\nTest stuff:\n"); + addParam( "name", 's', mkproc( Param::printStuff ), &str, "Test a param param" ); + //addParam( "name", &str ); + addParam( "job", 'U', mkproc( Param::printStuff ), "Test a paramless param" ); + + addHelpBanner("\nInformational:\n"); + addParam( "help", mkproc( ParamProc::help ), "Help!" ); + + addHelpBanner("\nThanks for trying my test!\n\n"); +} + +Param::~Param() +{ +} + +int Param::printStuff( int argc, char *argv[] ) +{ + printf("------------%02d-------------\n", argc ); + for( int j = 0; j < argc; j++ ) + { + printf("%d: %s\n", j, argv[j] ); + } + printf("---------------------------\n" ); + printf("SETVAR===\"%s\"\n", str.c_str() ); + + return 1; +} + +int main( int argc, char *argv[] ) +{ + if( argc == 1 ) + { + printf("You have to enter some parameter, try '--help'\n\n"); + return 0; + } + + Param p; + p.process( argc, argv ); +} + -- cgit v1.2.3