1
0

Dokan changes

This commit is contained in:
Scott E. Graves
2017-02-11 19:42:51 -06:00
parent 6c57281055
commit 3c1dd68622
6 changed files with 221 additions and 131 deletions

View File

@@ -20,6 +20,46 @@ namespace UnitTests
CSiaApi api(_hostConfig);
Assert::IsTrue(api.GetServerVersion() == TEST_SERVER_VERSION);
}
TEST_METHOD(RelativePathToSiaPath)
{
String relPath = L"test\\moose\\cow.txt";
String siaPath = CSiaApi::FormatToSiaPath(relPath);
Assert::AreEqual(L"test/moose/cow.txt", siaPath.c_str());
}
TEST_METHOD(RelativePathWithBeginningBackslashToSiaPath)
{
String relPath = L"\\test\\moose\\cow.txt";
String siaPath = CSiaApi::FormatToSiaPath(relPath);
Assert::AreEqual(L"test/moose/cow.txt", siaPath.c_str());
}
TEST_METHOD(RelativePathWithBeginningBackslashOnlyToSiaPath)
{
String relPath = L"\\";
String siaPath = CSiaApi::FormatToSiaPath(relPath);
Assert::AreEqual(L"", siaPath.c_str());
}
TEST_METHOD(FilenameOnlyToSiaPath)
{
String relPath = L"moose.txt";
String siaPath = CSiaApi::FormatToSiaPath(relPath);
Assert::AreEqual(L"moose.txt", siaPath.c_str());
}
TEST_METHOD(RemoveExtraBackslashes)
{
String relPath = L"\\\\\\\\test\\\\\\\\\\\\\\\\\\moose\\\\\\\\\\\\cow.txt";
String siaPath = CSiaApi::FormatToSiaPath(relPath);
Assert::AreEqual(L"test/moose/cow.txt", siaPath.c_str());
}
};
DEFINE_DAEMON(SiaApi);