comparison base/test/TestScaleTickIntervals.h @ 1413:c6fa111b4553 scale-ticks

Tests now passing
author Chris Cannam
date Thu, 04 May 2017 08:53:00 +0100
parents b7a9edee85e0
children c57994e1edd7
comparison
equal deleted inserted replaced
1412:b7a9edee85e0 1413:c6fa111b4553
227 { 1.0010, "1.0010" } 227 { 1.0010, "1.0010" }
228 }; 228 };
229 compareTicks(ticks.ticks, expected); 229 compareTicks(ticks.ticks, expected);
230 } 230 }
231 231
232 void linear_0p001_1_5()
233 {
234 auto ticks = ScaleTickIntervals::linear({ 0.001, 1, 5 });
235 vector<ScaleTickIntervals::Tick> expected {
236 { 0.1, "0.1" },
237 { 0.3, "0.3" },
238 { 0.5, "0.5" },
239 { 0.7, "0.7" },
240 { 0.9, "0.9" },
241 };
242 compareTicks(ticks.ticks, expected);
243 }
244
232 void linear_10000_10010_5() 245 void linear_10000_10010_5()
233 { 246 {
234 auto ticks = ScaleTickIntervals::linear({ 10000, 10010, 5 }); 247 auto ticks = ScaleTickIntervals::linear({ 10000, 10010, 5 });
235 vector<ScaleTickIntervals::Tick> expected { 248 vector<ScaleTickIntervals::Tick> expected {
236 { 10000, "10000.0" }, 249 { 10000, "10000.0" },
311 324
312 void linear_pi_avogadro_7() 325 void linear_pi_avogadro_7()
313 { 326 {
314 auto ticks = ScaleTickIntervals::linear({ M_PI, 6.022140857e23, 7 }); 327 auto ticks = ScaleTickIntervals::linear({ M_PI, 6.022140857e23, 7 });
315 vector<ScaleTickIntervals::Tick> expected { 328 vector<ScaleTickIntervals::Tick> expected {
316 { 1e+21, "1.0e+21" }, 329 { 1e+21, "1.000e+21" },
317 { 8.7e+22, "8.7e+22" }, 330 { 8.7e+22, "8.700e+22" },
318 { 1.73e+23, "1.73e+23" }, 331 { 1.73e+23, "1.730e+23" },
319 { 2.59e+23, "2.59e+23" }, 332 { 2.59e+23, "2.590e+23" },
320 { 3.45e+23, "3.45e+23" }, 333 { 3.45e+23, "3.450e+23" },
321 { 4.31e+23, "4.31e+23" }, 334 { 4.31e+23, "4.310e+23" },
322 { 5.17e+23, "5.17e+23" }, 335 { 5.17e+23, "5.170e+23" },
323 }; 336 };
324 compareTicks(ticks.ticks, expected); 337 compareTicks(ticks.ticks, expected);
325 } 338 }
326 339
327 void linear_2_3_1() 340 void linear_2_3_1()