some test cases for e2 fixed

This commit is contained in:
Enno Rehling 2009-10-03 13:29:08 +00:00
parent 6c7ae2dea2
commit cc82fc01a9
3 changed files with 43 additions and 19 deletions

View File

@ -1 +1 @@
maxnmrs = 500 maxnmrs = 1000

View File

@ -71,8 +71,12 @@ function process(orders)
plan_monsters() plan_monsters()
local nmrs = get_nmrs(1) local nmrs = get_nmrs(1)
if nmrs >= 80 then -- nmrs = 0
print("Shit. More than 80 factions with 1 NMR (" .. nmrs .. ")") if maxnmrs == nil then
maxnmrs = 80
end
if nmrs >= maxnmrs then
print("Shit. More than " .. maxnmrs .. " factions with 1 NMR (" .. nmrs .. ")")
write_summary() write_summary()
return -1 return -1
end end

View File

@ -749,8 +749,18 @@ function test_storage()
end end
loadscript("extensions.lua") loadscript("extensions.lua")
tests = { e3only = {
["canoe"] = test_canoe,
["morale"] = test_morale,
["owners"] = test_owners,
["taxes"] = test_taxes,
["spells"] = test_spells,
["alliance"] = test_alliance, ["alliance"] = test_alliance,
["leave"] = test_leave,
["market"] = test_market
}
tests = {
["pure"] = test_pure, ["pure"] = test_pure,
["read_write"] = test_read_write, ["read_write"] = test_read_write,
["control"] = test_control, ["control"] = test_control,
@ -761,34 +771,33 @@ tests = {
["message"] = test_message, ["message"] = test_message,
["hashtable"] = test_hashtable, ["hashtable"] = test_hashtable,
["gmtool"] = test_gmtool, ["gmtool"] = test_gmtool,
["leave"] = test_leave,
["events"] = test_events, ["events"] = test_events,
["produce"] = test_produce, ["produce"] = test_produce,
["rename"] = test_rename, ["rename"] = test_rename,
["recruit"] = test_recruit, ["recruit"] = test_recruit,
["recruit2"] = test_recruit2, ["recruit2"] = test_recruit2,
["spells"] = test_spells,
["herbalism"] = test_herbalism, ["herbalism"] = test_herbalism,
["storage"] = test_storage, ["storage"] = test_storage,
["taxes"] = test_taxes,
["mallorn"] = test_mallorn, ["mallorn"] = test_mallorn,
["upkeep"] = test_upkeep, ["upkeep"] = test_upkeep,
["id"] = test_id, ["id"] = test_id,
["work"] = test_work, ["work"] = test_work,
["morale"] = test_morale,
["owners"] = test_owners,
["canoe"] = test_canoe,
["plane"] = test_plane, ["plane"] = test_plane,
["guard"] = test_guard, ["guard"] = test_guard
["market"] = test_market
} }
mytests = { mytests = {
["guard"] = test_guard, ["guard"] = test_guard,
["plane"] = test_plane, ["plane"] = test_plane,
["owners"] = test_owners ["owners"] = test_owners
} }
fail = 0 fail = 0
for k, v in pairs(tests) do
thetests = tests
function test(tests)
for k, v in pairs(tests) do
local status, err = pcall(v) local status, err = pcall(v)
if not status then if not status then
fail = fail + 1 fail = fail + 1
@ -796,8 +805,19 @@ for k, v in pairs(tests) do
else else
print("[OK] " .. k) print("[OK] " .. k)
end end
end
end end
function is_e3()
free_game()
r = region.create(0, 0, "plain")
b = building.create(r, "market")
return b~=nil
end
test(tests)
if is_e3() then test(e3only) end
-- spells_csv() -- spells_csv()
if fail > 0 then if fail > 0 then