Mercurial > hg > qm-dsp
diff tests/TestWindow.cpp @ 476:2de6184b2ce0
Untabify
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Thu, 30 May 2019 18:30:58 +0100 |
parents | a73d94ee8072 |
children |
line wrap: on
line diff
--- a/tests/TestWindow.cpp Thu May 30 18:28:11 2019 +0100 +++ b/tests/TestWindow.cpp Thu May 30 18:30:58 2019 +0100 @@ -16,16 +16,16 @@ using std::cout; using std::endl; -#define COMPARE_ARRAY(a, b) \ +#define COMPARE_ARRAY(a, b) \ for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \ - BOOST_CHECK_SMALL(a[cmp_i] - b[cmp_i], 1e-4); \ + BOOST_CHECK_SMALL(a[cmp_i] - b[cmp_i], 1e-4); \ } void testSymmetric(double *d, int n) { for (int i = 0; i <= n/2; ++i) { - BOOST_CHECK_CLOSE(d[i], d[n-i-1], 1e-10); + BOOST_CHECK_CLOSE(d[i], d[n-i-1], 1e-10); } } @@ -37,12 +37,12 @@ // becomes when generated in periodic mode double d[9]; for (int n = 8; n <= 9; ++n) { - for (int wt = (int)FirstWindow; wt <= (int)LastWindow; ++wt) { - for (int i = 0; i < n; ++i) d[i] = 1.0; - Window<double> w((WindowType)wt, n); - w.cut(d); - testSymmetric(d + 1, n - 1); - } + for (int wt = (int)FirstWindow; wt <= (int)LastWindow; ++wt) { + for (int i = 0; i < n; ++i) d[i] = 1.0; + Window<double> w((WindowType)wt, n); + w.cut(d); + testSymmetric(d + 1, n - 1); + } } } @@ -59,7 +59,7 @@ for (int i = 0; i < N; ++i) d0[i] = 0.5 + (1.0 / (N * 2)) * (i + 1); w.cut(d0, d1); for (int i = 0; i < N; ++i) { - BOOST_CHECK_SMALL(d1[i] - d0[i] * expected[i], 1e-4); + BOOST_CHECK_SMALL(d1[i] - d0[i] * expected[i], 1e-4); } } @@ -90,7 +90,7 @@ testWindow<1>(HammingWindow, e1); double e10[] = { - 0.0800, 0.1679, 0.3979, 0.6821, 0.9121, + 0.0800, 0.1679, 0.3979, 0.6821, 0.9121, 1.0000, 0.9121, 0.6821, 0.3979, 0.1679 }; testWindow<10>(HammingWindow, e10); @@ -179,7 +179,7 @@ for (int i = 0; i < N; ++i) d0[i] = 0.5 + (1.0 / (N * 2)) * (i + 1); w.cut(d0, d1); for (int i = 0; i < N; ++i) { - BOOST_CHECK_SMALL(d1[i] - d0[i] * expected[i], 1e-4); + BOOST_CHECK_SMALL(d1[i] - d0[i] * expected[i], 1e-4); } }