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