2006-11-07 22:03:13 +01:00
|
|
|
#include "lib/self_test.h"
|
|
|
|
|
|
|
|
#include "ps/XML/Xeromyces.h"
|
2008-01-03 23:07:18 +01:00
|
|
|
#include "lib/file/vfs/vfs.h"
|
|
|
|
#include "lib/file/path.h"
|
2006-11-07 22:03:13 +01:00
|
|
|
|
|
|
|
class TestXeromyces : public CxxTest::TestSuite
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void test_paths()
|
|
|
|
{
|
2008-01-03 23:07:18 +01:00
|
|
|
TS_ASSERT_OK(path_SetRoot(0, "../data"));
|
2008-05-13 21:43:02 +02:00
|
|
|
PIVFS vfs = CreateVfs(20*MiB);
|
2006-11-07 22:03:13 +01:00
|
|
|
|
2008-01-03 23:07:18 +01:00
|
|
|
TS_ASSERT_OK(vfs->Mount("", "mods/_test.xero"));
|
2006-11-07 22:03:13 +01:00
|
|
|
|
2008-01-07 21:03:19 +01:00
|
|
|
VfsPath xmbPath;
|
2006-11-07 22:03:13 +01:00
|
|
|
|
2008-01-07 21:03:19 +01:00
|
|
|
CXeromyces::GetXMBPath(vfs, "test1.xml", "test1.xmb", xmbPath);
|
|
|
|
TS_ASSERT_STR_EQUALS(xmbPath.string(), "cache/mods/_test.xero/xmb/test1.xmb");
|
2006-11-07 22:03:13 +01:00
|
|
|
|
2008-01-07 21:03:19 +01:00
|
|
|
CXeromyces::GetXMBPath(vfs, "a/b/test1.xml", "a/b/test1.xmb", xmbPath);
|
|
|
|
TS_ASSERT_STR_EQUALS(xmbPath.string(), "cache/mods/_test.xero/xmb/a/b/test1.xmb");
|
2006-11-07 22:03:13 +01:00
|
|
|
|
2008-01-03 23:07:18 +01:00
|
|
|
path_ResetRootDir();
|
2006-11-07 22:03:13 +01:00
|
|
|
}
|
2009-03-24 01:55:35 +01:00
|
|
|
|
|
|
|
// TODO: Should test the reading/parsing/writing code,
|
|
|
|
// and parse error handling
|
2006-11-07 22:03:13 +01:00
|
|
|
};
|