Mercurial > hg > svcore
comparison base/test/TestColumnOp.h @ 1304:7cff8367d9b1 3.0-integration
Add test for last change to ColumnOp
author | Chris Cannam |
---|---|
date | Tue, 29 Nov 2016 08:58:50 +0000 |
parents | f50c0bbe9096 |
children | bd1eb56df8d5 |
comparison
equal
deleted
inserted
replaced
1303:47ee4706055c | 1304:7cff8367d9b1 |
---|---|
20 #include <QObject> | 20 #include <QObject> |
21 #include <QtTest> | 21 #include <QtTest> |
22 #include <QDir> | 22 #include <QDir> |
23 | 23 |
24 #include <iostream> | 24 #include <iostream> |
25 | |
26 //#define REPORT 1 | |
25 | 27 |
26 using namespace std; | 28 using namespace std; |
27 | 29 |
28 class TestColumnOp : public QObject | 30 class TestColumnOp : public QObject |
29 { | 31 { |
250 Column actual(C::distribute(in, 3, binfory, 0, true)); | 252 Column actual(C::distribute(in, 3, binfory, 0, true)); |
251 report(actual); | 253 report(actual); |
252 QCOMPARE(actual, expected); | 254 QCOMPARE(actual, expected); |
253 } | 255 } |
254 | 256 |
255 | 257 void distribute_nonlinear_someshrinking_interpolated() { |
258 // But we *should* interpolate if the mapping involves | |
259 // shrinking some bins but expanding others. See | |
260 // distribute_simple_interpolated for note on 0.5 offset | |
261 Column in { 4, 1, 2, 3, 5, 6 }; | |
262 BinMapping binfory { 0.0, 3.0, 4.0, 4.5 }; | |
263 Column expected { 4.0, 2.5, 4.0, 5.0 }; | |
264 Column actual(C::distribute(in, 4, binfory, 0, true)); | |
265 report(actual); | |
266 QCOMPARE(actual, expected); | |
267 binfory = BinMapping { 0.5, 1.0, 2.0, 5.0 }; | |
268 expected = { 4.0, 2.5, 1.5, 5.5 }; | |
269 actual = (C::distribute(in, 4, binfory, 0, true)); | |
270 report(actual); | |
271 QCOMPARE(actual, expected); | |
272 } | |
256 }; | 273 }; |
257 | 274 |
258 #endif | 275 #endif |
259 | 276 |