From b1c27ac2103122899c58ce0d533cd656cfec8f62 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 9 Apr 2015 01:41:16 +0200 Subject: [PATCH] Test legal movement of dolphins. There were some unsubstantiated reports of dolphins possibly being able to walk on land, but tests do not confirm this. --- scripts/tests/e2/init.lua | 2 +- scripts/tests/e2/movement.lua | 46 +++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 scripts/tests/e2/movement.lua diff --git a/scripts/tests/e2/init.lua b/scripts/tests/e2/init.lua index 1b436fcef..33cc843ba 100644 --- a/scripts/tests/e2/init.lua +++ b/scripts/tests/e2/init.lua @@ -1,4 +1,4 @@ -- new tests 2015-02-13 require 'tests.e2.shiplanding' require 'tests.e2.e2features' - +require 'tests.e2.movement' diff --git a/scripts/tests/e2/movement.lua b/scripts/tests/e2/movement.lua new file mode 100644 index 000000000..c97fccac7 --- /dev/null +++ b/scripts/tests/e2/movement.lua @@ -0,0 +1,46 @@ +require "lunit" + +module("tests.e2.movement", package.seeall, lunit.testcase) + +function setup() + eressea.free_game() + eressea.settings.set("nmr.removenewbie", "0") + eressea.settings.set("nmr.timeout", "0") + eressea.settings.set("NewbieImmunity", "0") +end + +function test_dolphin_on_land() + local r1 = region.create(0, 0, "plain") + local r2 = region.create(1, 0, "plain") + local f = faction.create("noreply@eressea.de", "human", "de") + local u1 = unit.create(f, r1, 1) + u1.race = "dolphin" + u1:clear_orders() + u1:add_order("NACH O") + process_orders() + assert_equal(r1, u1.region) +end + +function test_dolphin_to_land() + local r1 = region.create(0, 0, "ocean") + local r2 = region.create(1, 0, "plain") + local f = faction.create("noreply@eressea.de", "human", "de") + local u1 = unit.create(f, r1, 1) + u1.race = "dolphin" + u1:clear_orders() + u1:add_order("NACH O") + process_orders() + assert_equal(r2, u1.region) +end + +function test_dolphin_in_ocean() + local r1 = region.create(0, 0, "ocean") + local r2 = region.create(1, 0, "ocean") + local f = faction.create("noreply@eressea.de", "human", "de") + local u1 = unit.create(f, r1, 1) + u1.race = "dolphin" + u1:clear_orders() + u1:add_order("NACH O") + process_orders() + assert_equal(r2, u1.region) +end