testpsdxx.cc 2.08 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*! \file testpsdxx.cc
 * \brief test library functions
 * 
 * ----------------------------------------------------------------------------
 * 
 * \author Thomas Forbriger
 * \date 10/01/2019
 * 
 * test library functions
 * 
 * Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach) 
 * 
 * REVISIONS and CHANGES 
 *  - 10/01/2019   V1.0   Thomas Forbriger
 * 
 * ============================================================================
 */
#define TESTPSDXX_VERSION \
  "TESTPSDXX   V1.0   test library functions"

#include <iostream>
#include <tfxx/commandline.h>
23
24
#include <psdxx/psd.h>
#include <aff/dump.h>
25
26
27
28
29

using std::cout;
using std::cerr;
using std::endl;

30
31
32
33
34
struct Options
{
  bool verbose, logfrequency;
}; // Options

35
36
37
38
39
40
41
int main(int iargc, char* argv[])
{

  // define usage information
  char usage_text[]=
  {
    TESTPSDXX_VERSION "\n"
42
    "usage: testpsdxx [-lf]" "\n"
43
44
45
46
47
48
    "   or: testpsdxx --help|-h" "\n"
  };

  // define full help text
  char help_text[]=
  {
49
    "-lf    test function log_frequency"
50
51
52
53
54
55
56
57
58
59
  };

  // define commandline options
  using namespace tfxx::cmdline;
  static Declare options[]= 
  {
    // 0: print help
    {"help",arg_no,"-"},
    // 1: verbose mode
    {"v",arg_no,"-"},
60
61
    // 2: verbose mode
    {"lf",arg_no,"-"},
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
    {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);
  }

83
84
85
  Options opt;
  opt.verbose=cmdline.optset(1);
  opt.logfrequency=cmdline.optset(2);
86

87
88
89
90
91
92
93
94
95
96
97
98
  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)
99
100
101
}

/* ----- END OF testpsdxx.cc ----- */