mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-16 03:55:46 -04:00
Common/FileSystem: Add IsAbsolutePath() and tests
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
add_executable(common-tests
|
||||
bitutils_tests.cpp
|
||||
event_tests.cpp
|
||||
file_system_tests.cpp
|
||||
rectangle_tests.cpp
|
||||
)
|
||||
|
||||
|
@ -46,6 +46,7 @@
|
||||
<ClCompile Include="..\..\dep\googletest\src\gtest_main.cc" />
|
||||
<ClCompile Include="bitutils_tests.cpp" />
|
||||
<ClCompile Include="event_tests.cpp" />
|
||||
<ClCompile Include="file_system_tests.cpp" />
|
||||
<ClCompile Include="rectangle_tests.cpp" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
|
@ -5,5 +5,6 @@
|
||||
<ClCompile Include="rectangle_tests.cpp" />
|
||||
<ClCompile Include="event_tests.cpp" />
|
||||
<ClCompile Include="bitutils_tests.cpp" />
|
||||
<ClCompile Include="file_system_tests.cpp" />
|
||||
</ItemGroup>
|
||||
</Project>
|
25
src/common-tests/file_system_tests.cpp
Normal file
25
src/common-tests/file_system_tests.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include "common/file_system.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(FileSystem, IsAbsolutePath)
|
||||
{
|
||||
#ifdef WIN32
|
||||
ASSERT_TRUE(FileSystem::IsAbsolutePath("C:\\"));
|
||||
ASSERT_TRUE(FileSystem::IsAbsolutePath("C:\\Path"));
|
||||
ASSERT_TRUE(FileSystem::IsAbsolutePath("C:\\Path\\Subdirectory"));
|
||||
ASSERT_TRUE(FileSystem::IsAbsolutePath("C:/"));
|
||||
ASSERT_TRUE(FileSystem::IsAbsolutePath("C:/Path"));
|
||||
ASSERT_TRUE(FileSystem::IsAbsolutePath("C:/Path/Subdirectory"));
|
||||
ASSERT_FALSE(FileSystem::IsAbsolutePath(""));
|
||||
ASSERT_FALSE(FileSystem::IsAbsolutePath("C:"));
|
||||
ASSERT_FALSE(FileSystem::IsAbsolutePath("Path"));
|
||||
ASSERT_FALSE(FileSystem::IsAbsolutePath("Path/Subdirectory"));
|
||||
#else
|
||||
ASSERT_TRUE(FileSystem::IsAbsolutePath("/"));
|
||||
ASSERT_TRUE(FileSystem::IsAbsolutePath("/path"));
|
||||
ASSERT_TRUE(FileSystem::IsAbsolutePath("/path/subdirectory"));
|
||||
ASSERT_FALSE(FileSystem::IsAbsolutePath(""));
|
||||
ASSERT_FALSE(FileSystem::IsAbsolutePath("path"));
|
||||
ASSERT_FALSE(FileSystem::IsAbsolutePath("path/subdirectory"));
|
||||
#endif
|
||||
}
|
Reference in New Issue
Block a user