BUG 2356: add a failing test.

This commit is contained in:
Enno Rehling 2017-08-18 19:36:17 +02:00
parent 6d050bb6c2
commit 293cb78de8
1 changed files with 7 additions and 5 deletions

View File

@ -106,7 +106,7 @@ static void test_memstream(CuTest *tc) {
storage store; storage store;
stream out = { 0 }; stream out = { 0 };
char buf[1024]; char buf[1024];
int val=0; int val = 0;
mstream_init(&out); mstream_init(&out);
binstore_init(&store, &out); binstore_init(&store, &out);
@ -137,11 +137,13 @@ static void test_write_flag(CuTest *tc) {
mstream_init(&data.strm); mstream_init(&data.strm);
gamedata_init(&data, &store, RELEASE_VERSION); gamedata_init(&data, &store, RELEASE_VERSION);
setup_curse(&fix, "gbdream"); setup_curse(&fix, "magicwalls");
c = fix.c; c = fix.c;
r = fix.r; r = fix.r;
uid = r->uid; uid = r->uid;
c->flags = CURSE_ISNEW; c_setflag(c, CURSE_ISNEW);
c_setflag(c, CURSE_IMMUNE);
CuAssertIntEquals(tc, c->type->flags | CURSE_IMMUNE | CURSE_ISNEW, c_flags(c));
write_game(&data); write_game(&data);
free_gamedata(); free_gamedata();
data.strm.api->rewind(data.strm.handle); data.strm.api->rewind(data.strm.handle);
@ -150,7 +152,7 @@ static void test_write_flag(CuTest *tc) {
CuAssertPtrNotNull(tc, r); CuAssertPtrNotNull(tc, r);
CuAssertPtrNotNull(tc, r->attribs); CuAssertPtrNotNull(tc, r->attribs);
c = (curse *)r->attribs->data.v; c = (curse *)r->attribs->data.v;
CuAssertIntEquals(tc, CURSE_ISNEW, c->flags); CuAssertIntEquals(tc, c->type->flags | CURSE_IMMUNE | CURSE_ISNEW, c_flags(c));
mstream_done(&data.strm); mstream_done(&data.strm);
gamedata_done(&data); gamedata_done(&data);
@ -160,7 +162,7 @@ static void test_write_flag(CuTest *tc) {
static void test_curse_cache(CuTest *tc) static void test_curse_cache(CuTest *tc)
{ {
int cache = 0; int cache = 0;
const curse_type ct_dummy = { "dummy", CURSETYP_NORM, 0, M_SUMEFFECT, NULL }; const curse_type ct_dummy = { "dummy", CURSETYP_NORM, 0, M_SUMEFFECT, NULL };
test_setup(); test_setup();
CuAssertIntEquals(tc, true, ct_changed(&cache)); CuAssertIntEquals(tc, true, ct_changed(&cache));
CuAssertIntEquals(tc, false, ct_changed(&cache)); CuAssertIntEquals(tc, false, ct_changed(&cache));