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 PathIsTemporaryA/W
5  * COPYRIGHT:   Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6  */
7 
8 #include "shelltest.h"
9 #include <undocshell.h>
10 
11 static void Test_PathIsTemporaryA(void)
12 {
13     CHAR szPath[MAX_PATH];
14     ok_int(PathIsTemporaryA("C:\\"), FALSE);
15     ok_int(PathIsTemporaryA("C:\\TestTestTest"), FALSE);
16 
17     GetWindowsDirectoryA(szPath, _countof(szPath));
18     ok_int(PathIsTemporaryA(szPath), FALSE);
19 
20     GetTempPathA(_countof(szPath), szPath);
21     ok_int(PathIsTemporaryA(szPath), TRUE);
22 
23     PathAppendA(szPath, "TestTestTest");
24     ok_int(PathIsTemporaryA(szPath), FALSE);
25 
26     CreateDirectoryA(szPath, NULL);
27     ok_int(PathIsTemporaryA(szPath), TRUE);
28 
29     RemoveDirectoryA(szPath);
30 }
31 
32 static void Test_PathIsTemporaryW(void)
33 {
34     WCHAR szPath[MAX_PATH];
35     ok_int(PathIsTemporaryW(L"C:\\"), FALSE);
36     ok_int(PathIsTemporaryW(L"C:\\TestTestTest"), FALSE);
37 
38     GetWindowsDirectoryW(szPath, _countof(szPath));
39     ok_int(PathIsTemporaryW(szPath), FALSE);
40 
41     GetTempPathW(_countof(szPath), szPath);
42     ok_int(PathIsTemporaryW(szPath), TRUE);
43 
44     PathAppendW(szPath, L"TestTestTest");
45     ok_int(PathIsTemporaryW(szPath), FALSE);
46 
47     CreateDirectoryW(szPath, NULL);
48     ok_int(PathIsTemporaryW(szPath), TRUE);
49 
50     RemoveDirectoryW(szPath);
51 }
52 
53 START_TEST(PathIsTemporary)
54 {
55     Test_PathIsTemporaryA();
56     Test_PathIsTemporaryW();
57 }
58