23 using std::ostringstream;
36 const string myname =
"test_RealDftData: ";
38 cout << myname <<
"NDEBUG must be off." <<
endl;
41 string line =
"-----------------------------";
44 cout << myname << line <<
endl;
45 cout << myname <<
"Create DFT." <<
endl;
48 Index namp = amps.size();
49 Index npha = phas.size();
50 Index nsam = namp + npha - 1;
51 assert( amps.size() == namp );
52 assert( phas.size() == npha );
53 cout << myname <<
"Sample length: " << nsam <<
endl;
55 cout << myname << line <<
endl;
56 cout << myname <<
"Create invalid DFT objects." <<
endl;
58 Dft dftbad1(mynorm, amps, badvals);
59 assert ( ! dftbad1.
size() );
60 Dft dftbad2(mynorm, badvals, phas);
61 assert ( ! dftbad2.size() );
63 cout << myname << line <<
endl;
64 cout << myname <<
"Create DFT object with data." <<
endl;
65 Dft dft(mynorm, amps, phas);
66 cout << myname <<
" # samples: " << dft.
size() <<
endl;
67 cout << myname <<
" Power: " << dft.
power() <<
endl;
73 assert( dft.
nPhase() == npha );
74 assert( dft.
nSample() == nsam );
82 cout << myname << line <<
endl;
83 cout << myname <<
"Copy data out." <<
endl;
90 assert( dft.
nPhase() == npha );
91 assert( dft.
nSample() == nsam );
92 assert( amps1 == amps );
93 assert( phas1 == phas );
96 cout << myname << line <<
endl;
97 cout << myname <<
"Move data out." <<
endl;
102 assert( dft.
size() == 0 );
105 assert( dft.
nPhase() == 0 );
107 assert( amps2 == amps );
108 assert( phas2 == phas );
110 cout << myname << line <<
endl;
111 cout << myname <<
"Done." <<
endl;
118 bool useExistingFcl =
false;
120 string sarg(argv[1]);
121 if ( sarg ==
"-h" ) {
122 cout <<
"Usage: " << argv[0] <<
" [ARG]" <<
endl;
123 cout <<
" If ARG = true, existing FCL file is used." <<
endl;
126 useExistingFcl = sarg ==
"true" || sarg ==
"1";
bool isConsistent() const
int copyOut(FloatVector &s, FloatVector &phas) const
int main(int argc, char *argv[])
virtual bool isValid() const
int test_CompactRealDftData(bool useExistingFcl)
Index nCompact() const override
Q_EXPORT QTSManip setw(int w)
Index nSample() const override
std::vector< F > FloatVector
void line(double t, double *p, double &x, double &y, double &z)
const Norm & normalization() const override
Dft::FloatVector FloatVector
int moveOut(FloatVector &s, FloatVector &phas)
QTextStream & endl(QTextStream &s)