From 762f1e467ba0aa2e2aa84db093258bceb652ed1b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 21 Jun 2014 09:17:10 -0700 Subject: [PATCH] integration test for STUDY. --- tests/init.lua | 1 + tests/study.lua | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/study.lua diff --git a/tests/init.lua b/tests/init.lua index e75241ead..b45439c8d 100644 --- a/tests/init.lua +++ b/tests/init.lua @@ -5,4 +5,5 @@ require "tests.config" require "tests.locale" require "tests.regions" require "tests.ships" +require "tests.study" diff --git a/tests/study.lua b/tests/study.lua new file mode 100644 index 000000000..d7c1ab652 --- /dev/null +++ b/tests/study.lua @@ -0,0 +1,33 @@ +require "lunit" + +module("tests.eressea.study", package.seeall, lunit.testcase) + +function setup() + conf = [[{ + "races" : { "human" : {} }, + "terrains" : { "plain" : { "flags" : [ "land" ] } }, + "keywords" : { "de" : { "study": "LERNEN" } }, + "skills" : { "de": { "alchemy" : "Alchemie", "crossbow" : "Armbrust" } } + }]] + eressea.game.reset() + eressea.config.reset(); + eressea.config.parse(conf) +end + +function test_study() + local r = region.create(0, 0, "plain") + local f = faction.create("test@example.com", "human", "de") + local u = unit.create(f, r, 1) + u:add_order("LERNEN Armbrust") + process_orders() + assert_equal(1, u:get_skill("crossbow")) +end + +function dsabled_test_study_expensive() + local r = region.create(0, 0, "plain") + local f = faction.create("test@example.com", "human", "de") + local u = unit.create(f, r, 1) + u:add_order("LERNEN Alchemie") + process_orders() + assert_equal(1, u:get_skill("alchemy")) +end