Commit 17e012a4 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

tested

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 2142
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 01b04a2e
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id: Makefile,v 1.19 2006-06-29 12:32:46 tforb Exp $
# $Id: Makefile,v 1.20 2006-06-29 12:43:48 tforb Exp $
#
# Copyright (c) 2003 by Thomas Forbriger (BFO Schiltach)
#
......@@ -159,7 +159,8 @@ doxyview: doxyfullview doxybrief
# ---------
tstest: tstest.cc
$(CXX) -o $@ $< -I$(LOCINCLUDEDIR) -ltsxx -laff -L$(LOCLIBDIR)
$(CXX) -o $@ $< -I$(LOCINCLUDEDIR) -ltsxx -laff -L$(LOCLIBDIR) \
-ltfxx -lgsl -lgslcblas
tests: tstest; $<; rm -fv $<
#======================================================================
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: tstest.cc,v 1.3 2006-06-29 07:11:42 tforb Exp $
* $Id: tstest.cc,v 1.4 2006-06-29 12:43:48 tforb Exp $
* \author Thomas Forbriger
* \date 20/12/2003
*
......@@ -37,19 +37,109 @@
#define TSTEST_VERSION \
"TSTEST V1.1 test time series modules"
#define TSTEST_CVSID \
"$Id: tstest.cc,v 1.3 2006-06-29 07:11:42 tforb Exp $"
"$Id: tstest.cc,v 1.4 2006-06-29 12:43:48 tforb Exp $"
#include <iostream>
#include <tsxx.h>
#include <tsxx/tsxx.h>
#include <aff/dump.h>
#include <tsxx/convolve.h>
#include <tsxx/random.h>
using std::cout;
using std::cerr;
using std::endl;
struct Options {
bool convtest1, convtest2;
bool randomnoise;
}; // struct Options
int main(int iargc, char* argv[])
{
// define usage information
char usage_text[]=
{
TSTEST_VERSION "\n"
"usage: tstest [-c1] [-c2] [-r]" "\n"
" or: tstest --help|-h" "\n"
};
// define full help text
char help_text[]=
{
"-c1 convolution test 1" "\n"
"-c2 convolution test 2" "\n"
"-r random noise test" "\n"
"\n"
TSTEST_CVSID
};
// define commandline options
using namespace tfxx::cmdline;
static Declare options[]=
{
// 0: print help
{"help",arg_no,"-"},
// 1: verbose mode
{"v",arg_no,"-"},
// 2: convolution test 1
{"c1",arg_no,"-"},
// 3: convolution test 2
{"c2",arg_no,"-"},
// 4: random noise test
{"r",arg_no,"-"},
{NULL}
};
// no arguments? print usage...
if (iargc<2)
{
cerr << usage_text << endl;
exit(0);
}
// collect options from commandline
Commandline cmdline(iargc, argv, options);
// help requested? print full help text...
if (cmdline.optset(0))
{
cerr << usage_text << endl;
cerr << help_text << endl;
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; }
// dummy operation: print rest of command line
while (cmdline.extra()) { cout << cmdline.next() << endl; }
*/
Options opt;
opt.convtest1=cmdline.optset(2);
opt.convtest2=cmdline.optset(3);
opt.randomnoise=cmdline.optset(4);
if (opt.convtest1)
{
aff::Series<double> a(-2,2), b(-3,3), c, d;
cout << endl;
......@@ -69,6 +159,7 @@ int main(int iargc, char* argv[])
DUMP( ts::convolve(c,d) );
}
if (opt.convtest2)
{
aff::Series<double> a(-2,2), b(-3,3);
cout << endl;
......@@ -79,6 +170,13 @@ int main(int iargc, char* argv[])
DUMP( b );
DUMP( ts::convolve(a,b) );
}
if (opt.randomnoise)
{
cout << "test random noise generation" << endl;
ts::rnd::Tdseries s=ts::rnd::dugauss(30);
DUMP( s );
}
}
/* ----- END OF tstest.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