From 745875139b5ee46e469927d410364bfeeedb2995 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 11 Oct 2006 15:47:45 +0000 Subject: Despite some svn oddness, I'm now moving to a new setup for the tests, that's very much like the original one, but now using build. You will need the latest build in order to build the tests. --- src/tests/param/param.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/tests/param/param.h | 21 +++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 src/tests/param/param.cpp create mode 100644 src/tests/param/param.h (limited to 'src/tests/param') diff --git a/src/tests/param/param.cpp b/src/tests/param/param.cpp new file mode 100644 index 0000000..a4d2824 --- /dev/null +++ b/src/tests/param/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 ); +} + diff --git a/src/tests/param/param.h b/src/tests/param/param.h new file mode 100644 index 0000000..2756b69 --- /dev/null +++ b/src/tests/param/param.h @@ -0,0 +1,21 @@ +#ifndef PARAM_H +#define PARAM_H + +#include + +#include "paramproc.h" + +class Param : public ParamProc +{ +public: + Param(); + virtual ~Param(); + +private: + int printStuff( int argc, char *argv[] ); + + std::string str; + uint32_t uint32; +}; + +#endif -- cgit v1.2.3