forked from github/server
test learning and teaching, eliminate randomness
This commit is contained in:
parent
21eef2159b
commit
8000b9bb2b
|
@ -4,42 +4,45 @@ module( "e2", package.seeall, lunit.testcase )
|
||||||
|
|
||||||
function setup()
|
function setup()
|
||||||
free_game()
|
free_game()
|
||||||
|
settings.set("nmr.timeout", "0")
|
||||||
|
settings.set("rules.economy.food", "4")
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_learn()
|
function test_learn()
|
||||||
local r = region.create(0, 0, "plain")
|
settings.set("study.random_progress", "0")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local r = region.create(0, 0, "plain")
|
||||||
f.age = 20
|
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||||
local u = unit.create(f, r)
|
f.age = 20
|
||||||
u:add_item("money", 1000)
|
local u = unit.create(f, r)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
u:add_order("@LERNEN Reiten")
|
u:add_order("@LERNEN Reiten")
|
||||||
process_orders()
|
process_orders()
|
||||||
assert_equal(1, u:get_skill("riding"))
|
assert_equal(1, u:get_skill("riding"))
|
||||||
process_orders()
|
process_orders()
|
||||||
process_orders()
|
process_orders()
|
||||||
process_orders()
|
assert_equal(2, u:get_skill("riding"))
|
||||||
process_orders()
|
process_orders()
|
||||||
assert_true(2<=u:get_skill("riding"))
|
process_orders()
|
||||||
|
process_orders()
|
||||||
|
assert_equal(3, u:get_skill("riding"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_teach()
|
function test_teach()
|
||||||
local r = region.create(0, 0, "plain")
|
settings.set("study.random_progress", "0")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local r = region.create(0, 0, "plain")
|
||||||
f.age = 20
|
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||||
local u = unit.create(f, r, 10)
|
f.age = 20
|
||||||
local u2 = unit.create(f, r)
|
local u = unit.create(f, r, 10)
|
||||||
u:add_item("money", 1000)
|
local u2 = unit.create(f, r)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
u:add_order("@LERNEN reiten")
|
u:add_order("@LERNEN reiten")
|
||||||
u2:clear_orders()
|
u2:clear_orders()
|
||||||
u2:add_order("LEHREN " .. itoa36(u.id))
|
u2:add_order("LEHREN " .. itoa36(u.id))
|
||||||
u2:set_skill("riding", 4)
|
u2:set_skill("riding", 4)
|
||||||
process_orders()
|
process_orders()
|
||||||
assert_equal(1, u:get_skill("riding"))
|
assert_equal(1, u:get_skill("riding"))
|
||||||
process_orders()
|
process_orders()
|
||||||
process_orders()
|
assert_equal(2, u:get_skill("riding"))
|
||||||
assert_true(2<=u:get_skill("riding"))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_rename()
|
function test_rename()
|
||||||
|
@ -115,6 +118,7 @@ function test_ship_capacity()
|
||||||
u4:add_order("NACH O O")
|
u4:add_order("NACH O O")
|
||||||
|
|
||||||
process_orders()
|
process_orders()
|
||||||
|
|
||||||
-- print(s.region, u.region, r2)
|
-- print(s.region, u.region, r2)
|
||||||
assert_equal(r2.id, u1.region.id, "boat with 5 humans did not move")
|
assert_equal(r2.id, u1.region.id, "boat with 5 humans did not move")
|
||||||
assert_not_equal(r2.id, u2.region.id, "boat with too many people has moved")
|
assert_not_equal(r2.id, u2.region.id, "boat with too many people has moved")
|
||||||
|
|
Loading…
Reference in New Issue