2014-08-14 05:06:36 +02:00
|
|
|
#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];
|
2014-12-12 11:13:25 +01:00
|
|
|
test_cleanup();
|
2014-08-14 05:06:36 +02:00
|
|
|
sprintf(path, "%s/%s", datapath(), filename);
|
|
|
|
CuAssertIntEquals(tc, 0, writegame(filename));
|
2015-05-13 02:18:51 +02:00
|
|
|
CuAssertIntEquals(tc, 0, readgame(filename, false));
|
2014-08-14 05:06:36 +02:00
|
|
|
CuAssertIntEquals(tc, RELEASE_VERSION, global.data_version);
|
|
|
|
CuAssertIntEquals(tc, 0, remove(path));
|
2014-12-12 11:13:25 +01:00
|
|
|
test_cleanup();
|
2014-08-14 05:06:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CuSuite *get_save_suite(void)
|
|
|
|
{
|
|
|
|
CuSuite *suite = CuSuiteNew();
|
|
|
|
SUITE_ADD_TEST(suite, test_readwrite_data);
|
|
|
|
return suite;
|
|
|
|
}
|