From bdf7411954a7bd20ac2e8480baa6e1a531f3533c Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 18 Mar 2017 10:33:52 +0100 Subject: [PATCH] backfill a test for smithies --- scripts/tests/economy.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/tests/economy.lua b/scripts/tests/economy.lua index 5d98f3f51..a1bfa3bb6 100644 --- a/scripts/tests/economy.lua +++ b/scripts/tests/economy.lua @@ -32,6 +32,25 @@ function test_mine_bonus() assert_equal(80, r:get_resource("iron")) end +function test_smithy_bonus() + local r = region.create(0, 0, "mountain") + local u = unit.create(faction.create("human"), r) + u:set_skill("weaponsmithing", 5) + u:add_item("iron", 20) + u:add_order("MACHE SCHWERT") + process_orders() + assert_equal(1, u:get_item('sword')) + assert_equal(19, u:get_item('iron')) + + u.building = building.create(r, "smithy") + u.building.size = 10 + u:add_item("money", 300) -- maintenance + u:add_item("log", 1) -- maintenance + process_orders() + assert_equal(3, u:get_item('sword')) + assert_equal(18, u:get_item('iron')) +end + function test_no_guards() local r = region.create(0, 0, "plain") r:set_resource("tree", 100)