From 6326664b86ee1d80e3252dc0325580d5ca362a2f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 28 Oct 2018 21:48:52 +0100 Subject: [PATCH] BUG 2505 proof by test. --- scripts/tests/common.lua | 15 +++++++++++++++ scripts/tests/e2/buildings.lua | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/scripts/tests/common.lua b/scripts/tests/common.lua index 403db0a46..31881ab7a 100644 --- a/scripts/tests/common.lua +++ b/scripts/tests/common.lua @@ -1058,6 +1058,21 @@ function test_give_silver() assert_equal(10, u:get_item("money")) end +function test_build_castle_one_stage() + local r = region.create(0, 0, 'plain') + local f = faction.create('human') + local u = unit.create(f, r, 2) + + u:add_item('stone', 4) + + u:set_skill('building', 1) + u:add_order('MACHE BURG') + + process_orders() + assert_equal(2, u.building.size) + assert_equal(2, u:get_item('stone')) +end + function test_build_castle() local r = region.create(0, 0, "plain") local f = create_faction('human') diff --git a/scripts/tests/e2/buildings.lua b/scripts/tests/e2/buildings.lua index 02298bd97..eb49f0ee2 100644 --- a/scripts/tests/e2/buildings.lua +++ b/scripts/tests/e2/buildings.lua @@ -29,6 +29,21 @@ function test_castle_names() assert_equal("citadel", b:get_typename(6250)) end +function test_build_castle_one_stage() + local r = region.create(0, 0, 'plain') + local f = faction.create('human') + local u = unit.create(f, r, 2) + + u:add_item('stone', 4) + + u:set_skill('building', 1) + u:add_order('MACHE BURG') + + process_orders() + assert_equal(2, u.building.size) + assert_equal(2, u:get_item('stone')) +end + function test_build_castle_stages() local r = region.create(0,0, "plain") local f = faction.create("human")