Mercurial > hg > svcore
diff 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 |
line wrap: on
line diff
--- a/base/test/TestScaleTickIntervals.h Thu May 04 08:53:00 2017 +0100 +++ b/base/test/TestScaleTickIntervals.h Thu May 04 10:14:56 2017 +0100 @@ -455,6 +455,28 @@ }; compareTicks(ticks.ticks, expected); } + + void log_1_10_2() + { + auto ticks = ScaleTickIntervals::logarithmic({ 1, 10, 2 }); + vector<ScaleTickIntervals::Tick> expected { + { 1.0, "1.0" }, + { pow(10.0, 0.5), "3.2" }, + { 10.0, "10.0" }, + }; + compareTicks(ticks.ticks, expected); + } + + void log_0_10_2() + { + auto ticks = ScaleTickIntervals::logarithmic({ 0, 10, 2 }); + vector<ScaleTickIntervals::Tick> expected { + { 1e-10, "1.0e-10" }, + { pow(10.0, -4.5), "3.2e-05" }, + { 10.0, "1.0e+01" }, + }; + compareTicks(ticks.ticks, expected); + } }; #endif