add tests for correct castle stage names.

This commit is contained in:
Enno Rehling 2017-04-25 16:47:26 +02:00
parent 8b02c540fd
commit f2d8392206
4 changed files with 74 additions and 3 deletions

View File

@ -0,0 +1,53 @@
require "lunit"
module("tests.e2.buildings", package.seeall, lunit.testcase )
function setup()
eressea.game.reset()
eressea.settings.set("rules.food.flags", "4")
end
function teardown()
eressea.settings.set("rules.food.flags", "0")
end
function test_castle_names()
local r = region.create(0, 0, "plain")
local b = building.create(r, "castle")
assert_equal("site", b:get_typename(1))
assert_equal("tradepost", b:get_typename(2))
assert_equal("tradepost", b:get_typename(9))
assert_equal("fortification", b:get_typename(10))
assert_equal("fortification", b:get_typename(49))
assert_equal("tower", b:get_typename(50))
assert_equal("tower", b:get_typename(249))
assert_equal("castle", b:get_typename(250))
assert_equal("castle", b:get_typename(1249))
assert_equal("fortress", b:get_typename(1250))
assert_equal("fortress", b:get_typename(6249))
assert_equal("citadel", b:get_typename(6250))
end
function test_build_castle_stages()
local r = region.create(0,0, "plain")
local f = faction.create("human")
local u = unit.create(f, r, 1000)
local b = building.create(r, "castle")
u:add_item("stone", 1000)
u:set_skill("building", 1)
u:clear_orders()
u:add_order("MACHE BURG " .. itoa36(b.id))
process_orders()
assert_equal(10, b.size)
u:set_skill("building", 3)
u:clear_orders()
u:add_order("MACHE BURG " .. itoa36(b.id))
process_orders()
assert_equal(250, b.size)
end

View File

@ -1,3 +1,4 @@
require 'tests.e2.buildings'
require 'tests.e2.production' require 'tests.e2.production'
require 'tests.e2.adamantium' require 'tests.e2.adamantium'
require 'tests.e2.undead' require 'tests.e2.undead'

View File

@ -1,6 +1,6 @@
require "lunit" require "lunit"
module("tests.e3.castles", package.seeall, lunit.testcase ) module("tests.e3.buildings", package.seeall, lunit.testcase )
function setup() function setup()
eressea.game.reset() eressea.game.reset()
@ -11,6 +11,23 @@ function teardown()
eressea.settings.set("rules.food.flags", "0") eressea.settings.set("rules.food.flags", "0")
end end
function test_castle_names()
local r = region.create(0, 0, "plain")
local b = building.create(r, "castle")
assert_equal("site", b:get_typename(1))
assert_equal("site", b:get_typename(9))
assert_equal("fortification", b:get_typename(10))
assert_equal("fortification", b:get_typename(49))
assert_equal("tower", b:get_typename(50))
assert_equal("tower", b:get_typename(249))
assert_equal("castle", b:get_typename(250))
assert_equal("castle", b:get_typename(1249))
assert_equal("fortress", b:get_typename(1250))
assert_equal("fortress", b:get_typename(6249))
assert_equal("citadel", b:get_typename(6250))
end
function test_build_watch() function test_build_watch()
local r = region.create(0, 0, "plain") local r = region.create(0, 0, "plain")
local f = faction.create("human", "e3build@eressea.de", "de") local f = faction.create("human", "e3build@eressea.de", "de")
@ -33,7 +50,7 @@ function test_build_watch()
assert_equal(10, u.building.size) assert_equal(10, u.building.size)
end end
function test_watch() function test_watch_names()
local r = region.create(0, 0, "plain") local r = region.create(0, 0, "plain")
local b = building.create(r, "watch") local b = building.create(r, "watch")

View File

@ -1,4 +1,4 @@
require 'tests.e3.castles' require 'tests.e3.buildings'
require 'tests.e3.stealth' require 'tests.e3.stealth'
require 'tests.e3.spells' require 'tests.e3.spells'
require 'tests.e3.rules' require 'tests.e3.rules'