Skip to content
Snippets Groups Projects
Commit 40312790 authored by Dmitri Naumov's avatar Dmitri Naumov Committed by Dmitrij Naumov
Browse files

Add tests for findLastPathSeparator()

parent 291baaf3
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,30 @@
#include "FileTools.h"
TEST(BaseLib, FindLastPathSeparatorWin)
{
ASSERT_EQ ( BaseLib::findLastPathSeparator("file"), std::string::npos );
ASSERT_EQ ( BaseLib::findLastPathSeparator("\\file"), 0 );
ASSERT_EQ ( BaseLib::findLastPathSeparator("path\\"), 4 );
ASSERT_EQ ( BaseLib::findLastPathSeparator("\\path\\"), 5 );
ASSERT_EQ ( BaseLib::findLastPathSeparator("path\\file"), 4 );
ASSERT_EQ ( BaseLib::findLastPathSeparator("\\path\\file"), 5 );
ASSERT_EQ ( BaseLib::findLastPathSeparator("\\path\\path\\file"), 10 );
ASSERT_EQ ( BaseLib::findLastPathSeparator("\\path\\path\\path\\"), 15 );
}
TEST(BaseLib, FindLastPathSeparatorUnix)
{
ASSERT_EQ ( BaseLib::findLastPathSeparator("file"), std::string::npos );
ASSERT_EQ ( BaseLib::findLastPathSeparator("/file"), 0 );
ASSERT_EQ ( BaseLib::findLastPathSeparator("path/"), 4 );
ASSERT_EQ ( BaseLib::findLastPathSeparator("/path/"), 5 );
ASSERT_EQ ( BaseLib::findLastPathSeparator("path/file"), 4 );
ASSERT_EQ ( BaseLib::findLastPathSeparator("/path/file"), 5 );
ASSERT_EQ ( BaseLib::findLastPathSeparator("/path/path/file"), 10 );
ASSERT_EQ ( BaseLib::findLastPathSeparator("/path/path/path/"), 15 );
}
TEST(BaseLib, GetFileNameFromPathWin)
{
ASSERT_EQ ( BaseLib::getFileNameFromPath("file", true), "file" );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment