Added better tests for lume.distance()

This commit is contained in:
rxi 2014-03-05 12:22:05 +00:00
parent a08436445d
commit 2699094218

View File

@ -64,11 +64,11 @@ end
-- lume.distance -- lume.distance
tests["lume.distance"] = function() tests["lume.distance"] = function()
testeq( lume.distance(10, 20, 10, 20), 0 ) testeq( lume.distance(15, 20, 15, 20), 0 )
testeq( lume.distance(10, 20, 20, 20), 10 ) testeq( lume.distance(13, 44, 156, 232), 236.205419074 )
local x = lume.distance(1, 2, 5, 7) testeq( lume.distance(-23, 66, -232, 123), 216.633330769 )
testeq( lume.distance(1, 2, 5, 7, true), x * x ) local x = lume.distance(13, 15, -2, 81)
testeq( lume.distance(10, 10, 10, 20, true), 10 * 10 ) testeq( lume.distance(13, 15, -2, 81, true), x * x )
end end
-- lume.angle -- lume.angle
@ -103,7 +103,6 @@ tests["lume.shuffle"] = function()
testeq( lume.shuffle({}), {} ) testeq( lume.shuffle({}), {} )
end end
-- lume.array -- lume.array
tests["lume.array"] = function() tests["lume.array"] = function()
local t = lume.array(pairs({a=0, b=0, c=0})) local t = lume.array(pairs({a=0, b=0, c=0}))