00001 #include "StackedSpectrum.h"
00002 #include "UniformRNG.h"
00003 #include "types.h"
00004 #include "WFunc.h"
00005 #include <iostream>
00006
00007 using namespace std;
00008 int main()
00009 {
00010
00011 const int runs = 100;
00012 const int maxseg = 1000;
00013
00014 UniformRNG Random;
00015
00016 for (int r = 0; r < runs; ++r)
00017 {
00018 const int length = Random.GetNumber(maxseg * 5);
00019 const int seglength = Random.GetNumber(maxseg) +10;
00020 ttsdata Input(length);
00021 tcompdata Spectrum(seglength/2+1);
00022
00023 cout << "Run: " << r << " ";
00024 cout << "Ts lenght: " << length << " Seglength: " << seglength << " ";
00025 bool runok = true;
00026 for (int i = 0; i < length; ++i)
00027 Input.at(i) = Random.GetNumber();
00028 try
00029 {
00030 StackedSpectrum(Input.begin(), Input.end(), Spectrum.begin(),seglength, Hamming());
00031 }
00032 catch(CFatalException &e)
00033 {
00034 cout << e.what() << " ";
00035 runok = false;
00036 }
00037 if (runok)
00038 cout << "Run OK !" << endl;
00039 else
00040 cout << "Run failed !" << endl;
00041 }
00042 cout << "All finished !" << endl;
00043 }