X-Git-Url: https://git.yukkurigames.com/?p=string-lerp.git;a=blobdiff_plain;f=tests%2Fstring-lerp.js;h=f2fb88dc5a46af696d10f8605cea3cd7ca7e6eb1;hp=0a68921793c96ddfe07ea1093c78a9d4fe724e1e;hb=5bc5aa65b769e551177545fda77b31ea6c66467e;hpb=0c13ad2908e977aca58e5411e724881abca7228b diff --git a/tests/string-lerp.js b/tests/string-lerp.js index 0a68921..f2fb88d 100644 --- a/tests/string-lerp.js +++ b/tests/string-lerp.js @@ -152,11 +152,16 @@ JS.Test.describe('numeric lerp', function () { with (this) { it("rounds integers", function () { with (this) { assertEqual("12", lerp("0", "100", 0.123)); - assertEqual("12.3", lerp("0", "100.0", 0.123)); + assertEqual("12.3", lerp("0.0", "100.0", 0.123)); assertEqual("12.3", lerp("0.0", "100", 0.123)); assertEqual("12.3", lerp("0.0", "100.0", 0.123)); }}); + it("thinks about precision", function () { with (this) { + assertEqual("12.30", lerp("0.00", "100.00", 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)); }});