Skip to content

Commit

Permalink
test: GIB Reihenfolge spielt keine Rolle
Browse files Browse the repository at this point in the history
  • Loading branch information
ennorehling committed Dec 8, 2024
1 parent e386bd7 commit a269709
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions scripts/tests/e2/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -913,3 +913,46 @@ function test_reserve_and_give()
assert_equal(9, u2:get_item('cart'))
assert_equal(10, u2:get_item('horse'))
end

function test_give_person_first()
local r = region.create(0, 0, "plain")
local f = faction.create('human')
local u1 = unit.create(f, r, 1)
local u2 = unit.create(f, r, 1)
local u3 = unit.create(f, r, 1)
u3:add_item('sword', 10)
u3:add_order("GIB " .. itoa36(u2.id) .. " ALLES PERSON")
u3:add_order("GIB " .. itoa36(u2.id) .. " ALLES")
process_orders()
assert_equal(2, u2.number)
assert_equal(0, u1:get_item('sword'))
assert_equal(10, u2:get_item('sword'))
end

function test_give_person_last()
local r = region.create(0, 0, "plain")
local f = faction.create('human')
local u1 = unit.create(f, r, 1)
local u2 = unit.create(f, r, 1)
local u3 = unit.create(f, r, 1)
u3:add_item('sword', 10)
u3:add_order("GIB " .. itoa36(u2.id) .. " ALLES")
u3:add_order("GIB " .. itoa36(u2.id) .. " ALLES PERSON")
process_orders()
assert_equal(2, u2.number)
assert_equal(0, u1:get_item('sword'))
assert_equal(10, u2:get_item('sword'))
end

function test_give_person_catchall()
local r = region.create(0, 0, "plain")
local u = unit.create(faction.create('human'), r, 1)
local f = faction.create('human')
local u1 = unit.create(f, r, 1)
local u2 = unit.create(f, r, 1)
local u3 = unit.create(f, r, 1)
u3:add_item('sword', 10)
u3:add_order("GIB 0 ALLES PERSON")
process_orders()
assert_equal(10, u1:get_item('sword'))
end

0 comments on commit a269709

Please sign in to comment.