Mercurial > hg > svcore
changeset 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 | 47ee4706055c |
children | 9f9f55a8af92 90ac1df228aa |
files | base/test/TestColumnOp.h |
diffstat | 1 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/base/test/TestColumnOp.h Mon Nov 28 18:09:59 2016 +0000 +++ b/base/test/TestColumnOp.h Tue Nov 29 08:58:50 2016 +0000 @@ -23,6 +23,8 @@ #include <iostream> +//#define REPORT 1 + using namespace std; class TestColumnOp : public QObject @@ -252,7 +254,22 @@ QCOMPARE(actual, expected); } - + void distribute_nonlinear_someshrinking_interpolated() { + // But we *should* interpolate if the mapping involves + // shrinking some bins but expanding others. See + // distribute_simple_interpolated for note on 0.5 offset + Column in { 4, 1, 2, 3, 5, 6 }; + BinMapping binfory { 0.0, 3.0, 4.0, 4.5 }; + Column expected { 4.0, 2.5, 4.0, 5.0 }; + Column actual(C::distribute(in, 4, binfory, 0, true)); + report(actual); + QCOMPARE(actual, expected); + binfory = BinMapping { 0.5, 1.0, 2.0, 5.0 }; + expected = { 4.0, 2.5, 1.5, 5.5 }; + actual = (C::distribute(in, 4, binfory, 0, true)); + report(actual); + QCOMPARE(actual, expected); + } }; #endif