test unit names get fixed during read.

This commit is contained in:
Enno Rehling 2016-11-11 15:41:34 +01:00
parent 64f80274a0
commit a47da05f51

View file

@ -55,7 +55,8 @@ static void test_readwrite_unit(CuTest * tc)
f = test_create_faction(0); f = test_create_faction(0);
fno = f->no; fno = f->no;
u = test_create_unit(f, r); u = test_create_unit(f, r);
unit_setname(u, " Hodor ");
CuAssertStrEquals(tc, " Hodor ", u->_name);
mstream_init(&data.strm); mstream_init(&data.strm);
gamedata_init(&data, &store, RELEASE_VERSION); gamedata_init(&data, &store, RELEASE_VERSION);
write_unit(&data, u); write_unit(&data, u);
@ -69,6 +70,7 @@ static void test_readwrite_unit(CuTest * tc)
u = read_unit(&data); u = read_unit(&data);
CuAssertPtrNotNull(tc, u); CuAssertPtrNotNull(tc, u);
CuAssertPtrEquals(tc, f, u->faction); CuAssertPtrEquals(tc, f, u->faction);
CuAssertStrEquals(tc, "Hodor", u->_name);
CuAssertPtrEquals(tc, 0, u->region); CuAssertPtrEquals(tc, 0, u->region);
mstream_done(&data.strm); mstream_done(&data.strm);