Mercurial > hg > svcore
comparison base/test/TestColumnOp.h @ 1267:1d8418cca63a 3.0-integration
Further column op tests and fixes
author | Chris Cannam |
---|---|
date | Thu, 17 Nov 2016 14:46:03 +0000 |
parents | dd190086db73 |
children | f50c0bbe9096 |
comparison
equal
deleted
inserted
replaced
1266:dd190086db73 | 1267:1d8418cca63a |
---|---|
193 } | 193 } |
194 | 194 |
195 void distribute_simple_interpolated() { | 195 void distribute_simple_interpolated() { |
196 Column in { 1, 2, 3 }; | 196 Column in { 1, 2, 3 }; |
197 BinMapping binfory { 0.0, 0.5, 1.0, 1.5, 2.0, 2.5 }; | 197 BinMapping binfory { 0.0, 0.5, 1.0, 1.5, 2.0, 2.5 }; |
198 Column expected { 1, 1.5, 2, 2.5, 3, 3 }; | 198 // There is a 0.5-bin offset from the distribution you might |
199 // expect, because this corresponds visually to the way that | |
200 // bin values are duplicated upwards in simple_distribution. | |
201 // It means that switching between interpolated and | |
202 // non-interpolated views retains the visual position of each | |
203 // bin peak as somewhere in the middle of the scale area for | |
204 // that bin. | |
205 Column expected { 1, 1, 1.5, 2, 2.5, 3 }; | |
199 Column actual(C::distribute(in, 6, binfory, 0, true)); | 206 Column actual(C::distribute(in, 6, binfory, 0, true)); |
200 report(actual); | 207 report(actual); |
201 QCOMPARE(actual, expected); | 208 QCOMPARE(actual, expected); |
202 } | 209 } |
203 | 210 |
209 report(actual); | 216 report(actual); |
210 QCOMPARE(actual, expected); | 217 QCOMPARE(actual, expected); |
211 } | 218 } |
212 | 219 |
213 void distribute_nonlinear_interpolated() { | 220 void distribute_nonlinear_interpolated() { |
221 // See distribute_simple_interpolated | |
214 Column in { 1, 2, 3 }; | 222 Column in { 1, 2, 3 }; |
215 BinMapping binfory { 0.0, 0.2, 0.5, 1.0, 2.0, 2.5 }; | 223 BinMapping binfory { 0.0, 0.2, 0.5, 1.0, 2.0, 2.5 }; |
216 Column expected { 1, 1.2, 1.5, 2, 3, 3 }; | 224 Column expected { 1, 1, 1, 1.5, 2.5, 3 }; |
217 Column actual(C::distribute(in, 6, binfory, 0, true)); | 225 Column actual(C::distribute(in, 6, binfory, 0, true)); |
218 report(actual); | 226 report(actual); |
219 QCOMPARE(actual, expected); | 227 QCOMPARE(actual, expected); |
220 } | 228 } |
221 | 229 |