ReactOS 0.4.16-dev-1610-g4f61d2e
PathIsEqualOrSubFolder.cpp
Go to the documentation of this file.
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
12{
14 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:\\"), TRUE);
18 ok_int(PathIsEqualOrSubFolder(L"C:\\", L"C:\\TestTestTest"), TRUE);
19 ok_int(PathIsEqualOrSubFolder(L"C:\\TestTestTest", L"C:\\"), FALSE);
20 ok_int(PathIsEqualOrSubFolder(L"C:\\TestTestTest", L"C:\\TestTestTest"), TRUE);
21 ok_int(PathIsEqualOrSubFolder(L"C:\\TestTestTest", L"C:\\TestTestTest\\"), TRUE);
22
23 WCHAR szPath1[MAX_PATH], szPath2[MAX_PATH];
24
25 GetWindowsDirectoryW(szPath1, _countof(szPath1));
26 ok_int(PathIsEqualOrSubFolder(szPath1, szPath1), TRUE);
27
28 GetWindowsDirectoryW(szPath2, _countof(szPath2));
29 PathAppendW(szPath2, L"TestTestTest");
30
31 ok_int(PathIsEqualOrSubFolder(szPath1, szPath2), TRUE);
32 ok_int(PathIsEqualOrSubFolder(szPath2, szPath1), FALSE);
33 ok_int(PathIsEqualOrSubFolder(szPath2, szPath2), TRUE);
34
35 GetTempPathW(_countof(szPath1), szPath1);
36 GetTempPathW(_countof(szPath2), szPath2);
37 PathAppendW(szPath2, L"TestTestTest");
38
39 ok_int(PathIsEqualOrSubFolder(szPath1, szPath2), TRUE);
40 ok_int(PathIsEqualOrSubFolder(szPath2, szPath1), FALSE);
41 ok_int(PathIsEqualOrSubFolder(szPath2, szPath2), TRUE);
42}
#define GetNTVersion()
Definition: apitest.h:17
#define START_TEST(x)
Definition: atltest.h:75
#define ok_int(expression, result)
Definition: atltest.h:134
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2080
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
EXTERN_C BOOL WINAPI PathIsEqualOrSubFolder(_In_ LPCWSTR pszPath1OrCSIDL, _In_ LPCWSTR pszPath2)
Definition: utils.cpp:1612
#define L(x)
Definition: resources.c:13
#define PathAppendW
Definition: pathcch.h:310
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
#define _countof(array)
Definition: sndvol32.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180