forked from github/server
Merge pull request #96 from badgerman/bug-1882
functional tests for orders with more than one name
This commit is contained in:
commit
eb5c912805
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"keywords": {
|
||||
"en" : {
|
||||
"grow": [ "GROW", "BREED", "PLANT" ],
|
||||
"combat": [ "COMBAT", "FIGHT" ]
|
||||
},
|
||||
"de": {
|
||||
|
@ -51,7 +52,7 @@
|
|||
"cast": ["ZAUBERE", "ZAUBERN"],
|
||||
"show": ["ZEIGE", "ZEIGEN"],
|
||||
"destroy": ["ZERSTÖRE", "ZERSTÖREN"],
|
||||
"grow": ["ZÜCHTE", "ZÜCHTEN"],
|
||||
"grow": ["ZÜCHTE", "PFLANZE", "ZÜCHTEN", "PFLANZEN"],
|
||||
"default": "DEFAULT",
|
||||
"origin": "URSPRUNG",
|
||||
"email": "EMAIL",
|
||||
|
@ -59,7 +60,6 @@
|
|||
"group": "GRUPPE",
|
||||
"sort": ["SORTIERE", "SORTIEREN"],
|
||||
"prefix": "PRÄFIX",
|
||||
"plant": ["PFLANZE", "PFLANZEN"],
|
||||
"alliance": "ALLIANZ",
|
||||
"claim": ["BEANSPRUCHE", "BEANSPRUCHEN"],
|
||||
"promote": ["BEFÖRDERE", "BEFÖRDERUNG"],
|
||||
|
|
|
@ -1496,9 +1496,6 @@
|
|||
<string name="pay">
|
||||
<text locale="en">PAY</text>
|
||||
</string>
|
||||
<string name="plant">
|
||||
<text locale="en">PLANT</text>
|
||||
</string>
|
||||
<string name="piracy">
|
||||
<text locale="en">PIRACY</text>
|
||||
</string>
|
||||
|
@ -1568,9 +1565,6 @@
|
|||
<string name="destroy">
|
||||
<text locale="en">DESTROY</text>
|
||||
</string>
|
||||
<string name="grow">
|
||||
<text locale="en">GROW</text>
|
||||
</string>
|
||||
<string name="loot">
|
||||
<text locale="en">loot</text>
|
||||
</string>
|
||||
|
|
|
@ -2,3 +2,4 @@ require 'tests.e3.castles'
|
|||
require 'tests.e3.stealth'
|
||||
require 'tests.e3.spells'
|
||||
require 'tests.e3.rules'
|
||||
require 'tests.e3.parser'
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
require 'lunit'
|
||||
|
||||
module('tests.e3.parser', package.seeall, lunit.testcase)
|
||||
|
||||
function setup()
|
||||
eressea.game.reset()
|
||||
end
|
||||
|
||||
function test_set_status_en()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("bug_1882@eressea.de", "human", "en")
|
||||
local u = unit.create(f, r, 1)
|
||||
u.status = 1
|
||||
u:clear_orders()
|
||||
u:add_order("COMBAT AGGRESSIVE")
|
||||
process_orders()
|
||||
assert_equal(u.status, 0)
|
||||
u.status = 1
|
||||
u:add_order("FIGHT AGGRESSIVE")
|
||||
process_orders()
|
||||
assert_equal(u.status, 0)
|
||||
end
|
||||
|
||||
function test_set_status_de()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("bug_1882@eressea.de", "human", "de")
|
||||
local u = unit.create(f, r, 1)
|
||||
u.status = 1
|
||||
u:clear_orders()
|
||||
u:add_order("KAEMPFE AGGRESSIV")
|
||||
process_orders()
|
||||
assert_equal(u.status, 0)
|
||||
end
|
||||
|
||||
function test_breed_horses()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("bug_1886@eressea.de", "human", "en")
|
||||
local u = unit.create(f, r, 1)
|
||||
local b = building.create(r, "stables")
|
||||
b.size = 10
|
||||
u.building = b
|
||||
u:add_item("horse", 2)
|
||||
u:add_item("money", 2000)
|
||||
u:set_skill("training", 100) -- 100% chance to duplicate each horse
|
||||
u:clear_orders()
|
||||
u:add_order("GROW horses")
|
||||
process_orders()
|
||||
assert_equal(4, u:get_item("horse"))
|
||||
u:clear_orders()
|
||||
u:add_order("BREED horses")
|
||||
process_orders()
|
||||
assert_equal(8, u:get_item("horse"))
|
||||
u:clear_orders()
|
||||
u:add_order("PLANT horses")
|
||||
process_orders()
|
||||
assert_equal(16, u:get_item("horse"))
|
||||
end
|
|
@ -3270,7 +3270,6 @@ void produce(struct region *r)
|
|||
sabotage_cmd(u, u->thisorder);
|
||||
break;
|
||||
|
||||
case K_PLANT:
|
||||
case K_BREED:
|
||||
breed_cmd(u, u->thisorder);
|
||||
break;
|
||||
|
|
|
@ -408,7 +408,6 @@ bool is_repeated(const order * ord)
|
|||
case K_TEACH:
|
||||
case K_BREED:
|
||||
case K_PIRACY:
|
||||
case K_PLANT:
|
||||
case K_MAKE:
|
||||
case K_LOOT:
|
||||
case K_DESTROY:
|
||||
|
@ -450,7 +449,6 @@ bool is_exclusive(const order * ord)
|
|||
case K_TEACH:
|
||||
case K_BREED:
|
||||
case K_PIRACY:
|
||||
case K_PLANT:
|
||||
case K_MAKE:
|
||||
case K_LOOT:
|
||||
case K_DESTROY:
|
||||
|
@ -495,7 +493,6 @@ bool is_long(const order * ord)
|
|||
case K_TEACH:
|
||||
case K_BREED:
|
||||
case K_PIRACY:
|
||||
case K_PLANT:
|
||||
case K_MAKE:
|
||||
case K_LOOT:
|
||||
case K_DESTROY:
|
||||
|
|
|
@ -168,8 +168,9 @@ static unit *unitorders(FILE * F, int enc, struct faction *f)
|
|||
|
||||
if (s[0]) {
|
||||
if (s[0] != '@') {
|
||||
char token[128];
|
||||
const char *stok = s;
|
||||
stok = parse_token_depr(&stok);
|
||||
stok = parse_token(&stok, token, sizeof(token));
|
||||
|
||||
if (stok) {
|
||||
bool quit = false;
|
||||
|
@ -192,7 +193,6 @@ static unit *unitorders(FILE * F, int enc, struct faction *f)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
/* TODO: syntax error message */
|
||||
break;
|
||||
}
|
||||
if (quit) {
|
||||
|
|
|
@ -138,7 +138,6 @@ const char *keywords[MAXKEYWORDS] = {
|
|||
"group",
|
||||
"sort",
|
||||
"prefix",
|
||||
"plant",
|
||||
"alliance",
|
||||
"claim",
|
||||
"promote",
|
||||
|
|
|
@ -64,7 +64,6 @@ typedef enum {
|
|||
K_GROUP,
|
||||
K_SORT,
|
||||
K_PREFIX,
|
||||
K_PLANT,
|
||||
K_ALLIANCE,
|
||||
K_CLAIM,
|
||||
K_PROMOTION,
|
||||
|
|
Loading…
Reference in New Issue