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;
68 assert( dft.normalization().isValid() );
69 assert( dft.isValid() );
71 assert( dft.nCompact() == namp );
72 assert( dft.nAmplitude() == namp );
73 assert( dft.nPhase() == npha );
74 assert( dft.nSample() == nsam );
75 assert( dft.normalization().isStandard() );
76 assert( ! dft.normalization().isConsistent() );
77 assert( ! dft.normalization().isBin() );
78 assert( dft.normalization().isUnit() );
79 assert( ! dft.normalization().isPower() );
82 cout << myname << line <<
endl;
83 cout << myname <<
"Copy data out." <<
endl;
85 dft.copyOut(amps1, phas1);
86 assert( dft.isValid() );
88 assert( dft.nCompact() == namp );
89 assert( dft.nAmplitude() == namp );
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;
99 dft.moveOut(amps2, phas2);
100 assert( ! dft.isValid() );
101 assert( dft.normalization().isValid() );
102 assert( dft.size() == 0 );
103 assert( dft.nCompact() == 0 );
104 assert( dft.nAmplitude() == 0 );
105 assert( dft.nPhase() == 0 );
106 assert( dft.nSample() == 0 );
107 assert( amps2 == amps );
108 assert( phas2 == phas );
110 cout << myname << line <<
endl;
111 cout << myname <<
"Done." <<
endl;
void line(double t, double *p, double &x, double &y, double &z)
Dft::FloatVector FloatVector
QTextStream & endl(QTextStream &s)