forked from github/server
added a test to ensure ship capactiy cannot be exceeded. it fails
This commit is contained in:
parent
de80f1f426
commit
3a57fedecb
|
@ -4,6 +4,16 @@ require "default"
|
||||||
require "spells"
|
require "spells"
|
||||||
require "extensions"
|
require "extensions"
|
||||||
|
|
||||||
|
function run_editor()
|
||||||
|
local turn = get_turn()
|
||||||
|
if turn==0 then
|
||||||
|
turn = read_turn()
|
||||||
|
set_turn(turn)
|
||||||
|
end
|
||||||
|
read_game(turn .. ".dat")
|
||||||
|
gmtool.editor()
|
||||||
|
end
|
||||||
|
|
||||||
function run_tests()
|
function run_tests()
|
||||||
print("running tests")
|
print("running tests")
|
||||||
require "lunit"
|
require "lunit"
|
||||||
|
|
|
@ -197,6 +197,7 @@ end
|
||||||
-- main body of script
|
-- main body of script
|
||||||
--
|
--
|
||||||
function dbupdate()
|
function dbupdate()
|
||||||
|
update_scores()
|
||||||
edb = db.open(basepath.."/eressea.db")
|
edb = db.open(basepath.."/eressea.db")
|
||||||
edb:update_factions()
|
edb:update_factions()
|
||||||
edb:update_scores()
|
edb:update_scores()
|
||||||
|
|
|
@ -2,6 +2,36 @@ require "lunit"
|
||||||
|
|
||||||
module( "e3", package.seeall, lunit.testcase )
|
module( "e3", package.seeall, lunit.testcase )
|
||||||
|
|
||||||
|
function setup()
|
||||||
|
free_game()
|
||||||
|
end
|
||||||
|
|
||||||
|
function test_capacity()
|
||||||
|
local r = region.create(0,0, "ocean")
|
||||||
|
local r2 = region.create(1,0, "ocean")
|
||||||
|
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||||
|
|
||||||
|
local s1 = ship.create(r, "cutter")
|
||||||
|
local u1 = unit.create(f, r, 5)
|
||||||
|
u1.ship = s1
|
||||||
|
u1:set_skill("sailing", 10)
|
||||||
|
u1:clear_orders()
|
||||||
|
u1:add_order("NACH O")
|
||||||
|
|
||||||
|
local s2 = ship.create(r, "cutter")
|
||||||
|
local u2 = unit.create(f, r, 6)
|
||||||
|
u2.ship = s2
|
||||||
|
u2:set_skill("sailing", 10)
|
||||||
|
u2:clear_orders()
|
||||||
|
u2:add_order("NACH O")
|
||||||
|
|
||||||
|
update_owners()
|
||||||
|
process_orders()
|
||||||
|
-- print(s.region, u.region, r2)
|
||||||
|
assert_equal(r2.id, u1.region.id)
|
||||||
|
assert_equal(r.id, u2.region.id)
|
||||||
|
end
|
||||||
|
|
||||||
function test_owners()
|
function test_owners()
|
||||||
free_game()
|
free_game()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
|
|
Loading…
Reference in New Issue