1
0
forked from 0ad/0ad

Make tests clean up after themselves

This was SVN commit r7508.
This commit is contained in:
Ykkrosh 2010-05-07 17:50:38 +00:00
parent 93c30810c8
commit dc53d739b8
4 changed files with 27 additions and 8 deletions

View File

@ -69,9 +69,9 @@ class TestMeshManager : public CxxTest::TestSuite
void deinitVfs()
{
g_VFS.reset();
DeleteDirectory(MOD_PATH);
DeleteDirectory(CACHE_PATH);
g_VFS.reset();
}
void copyFile(const VfsPath& src, const VfsPath& dst)

View File

@ -37,6 +37,8 @@ public:
void setUp()
{
g_VFS = CreateVfs(20 * MiB);
TS_ASSERT_OK(g_VFS->Mount(L"", DataDir()/L"mods/_test.sim", VFS_MOUNT_MUST_EXIST));
TS_ASSERT_OK(g_VFS->Mount(L"cache", DataDir()/L"_testcache"));
CXeromyces::Startup();
}
@ -44,12 +46,11 @@ public:
{
CXeromyces::Terminate();
g_VFS.reset();
DeleteDirectory(DataDir()/L"_testcache");
}
void test_LoadTemplate()
{
TS_ASSERT_OK(g_VFS->Mount(L"", DataDir()/L"mods/_test.sim", VFS_MOUNT_MUST_EXIST));
CSimContext context;
CComponentManager man(context);
man.LoadComponentTypes();
@ -93,8 +94,6 @@ public:
void test_LoadTemplate_errors()
{
TS_ASSERT_OK(g_VFS->Mount(L"", DataDir()/L"mods/_test.sim", VFS_MOUNT_MUST_EXIST));
CSimContext context;
CComponentManager man(context);
man.LoadComponentTypes();
@ -126,8 +125,6 @@ public:
void test_LoadTemplate_multiple()
{
TS_ASSERT_OK(g_VFS->Mount(L"", DataDir()/L"mods/_test.sim", VFS_MOUNT_MUST_EXIST));
CSimContext context;
CComponentManager man(context);
man.LoadComponentTypes();
@ -163,11 +160,29 @@ public:
TS_ASSERT(tempMan->LoadTemplate(ent2, L"inherit-broken", -1) == NULL);
TS_ASSERT(tempMan->LoadTemplate(ent2, L"inherit-broken", -1) == NULL);
}
};
void test_load_all_DISABLED() // disabled since it's a bit slow
class TestCmpTemplateManager_2 : public CxxTest::TestSuite
{
public:
void setUp()
{
g_VFS = CreateVfs(20 * MiB);
TS_ASSERT_OK(g_VFS->Mount(L"", DataDir()/L"mods/public", VFS_MOUNT_MUST_EXIST));
TS_ASSERT_OK(g_VFS->Mount(L"cache", DataDir()/L"_testcache"));
CXeromyces::Startup();
}
void tearDown()
{
CXeromyces::Terminate();
g_VFS.reset();
DeleteDirectory(DataDir()/L"_testcache");
}
// This just attempts loading every public entity, to check there's no validation errors
void test_load_all_DISABLED() // disabled since it's a bit slow and noisy
{
CTerrain dummy;
CSimulation2 sim(NULL, &dummy);
sim.LoadDefaultScripts();

View File

@ -45,6 +45,7 @@ public:
{
g_VFS = CreateVfs(20 * MiB);
TS_ASSERT_OK(g_VFS->Mount(L"", DataDir()/L"mods/_test.sim", VFS_MOUNT_MUST_EXIST));
TS_ASSERT_OK(g_VFS->Mount(L"cache", DataDir()/L"_testcache"));
CXeromyces::Startup();
}
@ -52,6 +53,7 @@ public:
{
CXeromyces::Terminate();
g_VFS.reset();
DeleteDirectory(DataDir()/L"_testcache");
}
void test_Load()

View File

@ -43,6 +43,7 @@ public:
{
g_VFS = CreateVfs(20 * MiB);
TS_ASSERT_OK(g_VFS->Mount(L"", DataDir()/L"mods/_test.sim", VFS_MOUNT_MUST_EXIST));
TS_ASSERT_OK(g_VFS->Mount(L"cache", DataDir()/L"_testcache"));
CXeromyces::Startup();
}
@ -50,6 +51,7 @@ public:
{
CXeromyces::Terminate();
g_VFS.reset();
DeleteDirectory(DataDir()/L"_testcache");
}
void test_AddEntity()