comparison base/test/TestScaleTickIntervals.h @ 1408:f89365917d02 scale-ticks

These tests now pass, but there's still a lot to be done
author Chris Cannam
date Wed, 03 May 2017 17:02:01 +0100
parents 25ed6dde2ce0
children 21ba60008200
comparison
equal deleted inserted replaced
1407:25ed6dde2ce0 1408:f89365917d02
45 } 45 }
46 46
47 void compareTicks(vector<ScaleTickIntervals::Tick> ticks, 47 void compareTicks(vector<ScaleTickIntervals::Tick> ticks,
48 vector<ScaleTickIntervals::Tick> expected) 48 vector<ScaleTickIntervals::Tick> expected)
49 { 49 {
50 double eps = 1e-7;
50 for (int i = 0; i < int(expected.size()); ++i) { 51 for (int i = 0; i < int(expected.size()); ++i) {
51 if (i < int(ticks.size())) { 52 if (i < int(ticks.size())) {
52 if (ticks[i].label != expected[i].label || 53 if (ticks[i].label != expected[i].label ||
53 ticks[i].value != expected[i].value) { 54 fabs(ticks[i].value - expected[i].value) > eps) {
54 printDiff(ticks, expected); 55 printDiff(ticks, expected);
55 } 56 }
56 QCOMPARE(ticks[i].label, expected[i].label); 57 QCOMPARE(ticks[i].label, expected[i].label);
57 QCOMPARE(ticks[i].value, expected[i].value); 58 QCOMPARE(ticks[i].value, expected[i].value);
58 } 59 }
59 } 60 }
61 if (ticks.size() != expected.size()) {
62 printDiff(ticks, expected);
63 }
60 QCOMPARE(ticks.size(), expected.size()); 64 QCOMPARE(ticks.size(), expected.size());
61 } 65 }
62 66
63 private slots: 67 private slots:
64 void linear_0_1_10() 68 void linear_0_1_10()