From 950a7b7f9c60555bed691b4e6ae1d31709da673f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 8 Feb 2020 21:49:42 +0100 Subject: [PATCH] fix tests that try to disable mallorn. --- scripts/tests/e2/e2features.lua | 20 ++++++++++++++++++++ scripts/tests/e2/spells.lua | 2 +- scripts/tests/e2/trees.lua | 12 ++++++------ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/scripts/tests/e2/e2features.lua b/scripts/tests/e2/e2features.lua index b0233c3fb..3175a091e 100644 --- a/scripts/tests/e2/e2features.lua +++ b/scripts/tests/e2/e2features.lua @@ -12,6 +12,26 @@ function setup() eressea.settings.set("rules.peasants.growth.factor", "0") end +function disabled_double_default() + local r = region.create(0, 0, "plain") + local f = faction.create("human") + local u = unit.create(f, r, 1) + region.create(1, 0, "plain") + region.create(2, 0, "plain") + region.create(3, 0, "plain") + + u:add_order('NACH O') + u:add_order('DEFAULT "NACH O"') + u:add_order('DEFAULT "DEFAULT ARBEITE"') + process_orders() + assert_equal(1, u.region.x) + process_orders() + assert_equal(2, u.region.x) + process_orders() + assert_equal(2, u.region.x) + assert_equal("ARBEITE", u:get_order()) +end + function test_give_unit() local r = region.create(0, 0, "plain") local f1 = faction.create('elf') diff --git a/scripts/tests/e2/spells.lua b/scripts/tests/e2/spells.lua index 02d2de7cd..8942ee1f5 100644 --- a/scripts/tests/e2/spells.lua +++ b/scripts/tests/e2/spells.lua @@ -3,7 +3,7 @@ require "lunit" module("tests.e2.spells", package.seeall, lunit.testcase) function setup() - eressea.free_game() + eressea.game.reset() eressea.settings.set("nmr.removenewbie", "0") eressea.settings.set("nmr.timeout", "0") eressea.settings.set("NewbieImmunity", "0") diff --git a/scripts/tests/e2/trees.lua b/scripts/tests/e2/trees.lua index 933ae78e0..739d9f1e6 100644 --- a/scripts/tests/e2/trees.lua +++ b/scripts/tests/e2/trees.lua @@ -15,7 +15,7 @@ function test_no_growth() set_turn(204) assert_equal('spring', get_season()) local r = region.create(0, 0, 'plain') - r:set_flag(2, 0) -- no mallorn + r:set_flag(1, false) -- no mallorn r:set_resource('seed', 0) r:set_resource('sapling', 0) r:set_resource('tree', 0) @@ -30,7 +30,7 @@ function test_spring_growth() set_turn(204) assert_equal('spring', get_season()) local r = region.create(0, 0, 'plain') - r:set_flag(2, 0) -- no mallorn + r:set_flag(1, false) -- no mallorn r:set_resource('seed', 6) r:set_resource('sapling', 17) r:set_resource('tree', 0) @@ -46,7 +46,7 @@ function test_plant_fail() assert_equal('summer', get_season()) local f = faction.create('goblin') local r = region.create(0, 0, 'plain') - r:set_flag(2, 0) -- no mallorn + r:set_flag(1, false) -- no mallorn r:set_resource('seed', 0) r:set_resource('sapling', 0) r:set_resource('tree', 0) @@ -67,7 +67,7 @@ function test_plant_summer() assert_equal('summer', get_season()) local f = faction.create('goblin') local r = region.create(0, 0, 'plain') - r:set_flag(2, 0) -- no mallorn + r:set_flag(1, false) -- no mallorn r:set_resource('seed', 0) r:set_resource('sapling', 0) r:set_resource('tree', 0) @@ -89,7 +89,7 @@ function test_plant_spring_saplings() local f = faction.create('goblin') local r = region.create(0, 0, 'plain') local u = unit.create(f, r) - r:set_flag(2, 0) -- no mallorn + r:set_flag(1, false) -- no mallorn r:set_resource('seed', 0) r:set_resource('sapling', 0) r:set_resource('tree', 0) @@ -117,7 +117,7 @@ function test_plant_spring_seeds() local f = faction.create('goblin') local r = region.create(0, 0, 'plain') local u = unit.create(f, r) - r:set_flag(2, 0) -- no mallorn + r:set_flag(1, false) -- no mallorn r:set_resource('seed', 0) r:set_resource('sapling', 0) r:set_resource('tree', 0)