Commit 912457b4 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

libpsdxx [WP][FEATURE]: add test program

parent 99f1d14c
......@@ -20,11 +20,18 @@
#include <iostream>
#include <tfxx/commandline.h>
#include <psdxx/psd.h>
#include <aff/dump.h>
using std::cout;
using std::cerr;
using std::endl;
struct Options
{
bool verbose, logfrequency;
}; // Options
int main(int iargc, char* argv[])
{
......@@ -32,14 +39,14 @@ int main(int iargc, char* argv[])
char usage_text[]=
{
TESTPSDXX_VERSION "\n"
"usage: testpsdxx" "\n"
"usage: testpsdxx [-lf]" "\n"
" or: testpsdxx --help|-h" "\n"
};
// define full help text
char help_text[]=
{
" "
"-lf test function log_frequency"
};
// define commandline options
......@@ -50,6 +57,8 @@ int main(int iargc, char* argv[])
{"help",arg_no,"-"},
// 1: verbose mode
{"v",arg_no,"-"},
// 2: verbose mode
{"lf",arg_no,"-"},
{NULL}
};
......@@ -71,27 +80,22 @@ int main(int iargc, char* argv[])
exit(0);
}
// dummy operation: print option settings
for (int iopt=0; iopt<2; iopt++)
{
cout << "option: '" << options[iopt].opt_string << "'" << endl;
if (cmdline.optset(iopt)) { cout << " option was set"; }
else { cout << "option was not set"; }
cout << endl;
cout << " argument (string): '" << cmdline.string_arg(iopt) << "'" << endl;
cout << " argument (int): '" << cmdline.int_arg(iopt) << "'" << endl;
cout << " argument (long): '" << cmdline.long_arg(iopt) << "'" << endl;
cout << " argument (float): '" << cmdline.float_arg(iopt) << "'" << endl;
cout << " argument (double): '" << cmdline.double_arg(iopt) << "'" << endl;
cout << " argument (bool): '";
if (cmdline.bool_arg(iopt))
{ cout << "true"; } else { cout << "false"; }
cout << "'" << endl;
}
while (cmdline.extra()) { cout << cmdline.next() << endl; }
Options opt;
opt.verbose=cmdline.optset(1);
opt.logfrequency=cmdline.optset(2);
// dummy operation: print rest of command line
while (cmdline.extra()) { cout << cmdline.next() << endl; }
if (opt.logfrequency)
{
cout << "test function log_frequency" << endl;
CODE( psd::TDseries ls1=psd::log_frequency(0.1,100,6) );
DUMP( ls1 );
CODE( ls1=psd::log_frequency(0.1,10000,6) );
DUMP( ls1 );
CODE( ls1=psd::log_frequency(0.1,1000,20) );
DUMP( ls1 );
CODE( ls1=psd::log_frequency(0.1,10000,2) );
DUMP( ls1 );
} // if (opt.logfrequency)
}
/* ----- END OF testpsdxx.cc ----- */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment