tangled
alpha
login
or
join now
huwcampbell.com
/
reactos
0
fork
atom
Reactos
0
fork
atom
overview
issues
pulls
pipelines
[CRT_APITEST] Implement tests for _wcsicmp and _wcsnicmp
Timo Kreuzer
4 months ago
ae3eb6cb
7872c0d3
+126
6 changed files
expand all
collapse all
unified
split
modules
rostests
apitests
crt
_wcsicmp.c
_wcsnicmp.c
msvcrt
CMakeLists.txt
testlist.c
ntdll
CMakeLists.txt
testlist.c
+53
modules/rostests/apitests/crt/_wcsicmp.c
reviewed
···
1
1
+
/*
2
2
+
* PROJECT: ReactOS API tests
3
3
+
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4
4
+
* PURPOSE: Tests for _wcsicmp
5
5
+
* COPYRIGHT: Copyright 2025 Timo Kreuzer (timo.kreuzer@reactos.org)
6
6
+
*/
7
7
+
8
8
+
#define WIN32_NO_STATUS
9
9
+
#include <apitest.h>
10
10
+
#include <pseh/pseh2.h>
11
11
+
#include <ndk/umtypes.h>
12
12
+
13
13
+
typedef int (__cdecl *PFN_wcsicmp)(const wchar_t* _String1, const wchar_t* _String2);
14
14
+
static PFN_wcsicmp p_wcsicmp;
15
15
+
16
16
+
static BOOL Init(void)
17
17
+
{
18
18
+
HMODULE hdll = LoadLibraryA(TEST_DLL_NAME);
19
19
+
p_wcsicmp = (PFN_wcsicmp)GetProcAddress(hdll, "_wcsicmp");
20
20
+
ok(p_wcsicmp != NULL, "Failed to load _wcsicmp from %s\n", TEST_DLL_NAME);
21
21
+
return (p_wcsicmp != NULL);
22
22
+
}
23
23
+
24
24
+
START_TEST(_wcsicmp)
25
25
+
{
26
26
+
int result;
27
27
+
28
28
+
#ifndef TEST_STATIC_CRT
29
29
+
if (!Init())
30
30
+
{
31
31
+
skip("Skipping tests, because _wcsicmp is not available\n");
32
32
+
return;
33
33
+
}
34
34
+
#endif
35
35
+
36
36
+
StartSeh()
37
37
+
result = p_wcsicmp(L"a", NULL);
38
38
+
ok_int(result, MAXLONG);
39
39
+
#ifdef TEST_NTDLL
40
40
+
EndSeh(STATUS_ACCESS_VIOLATION);
41
41
+
#else
42
42
+
EndSeh((is_reactos() || _winver >= _WIN32_WINNT_VISTA) ? STATUS_SUCCESS : STATUS_ACCESS_VIOLATION);
43
43
+
#endif
44
44
+
45
45
+
StartSeh()
46
46
+
result = p_wcsicmp(NULL, L"a");
47
47
+
ok_int(result, MAXLONG);
48
48
+
#ifdef TEST_NTDLL
49
49
+
EndSeh(STATUS_ACCESS_VIOLATION);
50
50
+
#else
51
51
+
EndSeh((is_reactos() || _winver >= _WIN32_WINNT_VISTA) ? STATUS_SUCCESS : STATUS_ACCESS_VIOLATION);
52
52
+
#endif
53
53
+
}
+61
modules/rostests/apitests/crt/_wcsnicmp.c
reviewed
···
1
1
+
/*
2
2
+
* PROJECT: ReactOS API tests
3
3
+
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4
4
+
* PURPOSE: Tests for _wcsnicmp
5
5
+
* COPYRIGHT: Copyright 2025 Timo Kreuzer (timo.kreuzer@reactos.org)
6
6
+
*/
7
7
+
8
8
+
#define WIN32_NO_STATUS
9
9
+
#include <apitest.h>
10
10
+
#include <pseh/pseh2.h>
11
11
+
#include <ndk/umtypes.h>
12
12
+
13
13
+
typedef int (__cdecl *PFN_wcsnicmp)(const wchar_t* _String1, const wchar_t* _String2, size_t _MaxCount);
14
14
+
static PFN_wcsnicmp p_wcsnicmp;
15
15
+
16
16
+
static BOOL Init(void)
17
17
+
{
18
18
+
HMODULE hdll = LoadLibraryA(TEST_DLL_NAME);
19
19
+
p_wcsnicmp = (PFN_wcsnicmp)GetProcAddress(hdll, "_wcsnicmp");
20
20
+
ok(p_wcsnicmp != NULL, "Failed to load _wcsnicmp from %s\n", TEST_DLL_NAME);
21
21
+
return (p_wcsnicmp != NULL);
22
22
+
}
23
23
+
24
24
+
START_TEST(_wcsnicmp)
25
25
+
{
26
26
+
int result;
27
27
+
28
28
+
#ifndef TEST_STATIC_CRT
29
29
+
if (!Init())
30
30
+
{
31
31
+
skip("Skipping tests, because _wcsnicmp is not available\n");
32
32
+
return;
33
33
+
}
34
34
+
#endif
35
35
+
36
36
+
StartSeh()
37
37
+
result = p_wcsnicmp(L"a", NULL, 0);
38
38
+
EndSeh(STATUS_SUCCESS);
39
39
+
40
40
+
StartSeh()
41
41
+
result = p_wcsnicmp(L"a", NULL, 1);
42
42
+
ok_int(result, MAXLONG);
43
43
+
#ifdef TEST_NTDLL
44
44
+
EndSeh(STATUS_ACCESS_VIOLATION);
45
45
+
#else
46
46
+
EndSeh((is_reactos() || GetNTVersion() >= _WIN32_WINNT_VISTA) ? STATUS_SUCCESS : STATUS_ACCESS_VIOLATION);
47
47
+
#endif
48
48
+
49
49
+
StartSeh()
50
50
+
result = p_wcsnicmp(NULL, L"a", 0);
51
51
+
EndSeh(STATUS_SUCCESS);
52
52
+
53
53
+
StartSeh()
54
54
+
result = p_wcsnicmp(NULL, L"a", 1);
55
55
+
ok_int(result, MAXLONG);
56
56
+
#ifdef TEST_NTDLL
57
57
+
EndSeh(STATUS_ACCESS_VIOLATION);
58
58
+
#else
59
59
+
EndSeh((is_reactos() || GetNTVersion() >= _WIN32_WINNT_VISTA) ? STATUS_SUCCESS : STATUS_ACCESS_VIOLATION);
60
60
+
#endif
61
61
+
}
+2
modules/rostests/apitests/msvcrt/CMakeLists.txt
reviewed
···
22
22
../crt/_vscwprintf.c
23
23
../crt/_vsnprintf.c
24
24
../crt/_vsnwprintf.c
25
25
+
../crt/_wcsicmp.c
26
26
+
../crt/_wcsnicmp.c
25
27
../crt/_wsystem.c
26
28
../crt/acos.c
27
29
../crt/asin.c
+4
modules/rostests/apitests/msvcrt/testlist.c
reviewed
···
16
16
extern void func__vscwprintf(void);
17
17
extern void func__vsnprintf(void);
18
18
extern void func__vsnwprintf(void);
19
19
+
extern void func__wcsicmp(void);
20
20
+
extern void func__wcsnicmp(void);
19
21
extern void func__wsystem(void);
20
22
extern void func_acos(void);
21
23
extern void func_asin(void);
···
76
78
{ "_vscwprintf", func__vscwprintf },
77
79
{ "_vsnprintf", func__vsnprintf },
78
80
{ "_vsnwprintf", func__vsnwprintf },
81
81
+
{ "_wcsicmp", func__wcsicmp },
82
82
+
{ "_wcsnicmp", func__wcsnicmp },
79
83
{ "_wsystem", func__wsystem },
80
84
{ "acos", func_acos },
81
85
{ "asin", func_asin },
+2
modules/rostests/apitests/ntdll/CMakeLists.txt
reviewed
···
15
15
../crt/_vscwprintf.c
16
16
../crt/_vsnprintf.c
17
17
../crt/_vsnwprintf.c
18
18
+
../crt/_wcsicmp.c
19
19
+
../crt/_wcsnicmp.c
18
20
../crt/mbstowcs.c
19
21
../crt/setjmp.c
20
22
../crt/sprintf.c
+4
modules/rostests/apitests/ntdll/testlist.c
reviewed
···
9
9
extern void func__vscwprintf(void);
10
10
extern void func__vsnprintf(void);
11
11
extern void func__vsnwprintf(void);
12
12
+
extern void func__wcsicmp(void);
13
13
+
extern void func__wcsnicmp(void);
12
14
extern void func_mbstowcs(void);
13
15
extern void func_setjmp(void);
14
16
extern void func_sprintf(void);
···
136
138
{ "_vscwprintf", func__vscwprintf },
137
139
{ "_vsnprintf", func__vsnprintf },
138
140
{ "_vsnwprintf", func__vsnwprintf },
141
141
+
{ "_wcsicmp", func__wcsicmp },
142
142
+
{ "_wcsnicmp", func__wcsnicmp },
139
143
{ "mbstowcs", func_mbstowcs },
140
144
{ "setjmp", func_setjmp },
141
145
{ "sprintf", func_sprintf },