Test failed due to drifting ships

This commit is contained in:
Enno Rehling 2009-12-13 20:11:47 +00:00
parent 3a57fedecb
commit 25bf66e123
4 changed files with 38 additions and 35 deletions

View File

@ -1020,7 +1020,7 @@ get_addresses(report_context * ctx)
ctx->addresses = flist;
}
#define MAXSEEHASH 0x3000
#define MAXSEEHASH 0x1000
seen_region * reuse;
seen_region **

View File

@ -15,38 +15,39 @@ function run_editor()
end
function run_tests()
print("running tests")
require "lunit"
lunit.clearstats()
local argv = tests or {}
local stats = lunit.main(argv)
if stats.errors > 0 or stats.failed > 0 then
return 1
end
return 0
print("running tests")
require "lunit"
lunit.clearstats()
local argv = tests or {}
local stats = lunit.main(argv)
if stats.errors > 0 or stats.failed > 0 then
return 1
end
return 0
end
function run_turn()
require "run-e3a"
-- the locales that this gameworld supports.
local locales = { "de", "en" }
local confirmed_multis = {
}
local suspected_multis = {
"odin"
}
local turn = get_turn()
if turn==0 then
turn = read_turn()
set_turn(turn)
end
orderfile = orderfile or basepath .. '/orders.' .. turn
print("executing turn " .. get_turn() .. " with " .. orderfile)
process(orderfile, confirmed_multis, suspected_multis, locales)
require "run-e3a"
-- the locales that this gameworld supports.
local locales = { "de", "en" }
local confirmed_multis = {
}
local suspected_multis = {
"odin"
}
local turn = get_turn()
if turn==0 then
turn = read_turn()
set_turn(turn)
end
orderfile = orderfile or basepath .. '/orders.' .. turn
print("executing turn " .. get_turn() .. " with " .. orderfile)
local result = process(orderfile, confirmed_multis, suspected_multis, locales)
if result==0 then
dbupdate()
return 0
end
return result
end

View File

@ -191,6 +191,7 @@ function process(orders, confirmed_multis, suspected_multis, locales)
print("could not write game")
return -1
end
return 0
end
--

View File

@ -8,7 +8,8 @@ end
function test_capacity()
local r = region.create(0,0, "ocean")
local r2 = region.create(1,0, "ocean")
region.create(1,0, "ocean")
local r2 = region.create(2,0, "ocean")
local f = faction.create("noreply@eressea.de", "human", "de")
local s1 = ship.create(r, "cutter")
@ -16,20 +17,20 @@ function test_capacity()
u1.ship = s1
u1:set_skill("sailing", 10)
u1:clear_orders()
u1:add_order("NACH O")
u1:add_order("NACH O 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")
u2:add_order("NACH O 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)
assert_not_equal(r2.id, u2.region.id)
end
function test_owners()