From 20499e4d29a0af3143ca2aaa163390d97c04c258 Mon Sep 17 00:00:00 2001 From: Darshan Shaligram Date: Sun, 18 Oct 2009 18:09:22 +0530 Subject: 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". --- crawl-ref/source/test/monplace.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 crawl-ref/source/test/monplace.lua (limited to 'crawl-ref/source/test') 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") -- cgit v1.2.3-54-g00ecf