forked from github/server
new directory layout, all tests pass
This commit is contained in:
parent
4e7a758a75
commit
10e7f0dd72
2
eressea
2
eressea
|
@ -1 +1 @@
|
||||||
Subproject commit 6b57791acbe40b46392d178629b9fe805829ea71
|
Subproject commit 2bf3c840aee51bce17302d4140440325ffa4cb36
|
|
@ -10,7 +10,7 @@ locales = de,en
|
||||||
|
|
||||||
[config]
|
[config]
|
||||||
game = eressea
|
game = eressea
|
||||||
source_dir = ../..
|
source_dir = ..
|
||||||
maxnmrs = 10
|
maxnmrs = 10
|
||||||
|
|
||||||
[editor]
|
[editor]
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
local srcpath = config.source_dir
|
local srcpath = config.source_dir
|
||||||
local respath = srcpath .. '/eressea/res'
|
local respath = srcpath .. '/res'
|
||||||
local paths = {
|
local paths = {
|
||||||
|
'scripts/?.lua',
|
||||||
'eressea/scripts/?.lua',
|
'eressea/scripts/?.lua',
|
||||||
'shared/scripts/?.lua',
|
'lunit/?.lua'
|
||||||
'external/lunit/?.lua'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for idx, path in pairs(paths) do
|
for idx, path in pairs(paths) do
|
||||||
|
|
|
@ -10,7 +10,7 @@ locales = de,en
|
||||||
|
|
||||||
[config]
|
[config]
|
||||||
game = e3a
|
game = e3a
|
||||||
source_dir = ../..
|
source_dir = ..
|
||||||
maxnmrs = 10
|
maxnmrs = 10
|
||||||
|
|
||||||
[editor]
|
[editor]
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
local srcpath = config.source_dir
|
local srcpath = config.source_dir
|
||||||
local respath = srcpath .. '/eressea/res'
|
local respath = srcpath .. '/res'
|
||||||
local paths = {
|
local paths = {
|
||||||
|
'scripts/?.lua',
|
||||||
'eressea/scripts/?.lua',
|
'eressea/scripts/?.lua',
|
||||||
'shared/scripts/?.lua',
|
'lunit/?.lua'
|
||||||
'external/lunit/?.lua'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for idx, path in pairs(paths) do
|
for idx, path in pairs(paths) do
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
|
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
|
||||||
<rewriteURI
|
<rewriteURI
|
||||||
uriStartString="eressea:///core/"
|
uriStartString="eressea:///core/"
|
||||||
rewritePrefix="../../shared/res/" />
|
rewritePrefix="../eressea/res/" />
|
||||||
</catalog>
|
</catalog>
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
|
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
|
||||||
<rewriteURI
|
<rewriteURI
|
||||||
uriStartString="eressea:///core/"
|
uriStartString="eressea:///core/"
|
||||||
rewritePrefix="../../shared/res/" />
|
rewritePrefix="../eressea/res/" />
|
||||||
</catalog>
|
</catalog>
|
||||||
|
|
|
@ -28,6 +28,5 @@
|
||||||
<entry spell="deathcloud" level="11" />
|
<entry spell="deathcloud" level="11" />
|
||||||
<entry spell="summondragon" level="11" />
|
<entry spell="summondragon" level="11" />
|
||||||
<entry spell="summonshadowlords" level="12" />
|
<entry spell="summonshadowlords" level="12" />
|
||||||
<entry spell="create_firesword" level="12" />
|
|
||||||
<entry spell="unholypower" level="14" />
|
<entry spell="unholypower" level="14" />
|
||||||
</spellbook>
|
</spellbook>
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
<entry spell="create_aots" level="6" />
|
<entry spell="create_aots" level="6" />
|
||||||
<entry spell="create_bagofholding" level="10" />
|
<entry spell="create_bagofholding" level="10" />
|
||||||
<entry spell="create_dreameye" level="14" />
|
<entry spell="create_dreameye" level="14" />
|
||||||
<entry spell="create_firesword" level="12" />
|
|
||||||
<entry spell="create_focus" level="9" />
|
<entry spell="create_focus" level="9" />
|
||||||
<entry spell="create_potion_ointment" level="6" />
|
<entry spell="create_potion_ointment" level="6" />
|
||||||
<entry spell="create_potion_p0" level="3" />
|
<entry spell="create_potion_p0" level="3" />
|
||||||
|
|
|
@ -5,12 +5,13 @@ require "e3a.markets"
|
||||||
|
|
||||||
local srcpath = config.source_dir
|
local srcpath = config.source_dir
|
||||||
tests = {
|
tests = {
|
||||||
srcpath .. '/shared/scripts/tests/common.lua',
|
srcpath .. '/eressea/scripts/tests/common.lua',
|
||||||
srcpath .. '/shared/scripts/tests/spells.lua',
|
|
||||||
srcpath .. '/shared/scripts/tests/bson.lua',
|
|
||||||
srcpath .. '/eressea/scripts/tests/spells.lua',
|
srcpath .. '/eressea/scripts/tests/spells.lua',
|
||||||
srcpath .. '/eressea/scripts/tests/castles.lua',
|
-- srcpath .. '/eressea/scripts/tests/bson.lua',
|
||||||
srcpath .. '/eressea/scripts/tests/morale.lua',
|
-- srcpath .. '/eressea/scripts/tests/attrib.lua',
|
||||||
srcpath .. '/eressea/scripts/tests/e3a.lua',
|
srcpath .. '/scripts/tests/spells.lua',
|
||||||
srcpath .. '/eressea/scripts/tests/stealth.lua',
|
srcpath .. '/scripts/tests/castles.lua',
|
||||||
|
srcpath .. '/scripts/tests/morale.lua',
|
||||||
|
srcpath .. '/scripts/tests/e3a.lua',
|
||||||
|
srcpath .. '/scripts/tests/stealth.lua',
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,10 @@ require "eressea.ents"
|
||||||
|
|
||||||
local srcpath = config.source_dir
|
local srcpath = config.source_dir
|
||||||
tests = {
|
tests = {
|
||||||
srcpath .. '/shared/scripts/tests/common.lua',
|
srcpath .. '/eressea/scripts/tests/common.lua',
|
||||||
srcpath .. '/shared/scripts/tests/spells.lua',
|
|
||||||
srcpath .. '/shared/scripts/tests/bson.lua',
|
|
||||||
srcpath .. '/eressea/scripts/tests/spells.lua',
|
srcpath .. '/eressea/scripts/tests/spells.lua',
|
||||||
srcpath .. '/eressea/scripts/tests/eressea.lua',
|
-- srcpath .. '/eressea/scripts/tests/bson.lua',
|
||||||
|
srcpath .. '/scripts/tests/spells.lua',
|
||||||
|
srcpath .. '/scripts/tests/spells-e2.lua',
|
||||||
|
srcpath .. '/scripts/tests/eressea.lua',
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require "lunit"
|
require "lunit"
|
||||||
|
|
||||||
module( "castles", package.seeall, lunit.testcase )
|
module("tests.e3.castles", package.seeall, lunit.testcase )
|
||||||
|
|
||||||
function setup()
|
function setup()
|
||||||
free_game()
|
free_game()
|
||||||
|
|
|
@ -1,61 +1,12 @@
|
||||||
require "lunit"
|
require "lunit"
|
||||||
|
|
||||||
module("e3", package.seeall, lunit.testcase)
|
module("tests.e3.e3features", package.seeall, lunit.testcase)
|
||||||
|
|
||||||
function setup()
|
function setup()
|
||||||
free_game()
|
free_game()
|
||||||
settings.set("rules.economy.food", "0")
|
settings.set("rules.economy.food", "0")
|
||||||
end
|
end
|
||||||
|
|
||||||
function has_attrib(u, value)
|
|
||||||
for a in u.attribs do
|
|
||||||
if (a.data==value) then return true end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
function test_attrib_global()
|
|
||||||
a = attrib.create('global', {})
|
|
||||||
write_game('attrib.dat')
|
|
||||||
free_game()
|
|
||||||
read_game('attrib.dat')
|
|
||||||
end
|
|
||||||
|
|
||||||
function test_attrib()
|
|
||||||
local r = region.create(0,0, "plain")
|
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
|
||||||
local u = unit.create(f, r, 1)
|
|
||||||
local u2 = unit.create(f, r, 1)
|
|
||||||
data = { arr = { 'a', 'b', 'c' }, name = 'familiar', events = { die = 'familiar_died' }, data = { mage = u2 } }
|
|
||||||
a = { 'a' }
|
|
||||||
b = { 'a' }
|
|
||||||
uno = u.id
|
|
||||||
u2no = u2.id
|
|
||||||
a = attrib.create(u, 12)
|
|
||||||
a = attrib.create(u, "enno")
|
|
||||||
a = attrib.create(u, u2)
|
|
||||||
a = attrib.create(u, data)
|
|
||||||
write_game("attrib.dat")
|
|
||||||
free_game()
|
|
||||||
read_game("attrib.dat")
|
|
||||||
u = get_unit(uno)
|
|
||||||
u2 = get_unit(u2no)
|
|
||||||
assert_false(has_attrib(u, 42))
|
|
||||||
assert_true(has_attrib(u, "enno"))
|
|
||||||
assert_true(has_attrib(u, 12))
|
|
||||||
|
|
||||||
for a in u.attribs do
|
|
||||||
x = a.data
|
|
||||||
if (type(x)=="table") then
|
|
||||||
assert_equal('a', x.arr[1])
|
|
||||||
assert_equal('familiar', x.name)
|
|
||||||
assert_equal('familiar_died', x.events.die)
|
|
||||||
assert_equal(u2, x.data.mage)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function test_no_stealth()
|
function test_no_stealth()
|
||||||
local r = region.create(0,0, "plain")
|
local r = region.create(0,0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require "lunit"
|
require "lunit"
|
||||||
|
|
||||||
module( "e2", package.seeall, lunit.testcase )
|
module("tests.e3.e2features", package.seeall, lunit.testcase )
|
||||||
|
|
||||||
function setup()
|
function setup()
|
||||||
free_game()
|
free_game()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require "lunit"
|
require "lunit"
|
||||||
|
|
||||||
module( "morale", package.seeall, lunit.testcase )
|
module("tests.e3.morale", package.seeall, lunit.testcase )
|
||||||
|
|
||||||
function setup()
|
function setup()
|
||||||
free_game()
|
free_game()
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
require "lunit"
|
||||||
|
|
||||||
|
module("tests.e3.spells-e2", package.seeall, lunit.testcase)
|
||||||
|
|
||||||
|
local r, f, u
|
||||||
|
|
||||||
|
function setup()
|
||||||
|
free_game()
|
||||||
|
settings.set("magic.regeneration.enable", "0")
|
||||||
|
settings.set("magic.fumble.enable", "0")
|
||||||
|
settings.set("rules.economy.food", "4")
|
||||||
|
|
||||||
|
r = region.create(0, 0, "plain")
|
||||||
|
f = faction.create("spell_payment@eressea.de", "elf", "de")
|
||||||
|
u = unit.create(f, r, 1)
|
||||||
|
u.magic = "gray"
|
||||||
|
u:set_skill("magic", 12)
|
||||||
|
end
|
||||||
|
|
||||||
|
function test_create_magicherbbag()
|
||||||
|
u:add_spell('create_magicherbbag')
|
||||||
|
u:cast_spell('create_magicherbbag')
|
||||||
|
assert_equal(1, u:get_item("magicherbbag"))
|
||||||
|
end
|
||||||
|
|
||||||
|
function test_create_runesword()
|
||||||
|
u:add_spell('create_runesword')
|
||||||
|
u:cast_spell('create_runesword')
|
||||||
|
assert_equal(1, u:get_item("runesword"))
|
||||||
|
end
|
||||||
|
|
||||||
|
function test_create_firesword()
|
||||||
|
u:add_spell("create_firesword")
|
||||||
|
u:cast_spell('create_firesword', 1)
|
||||||
|
assert_equal(1, u:get_item("firesword"))
|
||||||
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require "lunit"
|
require "lunit"
|
||||||
|
|
||||||
module("tests.spells", package.seeall, lunit.testcase)
|
module("tests.e3.spells", package.seeall, lunit.testcase)
|
||||||
|
|
||||||
function setup()
|
function setup()
|
||||||
free_game()
|
free_game()
|
||||||
|
|
|
@ -1,24 +1,21 @@
|
||||||
require "lunit"
|
require "lunit"
|
||||||
|
|
||||||
module("e3-stealth", package.seeall, lunit.testcase)
|
module("tests.e3.stealth", package.seeall, lunit.testcase)
|
||||||
|
|
||||||
function setup_stealth()
|
local f
|
||||||
local result = {}
|
local u
|
||||||
|
|
||||||
|
function setup()
|
||||||
free_game()
|
free_game()
|
||||||
result.r = region.create(0,0, "plain")
|
settings.set("rules.economy.food", "4")
|
||||||
result.f1 = faction.create("noreply@eressea.de", "human", "de")
|
|
||||||
result.f2 = faction.create("noreply@eressea.de", "human", "de")
|
local r = region.create(0,0, "plain")
|
||||||
result.u1 = unit.create(result.f1, result.r, 1)
|
f = faction.create("stealthy@eressea.de", "human", "de")
|
||||||
result.u2 = unit.create(result.f2, result.r, 1)
|
u = unit.create(f, r, 1)
|
||||||
result.u1:add_item("money", 1000)
|
f = faction.create("stealth@eressea.de", "human", "de")
|
||||||
result.u2:add_item("money", 1000)
|
|
||||||
return result
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_stealth_faction_on()
|
function test_stealth_faction_on()
|
||||||
local result = setup_stealth()
|
|
||||||
local f = result.f2
|
|
||||||
local u = result.u1
|
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
u:add_order("TARNEN PARTEI")
|
u:add_order("TARNEN PARTEI")
|
||||||
|
|
||||||
|
@ -29,9 +26,6 @@ function test_stealth_faction_on()
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_stealth_faction_off()
|
function test_stealth_faction_off()
|
||||||
local result = setup_stealth()
|
|
||||||
local f = result.f2
|
|
||||||
local u = result.u1
|
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
u:add_order("TARNEN PARTEI")
|
u:add_order("TARNEN PARTEI")
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
project (server C)
|
project (server C)
|
||||||
|
|
||||||
|
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
|
||||||
|
ELSE(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
MESSAGE(STATUS "Unknown compiler ${CMAKE_C_COMPILER_ID}")
|
||||||
|
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
|
||||||
find_package (Lua51 REQUIRED)
|
find_package (Lua51 REQUIRED)
|
||||||
find_package (LibXml2 REQUIRED)
|
find_package (LibXml2 REQUIRED)
|
||||||
find_package (SQLite3 REQUIRED)
|
find_package (SQLite3 REQUIRED)
|
||||||
|
|
|
@ -2,12 +2,15 @@
|
||||||
#include <util/log.h>
|
#include <util/log.h>
|
||||||
|
|
||||||
#include <kernel/types.h>
|
#include <kernel/types.h>
|
||||||
#include <eressea.h>
|
|
||||||
#include <gmtool.h>
|
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
|
|
||||||
|
#include <eressea.h>
|
||||||
|
#include <gmtool.h>
|
||||||
|
|
||||||
#include "races/races.h"
|
#include "races/races.h"
|
||||||
|
#include "spells/spells.h"
|
||||||
|
#include "curses.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
Loading…
Reference in New Issue