server/src/kernel/save.test.c

28 lines
661 B
C
Raw Normal View History

#include <platform.h>
#include <kernel/config.h>
#include "save.h"
#include "version.h"
#include <CuTest.h>
#include <tests.h>
#include <stdio.h>
static void test_readwrite_data(CuTest * tc)
{
const char *filename = "test.dat";
char path[MAX_PATH];
sprintf(path, "%s/%s", datapath(), filename);
CuAssertIntEquals(tc, 0, writegame(filename));
CuAssertIntEquals(tc, 0, readgame(filename, 0));
CuAssertIntEquals(tc, RELEASE_VERSION, global.data_version);
CuAssertIntEquals(tc, 0, remove(path));
}
CuSuite *get_save_suite(void)
{
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_readwrite_data);
return suite;
}