summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dat/clua/test.lua
diff options
context:
space:
mode:
authorDarshan Shaligram <dshaligram@users.sourceforge.net>2010-01-05 01:31:26 +0530
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2010-01-05 01:34:27 +0530
commited85466e0202b396bb8d5469d2babd2a24664afc (patch)
treedc8803ffada803a7910d1cea36d96361c916f59d /crawl-ref/source/dat/clua/test.lua
parente88370a40d2cad80bf114500d42291f11dcff5fb (diff)
downloadcrawl-ref-ed85466e0202b396bb8d5469d2babd2a24664afc.tar.gz
crawl-ref-ed85466e0202b396bb8d5469d2babd2a24664afc.zip
Fix Shoal:$ generation bugs: stairs could be surrounded by deep water, hut entrances could be blocked by rock.
shoal-hut.lua test generates 1k Shoal:$ levels and verifies that the levels pass sanity tests.
Diffstat (limited to 'crawl-ref/source/dat/clua/test.lua')
-rw-r--r--crawl-ref/source/dat/clua/test.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/crawl-ref/source/dat/clua/test.lua b/crawl-ref/source/dat/clua/test.lua
new file mode 100644
index 0000000000..404b2e1d1f
--- /dev/null
+++ b/crawl-ref/source/dat/clua/test.lua
@@ -0,0 +1,23 @@
+-- Support code used primarily for tests. This is loaded only when running
+-- tests, not during normal Crawl execution.
+
+util.namespace('test')
+
+test.FAILMAP = 'level-fail.map'
+
+function test.map_assert(condition, message)
+ if not condition then
+ debug.dump_map(test.FAILMAP)
+ assert(false, message .. " (map dumped to " .. test.FAILMAP .. ")")
+ end
+ return condition
+end
+
+function test.regenerate_level(place)
+ if place then
+ debug.goto_place(place)
+ end
+ debug.flush_map_memory()
+ dgn.reset_level()
+ debug.generate_level()
+end \ No newline at end of file