comparison base/test/TestScaleTickIntervals.h @ 1414:c57994e1edd7 scale-ticks

Add logarithmic ticks. This is getting complicated!
author Chris Cannam
date Thu, 04 May 2017 10:14:56 +0100
parents c6fa111b4553
children 12316a9bcc8f
comparison
equal deleted inserted replaced
1413:c6fa111b4553 1414:c57994e1edd7
453 auto ticks = ScaleTickIntervals::linear({ 0, 1, -1 }); 453 auto ticks = ScaleTickIntervals::linear({ 0, 1, -1 });
454 vector<ScaleTickIntervals::Tick> expected { 454 vector<ScaleTickIntervals::Tick> expected {
455 }; 455 };
456 compareTicks(ticks.ticks, expected); 456 compareTicks(ticks.ticks, expected);
457 } 457 }
458
459 void log_1_10_2()
460 {
461 auto ticks = ScaleTickIntervals::logarithmic({ 1, 10, 2 });
462 vector<ScaleTickIntervals::Tick> expected {
463 { 1.0, "1.0" },
464 { pow(10.0, 0.5), "3.2" },
465 { 10.0, "10.0" },
466 };
467 compareTicks(ticks.ticks, expected);
468 }
469
470 void log_0_10_2()
471 {
472 auto ticks = ScaleTickIntervals::logarithmic({ 0, 10, 2 });
473 vector<ScaleTickIntervals::Tick> expected {
474 { 1e-10, "1.0e-10" },
475 { pow(10.0, -4.5), "3.2e-05" },
476 { 10.0, "1.0e+01" },
477 };
478 compareTicks(ticks.ticks, expected);
479 }
458 }; 480 };
459 481
460 #endif 482 #endif
461 483
462 484