summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/test
diff options
context:
space:
mode:
authorDarshan Shaligram <dshaligram@users.sourceforge.net>2009-10-18 18:09:22 +0530
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2009-10-18 18:17:47 +0530
commit20499e4d29a0af3143ca2aaa163390d97c04c258 (patch)
tree4506fe40fa455e02bc8ba0dbcf1175e675e5a374 /crawl-ref/source/test
parentebf9ea59c9613529a05e9e8a1b74a5d2d388195b (diff)
downloadcrawl-ref-20499e4d29a0af3143ca2aaa163390d97c04c258.tar.gz
crawl-ref-20499e4d29a0af3143ca2aaa163390d97c04c258.zip
Add test for monster placement.
Adds test/monplace.lua to test placing monsters using the Lua direct monster creation binding (does not exercise all the map code). Allow choosing what tests to run with "crawl -test test1,test2".
Diffstat (limited to 'crawl-ref/source/test')
-rw-r--r--crawl-ref/source/test/monplace.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/crawl-ref/source/test/monplace.lua b/crawl-ref/source/test/monplace.lua
new file mode 100644
index 0000000000..982d5b22ae
--- /dev/null
+++ b/crawl-ref/source/test/monplace.lua
@@ -0,0 +1,24 @@
+-- Monster placement tests.
+
+local place = dgn.point(20, 20)
+
+local function place_monster_on(x, y, monster, feature)
+ dgn.grid(place.x, place.y, feature)
+ return dgn.create_monster(x, y, monster)
+end
+
+local function assert_place_monster_on(monster, feature)
+ dgn.dismiss_monsters()
+ crawl.mpr("Placing " .. monster .. " on " .. feature)
+ assert(place_monster_on(place.x, place.y, monster, feature),
+ "Could not place monster " .. monster .. " on " .. feature)
+end
+
+assert_place_monster_on("quokka", "floor")
+assert_place_monster_on("necrophage", "altar_zin")
+assert_place_monster_on("rat", "shallow water")
+
+-- [ds] One wonders why due has this morbid fetish involving flying
+-- skulls and lava...
+assert_place_monster_on("flying skull", "lava")
+assert_place_monster_on("rock worm", "rock_wall")