From a5e68e10fec74412c046b78e7132e5ec86e17253 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 20 Apr 2015 15:19:17 +0200 Subject: [PATCH] test for FOLLOW SHIP --- scripts/tests/e2/movement.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/scripts/tests/e2/movement.lua b/scripts/tests/e2/movement.lua index e0c433761..ef62873d8 100644 --- a/scripts/tests/e2/movement.lua +++ b/scripts/tests/e2/movement.lua @@ -53,9 +53,34 @@ function test_follow() local u2 = unit.create(f, r1, 1) u1:clear_orders() u2:clear_orders() + u1:add_item("money", 100) + u2:add_item("money", 100) u1:add_order("NACH O") u2:add_order("FOLGE EINHEIT " .. itoa36(u1.id)) process_orders() assert_equal(u1.region, r2) assert_equal(u2.region, r2) end + +function test_follow_ship() + local r1 = region.create(0, 0, "plain") + region.create(1, 0, "ocean") + region.create(2, 0, "ocean") + local f = faction.create("test@example.com", "human", "de") + local u1 = unit.create(f, r1, 1) + local u2 = unit.create(f, r1, 1) + u1:add_item("money", 100) + u2:add_item("money", 100) + u1.ship = ship.create(r1, "boat") + assert(u1.ship) + u1:set_skill("sailing", 2) + u1:clear_orders() + u1:add_order("NACH O O") + u2.ship = ship.create(r1, "boat") + u2:set_skill("sailing", 2) + u2:clear_orders() + u2:add_order("FOLGE SCHIFF " .. itoa36(u1.ship.id)) + process_orders() + assert_equal(2, u1.region.x) + assert_equal(2, u2.region.x) +end