ReactOS 0.4.16-dev-2104-gb84fa49
_wcsicmp.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS API tests
3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4 * PURPOSE: Tests for _wcsicmp
5 * COPYRIGHT: Copyright 2025 Timo Kreuzer (timo.kreuzer@reactos.org)
6 */
7
8#define WIN32_NO_STATUS
9#include <apitest.h>
10#include <pseh/pseh2.h>
11#include <ndk/umtypes.h>
12
13typedef int (__cdecl *PFN_wcsicmp)(const wchar_t* _String1, const wchar_t* _String2);
15
16static BOOL Init(void)
17{
20 ok(p_wcsicmp != NULL, "Failed to load _wcsicmp from %s\n", TEST_DLL_NAME);
21 return (p_wcsicmp != NULL);
22}
23
25{
26 int result;
27
28#ifndef TEST_STATIC_CRT
29 if (!Init())
30 {
31 skip("Skipping tests, because _wcsicmp is not available\n");
32 return;
33 }
34#endif
35
36 StartSeh()
37 result = p_wcsicmp(L"a", NULL);
39#ifdef TEST_NTDLL
41#else
43#endif
44
45 StartSeh()
46 result = p_wcsicmp(NULL, L"a");
48#ifdef TEST_NTDLL
50#else
52#endif
53
54 ok_eq_int(p_wcsicmp(L"abc", L"ABC"), 0);
55 ok_eq_int(p_wcsicmp(L"ABC", L"abc"), 0);
56 ok_eq_int(p_wcsicmp(L"abc", L"abd"), -1);
57 ok_eq_int(p_wcsicmp(L"abd", L"abc"), 1);
58 ok_eq_int(p_wcsicmp(L"abcd", L"ABC"), 'd');
59 ok_eq_int(p_wcsicmp(L"ABC", L"abcd"), -'d');
60 ok_eq_int(p_wcsicmp(L"ab", L"A "), 'b' - ' ');
61 ok_eq_int(p_wcsicmp(L"AB", L"a "), 'b' - ' ');
62 ok_eq_int(p_wcsicmp(L"a ", L"aB"), ' ' - 'b');
63
64 /* This shows that _wcsicmp does a lowercase comparison. */
65 ok_eq_int(p_wcsicmp(L"_", L"a"), '_' - 'a');
66}
static PFN_wcsicmp p_wcsicmp
Definition: _wcsicmp.c:14
static BOOL Init(void)
Definition: _wcsicmp.c:16
int(__cdecl * PFN_wcsicmp)(const wchar_t *_String1, const wchar_t *_String2)
Definition: _wcsicmp.c:13
#define StartSeh()
Definition: apitest.h:93
#define ok_eq_int(value, expected)
Definition: apitest.h:117
#define EndSeh(ExpectedStatus)
Definition: apitest.h:99
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define ok_int(expression, result)
Definition: atltest.h:134
#define NULL
Definition: types.h:112
#define GetProcAddress(x, y)
Definition: compat.h:753
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define __cdecl
Definition: corecrt.h:121
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
unsigned int _winver
Definition: environ.c:14
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
#define STATUS_ACCESS_VIOLATION
GLuint64EXT * result
Definition: glext.h:11304
#define TEST_DLL_NAME
Definition: wsprintf.c:3
_In_z_ wchar_t const * _String2
#define is_reactos()
Definition: test.h:1041
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
#define STATUS_SUCCESS
Definition: shellext.h:65
static PVOID hdll
Definition: shimdbg.c:126
#define MAXLONG
Definition: umtypes.h:116