From 70008fc684a34d4cb862476243d833eb464b8644 Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Tue, 2 Aug 2022 15:39:49 -0400 Subject: [PATCH] Fix: movement tests Movement tests weren't working because terrain was being positioned one square to the left of where it was expected, and the error message printed something other than the expected coordinates. I wasn't able to figure out why they were like this in the first place (referring to one spot to the left of the hero with ), so it's quite possible that I am missing some context here, but the test failed consistently for me before making these changes, and now works. --- test/testmove.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/testmove.lua b/test/testmove.lua index 12d4a61ee..39aa5b7b2 100644 --- a/test/testmove.lua +++ b/test/testmove.lua @@ -28,11 +28,11 @@ function meta(key) end function setup1(param) - des.terrain(POS.x - 2, POS.y, param); + des.terrain(POS.x - 1, POS.y, param); end function setup2(param) - des.terrain(POS.x + 15, POS.y, param); + des.terrain(POS.x + 16, POS.y, param); end function setup3(param) @@ -166,7 +166,7 @@ for k, v in pairs(basicmoves) do if (v.dx ~= nil) then if (not ((x == (u.ux - v.dx)) and (y == (u.uy - v.dy)))) then error(string.format("Move: key '%s' gave (%i,%i), should have been (%i,%i)", - key, u.ux, u.uy, u.ux - v.dx, u.uy - v.dy)); + key, u.ux, u.uy, x + v.dx, y + v.dy)); return; end elseif (v.x ~= nil) then