add a failing test for bug 2266

This commit is contained in:
Enno Rehling 2016-12-16 17:16:10 +01:00 committed by Enno Rehling
parent 5cb67e1da0
commit 13128be0aa
3 changed files with 12 additions and 5 deletions

View File

@ -14,7 +14,7 @@
#include <assert.h> #include <assert.h>
#include <math.h> #include <math.h>
const attrib_type at_lighthouse = { attrib_type at_lighthouse = {
"lighthouse" "lighthouse"
/* Rest ist NULL; tempor<6F>res, nicht alterndes Attribut */ /* Rest ist NULL; tempor<6F>res, nicht alterndes Attribut */
}; };

View File

@ -29,7 +29,7 @@ extern "C" {
struct building; struct building;
struct attrib; struct attrib;
extern const struct attrib_type at_lighthouse; extern struct attrib_type at_lighthouse;
/* leuchtturm */ /* leuchtturm */
bool check_leuchtturm(struct region *r, struct faction *f); bool check_leuchtturm(struct region *r, struct faction *f);
void update_lighthouse(struct building *lh); void update_lighthouse(struct building *lh);

View File

@ -3,6 +3,7 @@
#include "move.h" #include "move.h"
#include "keyword.h" #include "keyword.h"
#include "lighthouse.h"
#include <kernel/config.h> #include <kernel/config.h>
#include <kernel/ally.h> #include <kernel/ally.h>
@ -501,15 +502,21 @@ static void test_ship_leave_trail(CuTest *tc) {
test_setup(); test_setup();
t_ocean = test_create_terrain("ocean", SEA_REGION); t_ocean = test_create_terrain("ocean", SEA_REGION);
r1 = test_create_region(0, 0, t_ocean); r1 = test_create_region(0, 0, t_ocean);
add_regionlist(&route, r2 = test_create_region(1, 0, t_ocean));
add_regionlist(&route, test_create_region(2, 0, t_ocean)); add_regionlist(&route, test_create_region(2, 0, t_ocean));
add_regionlist(&route, r2 = test_create_region(1, 0, t_ocean));
st_boat = test_create_shiptype("boat"); st_boat = test_create_shiptype("boat");
s1 = test_create_ship(r1, st_boat); s1 = test_create_ship(r1, st_boat);
s2 = test_create_ship(r1, st_boat); s2 = test_create_ship(r1, st_boat);
leave_trail(s1, r1, route); leave_trail(s1, r1, route);
a_add(&r1->attribs, a_new(&at_lighthouse));
leave_trail(s2, r1, route); leave_trail(s2, r1, route);
// CuAssertPtrNotNull(tc, r1->attribs); a_add(&r2->attribs, a_new(&at_lighthouse));
CuAssertPtrNotNull(tc, r2->attribs); CuAssertPtrEquals(tc, &at_shiptrail, (void *)r1->attribs->type);
CuAssertPtrEquals(tc, &at_shiptrail, (void *)r1->attribs->next->type);
CuAssertPtrEquals(tc, &at_lighthouse, (void *)r1->attribs->next->next->type);
CuAssertPtrEquals(tc, &at_shiptrail, (void *)r2->attribs->type);
CuAssertPtrEquals(tc, &at_shiptrail, (void *)r2->attribs->next->type);
CuAssertPtrEquals(tc, &at_lighthouse, (void *)r2->attribs->next->next->type);
free_regionlist(route); free_regionlist(route);
test_cleanup(); test_cleanup();
} }