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 <u.ux-2, u.uy>), 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.
This commit is contained in:
Michael Meyer
2022-08-02 15:39:49 -04:00
committed by Pasi Kallinen
parent 719a85f37c
commit 70008fc684

View File

@@ -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