X-Git-Url: https://git.yukkurigames.com/?p=string-lerp.git;a=blobdiff_plain;f=tests%2Fstring-lerp.js;h=2eccba65491a1a1878fcd66fe55f04452be413a5;hp=0a68921793c96ddfe07ea1093c78a9d4fe724e1e;hb=d9344ccd68dbe21eb5af6d0575b5b84b9f8513aa;hpb=0c13ad2908e977aca58e5411e724881abca7228b diff --git a/tests/string-lerp.js b/tests/string-lerp.js index 0a68921..2eccba6 100644 --- a/tests/string-lerp.js +++ b/tests/string-lerp.js @@ -157,6 +157,12 @@ JS.Test.describe('numeric lerp', function () { with (this) { assertEqual("12.3", lerp("0.0", "100.0", 0.123)); }}); + it("thinks about precision", function () { with (this) { + assertEqual("12.30", lerp("0", "100.00", 0.123)); + assertEqual("12.30", lerp("0.00", "100", 0.123)); + assertEqual("12.300", lerp("0.000", "100.000", 0.123)); + }}); + it("computes parameters outside [0, 1]", function () { with (this) { assertEqual("Giving 110%", lerp("Giving 0%", "Giving 100%", 1.1)); }});