1 /* 2 * PROJECT: ReactOS API Tests 3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) 4 * PURPOSE: Tests for PathIsEqualOrSubFolder 5 * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> 6 */ 7 8 #include "shelltest.h" 9 #include <undocshell.h> 10 11 START_TEST(PathIsEqualOrSubFolder) 12 { 13 ok_int(PathIsEqualOrSubFolder(L"C:", L"C:"), TRUE); 14 ok_int(PathIsEqualOrSubFolder(L"C:", L"C:\\"), TRUE); 15 ok_int(PathIsEqualOrSubFolder(L"C:\\", L"C:"), TRUE); 16 ok_int(PathIsEqualOrSubFolder(L"C:\\", L"C:\\"), TRUE); 17 ok_int(PathIsEqualOrSubFolder(L"C:\\", L"C:\\TestTestTest"), TRUE); 18 ok_int(PathIsEqualOrSubFolder(L"C:\\TestTestTest", L"C:\\"), FALSE); 19 ok_int(PathIsEqualOrSubFolder(L"C:\\TestTestTest", L"C:\\TestTestTest"), TRUE); 20 ok_int(PathIsEqualOrSubFolder(L"C:\\TestTestTest", L"C:\\TestTestTest\\"), TRUE); 21 22 WCHAR szPath1[MAX_PATH], szPath2[MAX_PATH]; 23 24 GetWindowsDirectoryW(szPath1, _countof(szPath1)); 25 ok_int(PathIsEqualOrSubFolder(szPath1, szPath1), TRUE); 26 27 GetWindowsDirectoryW(szPath2, _countof(szPath2)); 28 PathAppendW(szPath2, L"TestTestTest"); 29 30 ok_int(PathIsEqualOrSubFolder(szPath1, szPath2), TRUE); 31 ok_int(PathIsEqualOrSubFolder(szPath2, szPath1), FALSE); 32 ok_int(PathIsEqualOrSubFolder(szPath2, szPath2), TRUE); 33 34 GetTempPathW(_countof(szPath1), szPath1); 35 GetTempPathW(_countof(szPath2), szPath2); 36 PathAppendW(szPath2, L"TestTestTest"); 37 38 ok_int(PathIsEqualOrSubFolder(szPath1, szPath2), TRUE); 39 ok_int(PathIsEqualOrSubFolder(szPath2, szPath1), FALSE); 40 ok_int(PathIsEqualOrSubFolder(szPath2, szPath2), TRUE); 41 } 42