comparison base/test/TestScaleTickIntervals.h @ 1410:c4af57d59434 scale-ticks

These tests now pass (in some cases by fixing the tests)
author Chris Cannam
date Wed, 03 May 2017 18:06:48 +0100
parents 21ba60008200
children 1f0d071e7ce6
comparison
equal deleted inserted replaced
1409:21ba60008200 1410:c4af57d59434
85 } 85 }
86 86
87 void linear_0_5_5() 87 void linear_0_5_5()
88 { 88 {
89 auto ticks = ScaleTickIntervals::linear({ 0, 5, 5 }); 89 auto ticks = ScaleTickIntervals::linear({ 0, 5, 5 });
90 vector<ScaleTickIntervals::Tick> expected { 90 // generally if we have some activity in the units column, we
91 { 0, "0" }, 91 // should add .0 to satisfy the human worry that we aren't
92 { 1, "1" }, 92 // being told the whole story...
93 { 2, "2" }, 93 vector<ScaleTickIntervals::Tick> expected {
94 { 3, "3" }, 94 { 0, "0.0" },
95 { 4, "4" }, 95 { 1, "1.0" },
96 { 5, "5" }, 96 { 2, "2.0" },
97 { 3, "3.0" },
98 { 4, "4.0" },
99 { 5, "5.0" },
97 }; 100 };
98 compareTicks(ticks.ticks, expected); 101 compareTicks(ticks.ticks, expected);
99 } 102 }
100 103
101 void linear_0_10_5() 104 void linear_0_10_5()
102 { 105 {
103 auto ticks = ScaleTickIntervals::linear({ 0, 10, 5 }); 106 auto ticks = ScaleTickIntervals::linear({ 0, 10, 5 });
104 vector<ScaleTickIntervals::Tick> expected { 107 vector<ScaleTickIntervals::Tick> expected {
105 { 0, "0" }, 108 { 0, "0.0" },
106 { 2, "2" }, 109 { 2, "2.0" },
107 { 4, "4" }, 110 { 4, "4.0" },
108 { 6, "6" }, 111 { 6, "6.0" },
109 { 8, "8" }, 112 { 8, "8.0" },
110 { 10, "10" } 113 { 10, "10.0" }
111 }; 114 };
112 compareTicks(ticks.ticks, expected); 115 compareTicks(ticks.ticks, expected);
113 } 116 }
114 117
115 void linear_0_0p1_5() 118 void linear_0_0p1_5()
184 187
185 void linear_10000_10010_5() 188 void linear_10000_10010_5()
186 { 189 {
187 auto ticks = ScaleTickIntervals::linear({ 10000, 10010, 5 }); 190 auto ticks = ScaleTickIntervals::linear({ 10000, 10010, 5 });
188 vector<ScaleTickIntervals::Tick> expected { 191 vector<ScaleTickIntervals::Tick> expected {
189 { 10000, "10000" }, 192 { 10000, "10000.0" },
190 { 10002, "10002" }, 193 { 10002, "10002.0" },
191 { 10004, "10004" }, 194 { 10004, "10004.0" },
192 { 10006, "10006" }, 195 { 10006, "10006.0" },
193 { 10008, "10008" }, 196 { 10008, "10008.0" },
194 { 10010, "10010" }, 197 { 10010, "10010.0" },
195 }; 198 };
196 compareTicks(ticks.ticks, expected); 199 compareTicks(ticks.ticks, expected);
197 } 200 }
198 201
199 void linear_10000_20000_5() 202 void linear_10000_20000_5()