forked from github/server
save.test is still lekaing units.
calling test_setup and test_cleanup, doesn't fix everything.
This commit is contained in:
parent
93a1fe5059
commit
51c1ddc98b
1 changed files with 7 additions and 3 deletions
|
@ -34,7 +34,7 @@ static void test_readwrite_data(CuTest * tc)
|
||||||
{
|
{
|
||||||
const char *filename = "test.dat";
|
const char *filename = "test.dat";
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
test_cleanup();
|
test_setup();
|
||||||
CuAssertIntEquals(tc, 0, writegame(filename));
|
CuAssertIntEquals(tc, 0, writegame(filename));
|
||||||
CuAssertIntEquals(tc, 0, readgame(filename, false));
|
CuAssertIntEquals(tc, 0, readgame(filename, false));
|
||||||
join_path(datapath(), filename, path, sizeof(path));
|
join_path(datapath(), filename, path, sizeof(path));
|
||||||
|
@ -51,7 +51,7 @@ static void test_readwrite_unit(CuTest * tc)
|
||||||
struct faction *f;
|
struct faction *f;
|
||||||
int fno;
|
int fno;
|
||||||
|
|
||||||
test_cleanup();
|
test_setup();
|
||||||
r = test_create_region(0, 0, 0);
|
r = test_create_region(0, 0, 0);
|
||||||
f = test_create_faction(0);
|
f = test_create_faction(0);
|
||||||
fno = f->no;
|
fno = f->no;
|
||||||
|
@ -81,7 +81,7 @@ static void test_readwrite_attrib(CuTest *tc) {
|
||||||
storage store;
|
storage store;
|
||||||
attrib *a = NULL;
|
attrib *a = NULL;
|
||||||
|
|
||||||
test_cleanup();
|
test_setup();
|
||||||
key_set(&a, 41);
|
key_set(&a, 41);
|
||||||
key_set(&a, 42);
|
key_set(&a, 42);
|
||||||
mstream_init(&data.strm);
|
mstream_init(&data.strm);
|
||||||
|
@ -260,6 +260,7 @@ static void test_read_password(CuTest *tc) {
|
||||||
storage store;
|
storage store;
|
||||||
faction *f;
|
faction *f;
|
||||||
|
|
||||||
|
test_setup();
|
||||||
f = test_create_faction(0);
|
f = test_create_faction(0);
|
||||||
faction_setpassword(f, password_encode("secret", PASSWORD_DEFAULT));
|
faction_setpassword(f, password_encode("secret", PASSWORD_DEFAULT));
|
||||||
mstream_init(&data.strm);
|
mstream_init(&data.strm);
|
||||||
|
@ -270,6 +271,7 @@ static void test_read_password(CuTest *tc) {
|
||||||
mstream_done(&data.strm);
|
mstream_done(&data.strm);
|
||||||
gamedata_done(&data);
|
gamedata_done(&data);
|
||||||
CuAssertTrue(tc, checkpasswd(f, "secret"));
|
CuAssertTrue(tc, checkpasswd(f, "secret"));
|
||||||
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_read_password_external(CuTest *tc) {
|
static void test_read_password_external(CuTest *tc) {
|
||||||
|
@ -279,6 +281,7 @@ static void test_read_password_external(CuTest *tc) {
|
||||||
faction *f;
|
faction *f;
|
||||||
FILE * F;
|
FILE * F;
|
||||||
|
|
||||||
|
test_setup();
|
||||||
remove(pwfile);
|
remove(pwfile);
|
||||||
f = test_create_faction(0);
|
f = test_create_faction(0);
|
||||||
faction_setpassword(f, password_encode("secret", PASSWORD_DEFAULT));
|
faction_setpassword(f, password_encode("secret", PASSWORD_DEFAULT));
|
||||||
|
@ -305,6 +308,7 @@ static void test_read_password_external(CuTest *tc) {
|
||||||
mstream_done(&data.strm);
|
mstream_done(&data.strm);
|
||||||
gamedata_done(&data);
|
gamedata_done(&data);
|
||||||
CuAssertIntEquals(tc, 0, remove(pwfile));
|
CuAssertIntEquals(tc, 0, remove(pwfile));
|
||||||
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
CuSuite *get_save_suite(void)
|
CuSuite *get_save_suite(void)
|
||||||
|
|
Loading…
Reference in a new issue