summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/test
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-18 14:44:47 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-18 14:48:42 +0200
commit8a55e19c00efbb990ff2bf072404ad433e97d456 (patch)
tree63bf6d1c8b2bac18d590c6a8d54d6fbc8087aae2 /crawl-ref/source/test
parent6f728490c38e33a675d35b6798fab43ef0ec2455 (diff)
downloadcrawl-ref-8a55e19c00efbb990ff2bf072404ad433e97d456.tar.gz
crawl-ref-8a55e19c00efbb990ff2bf072404ad433e97d456.zip
Be more explicit about why los_maps test fails.
One class of false errors is when a stair gets placed in the LOS map.
Diffstat (limited to 'crawl-ref/source/test')
-rw-r--r--crawl-ref/source/test/los_maps.lua24
1 files changed, 16 insertions, 8 deletions
diff --git a/crawl-ref/source/test/los_maps.lua b/crawl-ref/source/test/los_maps.lua
index f6ac2a2591..09e173ea62 100644
--- a/crawl-ref/source/test/los_maps.lua
+++ b/crawl-ref/source/test/los_maps.lua
@@ -27,16 +27,24 @@ local function test_los_map(map)
local xa = 30 + x
local ya = 30 + y
local p = dgn.point(x, y)
+ local feat = dgn.grid(xa, ya)
local should_see = ((x == 0 and y == 0) or
- dgn.grid(xa, ya) == rock_wall or
- dgn.grid(xa, ya) == floor)
+ feat == rock_wall or
+ feat == floor)
+ local should_not_see = (x ~= 0 or y ~= 0) and
+ (feat == stone_wall or feat == water)
+ if (not (should_see or should_not_see)) then
+ assert(false, "Illegal feature " .. dgn.feature_name(feat) .. " (" ..
+ feat .. ") at " .. p .. " in " .. name .. ".")
+ end
local can_see = you.see_cell(xa, ya)
- if can_see and (not should_see) then
- assert(false, "los error in " .. name .."(iter #" .. checks ..
- "): can see " .. p .. " but shouldn't.")
- elseif (not can_see) and should_see then
- assert(false, "los error in " .. name .. "(iter #" .. checks ..
- "): should see " .. p .. " but can't.")
+ local err = can_see and (not should_see) or (not can_see) and should_see
+ if err then
+ local cans = can_see and "can" or "can't"
+ local shoulds = should_see and "should" or "shouldn't"
+ local errstr = "LOS error in " .. name .. ": " .. shoulds ..
+ " see " .. p .. " (" .. feat .. ") but " .. cans .. "."
+ assert(false, errstr)
end
end
end