use boolean values in E2 config.

add a runtests.bat file for windows developers.
make some tests clean up after themselves (os.remove on files they create).
This commit is contained in:
Enno Rehling 2015-09-11 09:34:38 +02:00
parent c5e14c85a6
commit 1a9dd531c5
6 changed files with 20 additions and 6 deletions

2
.gitignore vendored
View File

@ -41,3 +41,5 @@ Thumbs.db
*.cmd *.cmd
tmp/ tmp/
tests/config.lua tests/config.lua
tests/reports/
tests/data/185.dat

View File

@ -6,21 +6,21 @@
"game.id": 2, "game.id": 2,
"game.name": "Eressea", "game.name": "Eressea",
"NewbieImmunity": 8, "NewbieImmunity": 8,
"modules.wormholes": 1, "modules.wormholes": true,
"entertain.base": 0, "entertain.base": 0,
"entertain.perlevel": 20, "entertain.perlevel": 20,
"nmr.timeout": 5, "nmr.timeout": 5,
"nmr.removenewbie": 0, "nmr.removenewbie": 0,
"GiveRestriction": 3, "GiveRestriction": 3,
"hunger.long": 1, "hunger.long": true,
"init_spells": 0, "init_spells": 0,
"world.era": 2, "world.era": 2,
"seed.population.min": 8, "seed.population.min": 8,
"seed.population.max": 8, "seed.population.max": 8,
"rules.ship.damage_drift": 0.00, "rules.ship.damage_drift": 0.00,
"rules.reserve.twophase": 1, "rules.reserve.twophase": true,
"rules.give.max_men": "-1", "rules.give.max_men": "-1",
"rules.check_overload": 0, "rules.check_overload": false,
"rules.limit.faction": 2500, "rules.limit.faction": 2500,
"rules.maxskills.magic": 5, "rules.maxskills.magic": 5,
"rules.guard.base_stop_prob": 0.30, "rules.guard.base_stop_prob": 0.30,

View File

@ -45,7 +45,7 @@ function test_flags()
eressea.write_game("test.dat") eressea.write_game("test.dat")
eressea.free_game() eressea.free_game()
eressea.read_game("test.dat") eressea.read_game("test.dat")
os.remove('test.dat') os.remove('data/test.dat')
f = get_faction(no) f = get_faction(no)
assert_equal(flags, f.flags) assert_equal(flags, f.flags)
end end
@ -194,6 +194,7 @@ function test_descriptions()
eressea.write_game(filename) eressea.write_game(filename)
eressea.free_game() eressea.free_game()
eressea.read_game(filename) eressea.read_game(filename)
os.remove("data/test.dat")
assert_equal(info, get_ship(sno).info) assert_equal(info, get_ship(sno).info)
assert_equal(info, get_unit(uno).info) assert_equal(info, get_unit(uno).info)
assert_equal(info, get_faction(fno).info) assert_equal(info, get_faction(fno).info)
@ -1081,5 +1082,6 @@ function test_parser()
eressea.read_orders(filename) eressea.read_orders(filename)
process_orders() process_orders()
os.remove(filename)
assert_equal("Goldene Herde", u.name) assert_equal("Goldene Herde", u.name)
end end

View File

@ -104,7 +104,7 @@ function test_process_quit()
eressea.write_game('test.dat') eressea.write_game('test.dat')
eressea.free_game() eressea.free_game()
eressea.read_game('test.dat') eressea.read_game('test.dat')
os.remove('test.dat') os.remove('data/test.dat')
assert_equal(nil, _G.get_faction(fno)) assert_equal(nil, _G.get_faction(fno))
end end

View File

@ -26,6 +26,7 @@ function test_store_unit()
assert_not_nil(store) assert_not_nil(store)
u = store:read_unit() u = store:read_unit()
store:close() store:close()
os.remove(filename)
assert_not_nil(u) assert_not_nil(u)
assert_equal(u:get_item("money"), u.number * 100) assert_equal(u:get_item("money"), u.number * 100)
end end

9
tests/runtests.bat Normal file
View File

@ -0,0 +1,9 @@
@ECHO OFF
SET BUILD=..\build-vs12\eressea\Debug\
SET SERVER=%BUILD%\eressea.exe
%BUILD%\test_eressea.exe
%SERVER% ..\scripts\run-tests.lua
%SERVER% ..\scripts\run-tests-e2.lua
%SERVER% ..\scripts\run-tests-e3.lua
PAUSE
RMDIR /s /q reports