6 #include <QtTest/QtTest> 16 void TestCorrelation::cleanupTestCase ()
20 void TestCorrelation::initTestCase ()
27 const bool NO_RESET =
false;
53 void TestCorrelation::loadSinusoid (
double function [],
57 for (
int i = 0; i < n; i++) {
62 function [i] = qSin (x) / x;
67 void TestCorrelation::loadThreeTriangles (
double function [],
71 const int PEAK_SEPARATION = 50, PEAK_HALF_WIDTH = 5;
74 for (
int i = 0; i < n; i++) {
78 if (x > PEAK_HALF_WIDTH) {
81 x = i - (center - PEAK_SEPARATION);
82 if (x > PEAK_HALF_WIDTH) {
85 x = i - (center + PEAK_SEPARATION);
89 if (x < PEAK_HALF_WIDTH) {
92 function [i] = (double) (PEAK_HALF_WIDTH - x) / (double) PEAK_HALF_WIDTH;
101 void TestCorrelation::testShiftSinusoidNonPowerOf2 ()
104 const int INDEX_MAX = 200, INDEX_SHIFT = 50;
107 double function1 [N], function2 [N], correlations [N];
114 loadSinusoid (function1, N, INDEX_MAX);
115 loadSinusoid (function2, N, INDEX_MAX + INDEX_SHIFT);
117 correlation.correlateWithShift (N,
124 QVERIFY ((binStartMax = INDEX_SHIFT));
127 void TestCorrelation::testShiftSinusoidPowerOf2 ()
130 const int INDEX_MAX = 200, INDEX_SHIFT = 50;
133 double function1 [N], function2 [N], correlations [N];
140 loadSinusoid (function1, N, INDEX_MAX);
141 loadSinusoid (function2, N, INDEX_MAX + INDEX_SHIFT);
143 correlation.correlateWithShift (N,
150 QVERIFY ((binStartMax = INDEX_SHIFT));
153 void TestCorrelation::testShiftThreeTrianglesNonPowerOf2 ()
156 const int INDEX_MAX = 200, INDEX_SHIFT = 50;
159 double function1 [N], function2 [N], correlations [N];
166 loadThreeTriangles (function1, N, INDEX_MAX);
167 loadThreeTriangles (function2, N, INDEX_MAX + INDEX_SHIFT);
169 correlation.correlateWithShift (N,
176 QVERIFY ((binStartMax = INDEX_SHIFT));
179 void TestCorrelation::testShiftThreeTrianglesPowerOf2 ()
182 const int INDEX_MAX = 200, INDEX_SHIFT = 50;
185 double function1 [N], function2 [N], correlations [N];
192 loadThreeTriangles (function1, N, INDEX_MAX);
193 loadThreeTriangles (function2, N, INDEX_MAX + INDEX_SHIFT);
195 correlation.correlateWithShift (N,
202 QVERIFY ((binStartMax = INDEX_SHIFT));
const bool NO_GNUPLOT_LOG_FILES
Fast cross correlation between two functions.
Unit tests of fast correlation algorithm.
const bool NO_REGRESSION_IMPORT
const QString NO_EXTRACT_IMAGE_EXTENSION
void initializeLogging(const QString &name, const QString &filename, bool isDebug)
const QStringList NO_LOAD_STARTUP_FILES
const QString NO_REGRESSION_OPEN_FILE
const bool NO_EXPORT_ONLY
const QStringList NO_COMMAND_LINE
const bool NO_DROP_REGRESSION
const QString NO_ERROR_REPORT_LOG_FILE
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
const bool NO_EXTRACT_IMAGE_ONLY