From 2e626be090a3a66c9342669bae9399a811d2d3a7 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 16 Feb 2014 00:51:43 +0100 Subject: [PATCH] add a test to make sure that elvenhorses require riding 5 --- core/scripts/tests/common.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/core/scripts/tests/common.lua b/core/scripts/tests/common.lua index cbc529d14..c79f5bd09 100755 --- a/core/scripts/tests/common.lua +++ b/core/scripts/tests/common.lua @@ -48,6 +48,34 @@ function setup() eressea.settings.set("rules.peasants.growth", "1") end +function test_elvenhorse_requires_riding_5() + local r = region.create(0, 0, "plain") + region.create(1, 0, "plain") + local goal = region.create(2, 0, "plain") + local f = faction.create("noreply@eressea.de", "human", "de") + local u = unit.create(f, r, 1) + u:add_item("elvenhorse", 1) + u:set_skill("riding", 5) + u:clear_orders() + u:add_order("NACH O O") + process_orders() + assert_equal(goal, u.region) +end + +function test_cannot_ride_elvenhorse_without_enough_skill() + local r = region.create(0, 0, "plain") + local goal = region.create(1, 0, "plain") + region.create(2, 0, "plain") + local f = faction.create("noreply@eressea.de", "human", "de") + local u = unit.create(f, r, 1) + u:add_item("elvenhorse", 1) + u:set_skill("riding", 4) + u:clear_orders() + u:add_order("NACH O O") + process_orders() + assert_equal(goal, u.region) +end + function test_no_peasant_growth() local r = region.create(0, 0, "plain") r:set_resource("peasant", 2000)