ReactOS 0.4.15-dev-7906-g1b85a5f
string.c File Reference
#include <stdlib.h>
#include "ntdll_test.h"
Include dependency graph for string.c:

Go to the source code of this file.

Classes

struct  ulong2str_t
 
struct  ulonglong2str_t
 
struct  str2long_t
 
struct  str2longlong_t
 

Macros

#define LARGE_STRI_BUFFER_LENGTH   67
 
#define NB_ULONG2STR   (sizeof(ulong2str)/sizeof(*ulong2str))
 
#define ULL(a, b)   (((ULONGLONG)(a) << 32) | (b))
 
#define NB_ULONGLONG2STR   (sizeof(ulonglong2str)/sizeof(*ulonglong2str))
 
#define NB_STR2LONG   (sizeof(str2long)/sizeof(*str2long))
 
#define NB_STR2LONGLONG   (sizeof(str2longlong)/sizeof(*str2longlong))
 

Functions

static NTSTATUS (WINAPI *pRtlUnicodeStringToAnsiString)(STRING *
 
static VOID (WINAPI *pRtlFreeAnsiString)(PSTRING)
 
static BOOLEAN (WINAPI *pRtlCreateUnicodeStringFromAsciiz)(PUNICODE_STRING
 
static int (WINAPIV *patoi)(const char *)
 
static long (WINAPIV *patol)(const char *)
 
static LONGLONG (WINAPIV *p_atoi64)(const char *)
 
static LPSTR (WINAPIV *p_itoa)(int
 
static LPWSTR (WINAPIV *p_itow)(int
 
static LPWSTR (__cdecl *p_wcslwr)(LPWSTR)
 
static void (__cdecl *p_qsort)(void *
 
static int (__cdecl *compar)(const void *
 
static const void *static void *__cdeclp_bsearch (void *, void *, size_t, size_t, int(__cdecl *compar)(const void *, const void *))
 
static const char static void InitFunctionPtrs (void)
 
static void one_itoa_test (int test_num, const ulong2str_t *ulong2str)
 
static void one_ltoa_test (int test_num, const ulong2str_t *ulong2str)
 
static void one_ultoa_test (int test_num, const ulong2str_t *ulong2str)
 
static void test_ulongtoa (void)
 
static void one_itow_test (int test_num, const ulong2str_t *ulong2str)
 
static void one_ltow_test (int test_num, const ulong2str_t *ulong2str)
 
static void one_ultow_test (int test_num, const ulong2str_t *ulong2str)
 
static void test_ulongtow (void)
 
static void one_i64toa_test (int test_num, const ulonglong2str_t *ulonglong2str)
 
static void one_ui64toa_test (int test_num, const ulonglong2str_t *ulonglong2str)
 
static void test_ulonglongtoa (void)
 
static void one_i64tow_test (int test_num, const ulonglong2str_t *ulonglong2str)
 
static void one_ui64tow_test (int test_num, const ulonglong2str_t *ulonglong2str)
 
static void test_ulonglongtow (void)
 
static void test_wtoi (void)
 
static void test_atoi (void)
 
static void test_atol (void)
 
static void test_wtol (void)
 
static void test_atoi64 (void)
 
static void test_wtoi64 (void)
 
static void test_wcschr (void)
 
static void test_wcsrchr (void)
 
static void test_wcslwrupr (void)
 
static int __cdecl intcomparefunc (const void *a, const void *b)
 
static int __cdecl charcomparefunc (const void *a, const void *b)
 
static int __cdecl strcomparefunc (const void *a, const void *b)
 
static void test_qsort (void)
 
static void test_bsearch (void)
 
static void test__snprintf (void)
 
 START_TEST (string)
 

Variables

static HMODULE hntdll = 0
 
static const UNICODE_STRING BOOLEAN
 
static LPCSTR
 
static LPSTR
 
static INT
 
static LPWSTR
 
static int
 
static WCHAR
 
static size_t
 
static const ulong2str_t ulong2str []
 
static const ulonglong2str_t ulonglong2str []
 
static const str2long_t str2long []
 
static const str2longlong_t str2longlong []
 

Macro Definition Documentation

◆ LARGE_STRI_BUFFER_LENGTH

#define LARGE_STRI_BUFFER_LENGTH   67

Definition at line 106 of file string.c.

◆ NB_STR2LONG

#define NB_STR2LONG   (sizeof(str2long)/sizeof(*str2long))

Definition at line 888 of file string.c.

◆ NB_STR2LONGLONG

#define NB_STR2LONGLONG   (sizeof(str2longlong)/sizeof(*str2longlong))

Definition at line 1071 of file string.c.

◆ NB_ULONG2STR

#define NB_ULONG2STR   (sizeof(ulong2str)/sizeof(*ulong2str))

Definition at line 215 of file string.c.

◆ NB_ULONGLONG2STR

#define NB_ULONGLONG2STR   (sizeof(ulonglong2str)/sizeof(*ulonglong2str))

Definition at line 591 of file string.c.

◆ ULL

#define ULL (   a,
  b 
)    (((ULONGLONG)(a) << 32) | (b))

Definition at line 442 of file string.c.

Function Documentation

◆ BOOLEAN()

static BOOLEAN ( WINAPI pRtlCreateUnicodeStringFromAsciiz)
static

◆ charcomparefunc()

static int __cdecl charcomparefunc ( const void a,
const void b 
)
static

Definition at line 1177 of file string.c.

1178{
1179 const char *p = a, *q = b;
1180
1181 ok (a != b, "must never get the same pointer\n");
1182
1183 return *p - *q;
1184}
#define ok(value,...)
Definition: atltest.h:57
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLfloat GLfloat p
Definition: glext.h:8902
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define a
Definition: ke_i.h:78
#define b
Definition: ke_i.h:79

Referenced by test_qsort().

◆ InitFunctionPtrs()

static const char static void InitFunctionPtrs ( void  )
static

Definition at line 65 of file string.c.

66{
67 hntdll = LoadLibraryA("ntdll.dll");
68 ok(hntdll != 0, "LoadLibrary failed\n");
69 if (hntdll) {
70 pRtlUnicodeStringToAnsiString = (void *)GetProcAddress(hntdll, "RtlUnicodeStringToAnsiString");
71 pRtlFreeAnsiString = (void *)GetProcAddress(hntdll, "RtlFreeAnsiString");
72 pRtlCreateUnicodeStringFromAsciiz = (void *)GetProcAddress(hntdll, "RtlCreateUnicodeStringFromAsciiz");
73 pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString");
74
75 patoi = (void *)GetProcAddress(hntdll, "atoi");
76 patol = (void *)GetProcAddress(hntdll, "atol");
77 p_atoi64 = (void *)GetProcAddress(hntdll, "_atoi64");
78 p_itoa = (void *)GetProcAddress(hntdll, "_itoa");
79 p_ltoa = (void *)GetProcAddress(hntdll, "_ltoa");
80 p_ultoa = (void *)GetProcAddress(hntdll, "_ultoa");
81 p_i64toa = (void *)GetProcAddress(hntdll, "_i64toa");
82 p_ui64toa = (void *)GetProcAddress(hntdll, "_ui64toa");
83
84 p_wtoi = (void *)GetProcAddress(hntdll, "_wtoi");
85 p_wtol = (void *)GetProcAddress(hntdll, "_wtol");
86 p_wtoi64 = (void *)GetProcAddress(hntdll, "_wtoi64");
87 p_itow = (void *)GetProcAddress(hntdll, "_itow");
88 p_ltow = (void *)GetProcAddress(hntdll, "_ltow");
89 p_ultow = (void *)GetProcAddress(hntdll, "_ultow");
90 p_i64tow = (void *)GetProcAddress(hntdll, "_i64tow");
91 p_ui64tow = (void *)GetProcAddress(hntdll, "_ui64tow");
92
93 p_wcslwr = (void *)GetProcAddress(hntdll, "_wcslwr");
94 p_wcsupr = (void *)GetProcAddress(hntdll, "_wcsupr");
95
96 p_wcschr= (void *)GetProcAddress(hntdll, "wcschr");
97 p_wcsrchr= (void *)GetProcAddress(hntdll, "wcsrchr");
98 p_qsort= (void *)GetProcAddress(hntdll, "qsort");
99 p_bsearch= (void *)GetProcAddress(hntdll, "bsearch");
100
101 p__snprintf = (void *)GetProcAddress(hntdll, "_snprintf");
102 } /* if */
103}
#define GetProcAddress(x, y)
Definition: compat.h:753
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static HMODULE hntdll
Definition: string.c:30
static const void *static void *__cdecl * p_bsearch(void *, void *, size_t, size_t, int(__cdecl *compar)(const void *, const void *))

Referenced by START_TEST().

◆ int() [1/2]

static int ( __cdecl compar) const

◆ int() [2/2]

static int ( WINAPIV patoi) const
static

◆ intcomparefunc()

static int __cdecl intcomparefunc ( const void a,
const void b 
)
static

Definition at line 1168 of file string.c.

1169{
1170 const int *p = a, *q = b;
1171
1172 ok (a != b, "must never get the same pointer\n");
1173
1174 return *p - *q;
1175}

Referenced by test_bsearch(), and test_qsort().

◆ long()

static long ( WINAPIV patol) const
static

◆ LONGLONG()

static LONGLONG ( WINAPIV p_atoi64) const
static

◆ LPSTR()

static LPSTR ( WINAPIV p_itoa)
static

◆ LPWSTR() [1/2]

static LPWSTR ( __cdecl p_wcslwr)
static

◆ LPWSTR() [2/2]

static LPWSTR ( WINAPIV p_itow)
static

◆ NTSTATUS()

static NTSTATUS ( WINAPI pRtlUnicodeStringToAnsiString)
static

◆ one_i64toa_test()

static void one_i64toa_test ( int  test_num,
const ulonglong2str_t ulonglong2str 
)
static

Definition at line 594 of file string.c.

595{
597 char dest_str[LARGE_STRI_BUFFER_LENGTH + 1];
598
599 memset(dest_str, '-', LARGE_STRI_BUFFER_LENGTH);
600 dest_str[LARGE_STRI_BUFFER_LENGTH] = '\0';
601 result = p_i64toa(ulonglong2str->value, dest_str, ulonglong2str->base);
602 ok(result == dest_str,
603 "(test %d): _i64toa(%s, [out], %d) has result %p, expected: %p\n",
605 if (ulonglong2str->mask & 0x04) {
606 if (memcmp(dest_str, ulonglong2str->Buffer, LARGE_STRI_BUFFER_LENGTH) != 0) {
607 if (memcmp(dest_str, ulonglong2str[1].Buffer, LARGE_STRI_BUFFER_LENGTH) != 0) {
609 "(test %d): _i64toa(%s, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
612 } /* if */
613 } /* if */
614 } else {
616 "(test %d): _i64toa(%s, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
619 } /* if */
620}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: bufpool.h:45
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
GLuint64EXT * result
Definition: glext.h:11304
static const ulonglong2str_t ulonglong2str[]
Definition: string.c:452
#define LARGE_STRI_BUFFER_LENGTH
Definition: string.c:106
#define memset(x, y, z)
Definition: compat.h:39
const char * Buffer
Definition: string.c:447
ULONGLONG value
Definition: string.c:446
char * LPSTR
Definition: xmlstorage.h:182

Referenced by test_ulonglongtoa().

◆ one_i64tow_test()

static void one_i64tow_test ( int  test_num,
const ulonglong2str_t ulonglong2str 
)
static

Definition at line 658 of file string.c.

659{
660 int pos;
661 WCHAR expected_wstr[LARGE_STRI_BUFFER_LENGTH + 1];
662 WCHAR dest_wstr[LARGE_STRI_BUFFER_LENGTH + 1];
663 UNICODE_STRING unicode_string;
664 STRING ansi_str;
666
667 for (pos = 0; pos < LARGE_STRI_BUFFER_LENGTH; pos++) {
668 expected_wstr[pos] = ulonglong2str->Buffer[pos];
669 } /* for */
670 expected_wstr[LARGE_STRI_BUFFER_LENGTH] = '\0';
671
672 for (pos = 0; pos < LARGE_STRI_BUFFER_LENGTH; pos++) {
673 dest_wstr[pos] = '-';
674 } /* for */
675 dest_wstr[LARGE_STRI_BUFFER_LENGTH] = '\0';
676 unicode_string.Length = LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR);
677 unicode_string.MaximumLength = unicode_string.Length + sizeof(WCHAR);
678 unicode_string.Buffer = dest_wstr;
679
680 result = p_i64tow(ulonglong2str->value, dest_wstr, ulonglong2str->base);
681 pRtlUnicodeStringToAnsiString(&ansi_str, &unicode_string, 1);
682 ok(result == dest_wstr,
683 "(test %d): _i64tow(0x%s, [out], %d) has result %p, expected: %p\n",
685 if (ulonglong2str->mask & 0x04) {
686 if (memcmp(dest_wstr, expected_wstr, LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR)) != 0) {
687 for (pos = 0; pos < LARGE_STRI_BUFFER_LENGTH; pos++) {
688 expected_wstr[pos] = ulonglong2str[1].Buffer[pos];
689 } /* for */
690 expected_wstr[LARGE_STRI_BUFFER_LENGTH] = '\0';
691 if (memcmp(dest_wstr, expected_wstr, LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR)) != 0) {
692 ok(memcmp(dest_wstr, expected_wstr, LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR)) == 0,
693 "(test %d): _i64tow(0x%s, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
695 ulonglong2str->base, ansi_str.Buffer, ulonglong2str->Buffer);
696 } /* if */
697 } /* if */
698 } else {
699 ok(memcmp(dest_wstr, expected_wstr, LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR)) == 0,
700 "(test %d): _i64tow(0x%s, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
702 ulonglong2str->base, ansi_str.Buffer, ulonglong2str->Buffer);
703 } /* if */
704 pRtlFreeAnsiString(&ansi_str);
705}
std::wstring STRING
Definition: fontsub.cpp:33
USHORT MaximumLength
Definition: env_spec_w32.h:370
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by test_ulonglongtow().

◆ one_itoa_test()

static void one_itoa_test ( int  test_num,
const ulong2str_t ulong2str 
)
static

Definition at line 218 of file string.c.

219{
220 char dest_str[LARGE_STRI_BUFFER_LENGTH + 1];
221 int value;
223
224 memset(dest_str, '-', LARGE_STRI_BUFFER_LENGTH);
225 dest_str[LARGE_STRI_BUFFER_LENGTH] = '\0';
227 result = p_itoa(value, dest_str, ulong2str->base);
228 ok(result == dest_str,
229 "(test %d): _itoa(%d, [out], %d) has result %p, expected: %p\n",
230 test_num, value, ulong2str->base, result, dest_str);
232 "(test %d): _itoa(%d, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
233 test_num, value, ulong2str->base, dest_str, ulong2str->Buffer);
234}
static const ulong2str_t ulong2str[]
Definition: string.c:116
ULONG value
Definition: string.c:110
const char * Buffer
Definition: string.c:111
int base
Definition: string.c:109
Definition: pdh_main.c:94

Referenced by test_ulongtoa().

◆ one_itow_test()

static void one_itow_test ( int  test_num,
const ulong2str_t ulong2str 
)
static

Definition at line 293 of file string.c.

294{
295 int pos;
296 WCHAR expected_wstr[LARGE_STRI_BUFFER_LENGTH + 1];
297 WCHAR dest_wstr[LARGE_STRI_BUFFER_LENGTH + 1];
298 UNICODE_STRING unicode_string;
299 STRING ansi_str;
300 int value;
302
303 for (pos = 0; pos < LARGE_STRI_BUFFER_LENGTH; pos++) {
304 expected_wstr[pos] = ulong2str->Buffer[pos];
305 } /* for */
306 expected_wstr[LARGE_STRI_BUFFER_LENGTH] = '\0';
307
308 for (pos = 0; pos < LARGE_STRI_BUFFER_LENGTH; pos++) {
309 dest_wstr[pos] = '-';
310 } /* for */
311 dest_wstr[LARGE_STRI_BUFFER_LENGTH] = '\0';
312 unicode_string.Length = LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR);
313 unicode_string.MaximumLength = unicode_string.Length + sizeof(WCHAR);
314 unicode_string.Buffer = dest_wstr;
316 result = p_itow(value, dest_wstr, ulong2str->base);
317 pRtlUnicodeStringToAnsiString(&ansi_str, &unicode_string, 1);
318 ok(result == dest_wstr,
319 "(test %d): _itow(%d, [out], %d) has result %p, expected: %p\n",
320 test_num, value, ulong2str->base, result, dest_wstr);
321 ok(memcmp(dest_wstr, expected_wstr, LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR)) == 0,
322 "(test %d): _itow(%d, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
323 test_num, value, ulong2str->base, ansi_str.Buffer, ulong2str->Buffer);
324 pRtlFreeAnsiString(&ansi_str);
325}

Referenced by test_ulongtow().

◆ one_ltoa_test()

static void one_ltoa_test ( int  test_num,
const ulong2str_t ulong2str 
)
static

Definition at line 237 of file string.c.

238{
239 char dest_str[LARGE_STRI_BUFFER_LENGTH + 1];
240 LONG value;
242
243 memset(dest_str, '-', LARGE_STRI_BUFFER_LENGTH);
244 dest_str[LARGE_STRI_BUFFER_LENGTH] = '\0';
246 result = p_ltoa(ulong2str->value, dest_str, ulong2str->base);
247 ok(result == dest_str,
248 "(test %d): _ltoa(%d, [out], %d) has result %p, expected: %p\n",
249 test_num, value, ulong2str->base, result, dest_str);
251 "(test %d): _ltoa(%d, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
252 test_num, value, ulong2str->base, dest_str, ulong2str->Buffer);
253}
long LONG
Definition: pedump.c:60

Referenced by test_ulongtoa().

◆ one_ltow_test()

static void one_ltow_test ( int  test_num,
const ulong2str_t ulong2str 
)
static

Definition at line 328 of file string.c.

329{
330 int pos;
331 WCHAR expected_wstr[LARGE_STRI_BUFFER_LENGTH + 1];
332 WCHAR dest_wstr[LARGE_STRI_BUFFER_LENGTH + 1];
333 UNICODE_STRING unicode_string;
334 STRING ansi_str;
335 LONG value;
337
338 for (pos = 0; pos < LARGE_STRI_BUFFER_LENGTH; pos++) {
339 expected_wstr[pos] = ulong2str->Buffer[pos];
340 } /* for */
341 expected_wstr[LARGE_STRI_BUFFER_LENGTH] = '\0';
342
343 for (pos = 0; pos < LARGE_STRI_BUFFER_LENGTH; pos++) {
344 dest_wstr[pos] = '-';
345 } /* for */
346 dest_wstr[LARGE_STRI_BUFFER_LENGTH] = '\0';
347 unicode_string.Length = LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR);
348 unicode_string.MaximumLength = unicode_string.Length + sizeof(WCHAR);
349 unicode_string.Buffer = dest_wstr;
350
352 result = p_ltow(value, dest_wstr, ulong2str->base);
353 pRtlUnicodeStringToAnsiString(&ansi_str, &unicode_string, 1);
354 ok(result == dest_wstr,
355 "(test %d): _ltow(%d, [out], %d) has result %p, expected: %p\n",
356 test_num, value, ulong2str->base, result, dest_wstr);
357 ok(memcmp(dest_wstr, expected_wstr, LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR)) == 0,
358 "(test %d): _ltow(%d, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
359 test_num, value, ulong2str->base, ansi_str.Buffer, ulong2str->Buffer);
360 pRtlFreeAnsiString(&ansi_str);
361}

Referenced by test_ulongtow().

◆ one_ui64toa_test()

static void one_ui64toa_test ( int  test_num,
const ulonglong2str_t ulonglong2str 
)
static

Definition at line 623 of file string.c.

624{
626 char dest_str[LARGE_STRI_BUFFER_LENGTH + 1];
627
628 memset(dest_str, '-', LARGE_STRI_BUFFER_LENGTH);
629 dest_str[LARGE_STRI_BUFFER_LENGTH] = '\0';
630 result = p_ui64toa(ulonglong2str->value, dest_str, ulonglong2str->base);
631 ok(result == dest_str,
632 "(test %d): _ui64toa(%s, [out], %d) has result %p, expected: %p\n",
635 "(test %d): _ui64toa(%s, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
638}

Referenced by test_ulonglongtoa().

◆ one_ui64tow_test()

static void one_ui64tow_test ( int  test_num,
const ulonglong2str_t ulonglong2str 
)
static

Definition at line 708 of file string.c.

709{
710 int pos;
711 WCHAR expected_wstr[LARGE_STRI_BUFFER_LENGTH + 1];
712 WCHAR dest_wstr[LARGE_STRI_BUFFER_LENGTH + 1];
713 UNICODE_STRING unicode_string;
714 STRING ansi_str;
716
717 for (pos = 0; pos < LARGE_STRI_BUFFER_LENGTH; pos++) {
718 expected_wstr[pos] = ulonglong2str->Buffer[pos];
719 } /* for */
720 expected_wstr[LARGE_STRI_BUFFER_LENGTH] = '\0';
721
722 for (pos = 0; pos < LARGE_STRI_BUFFER_LENGTH; pos++) {
723 dest_wstr[pos] = '-';
724 } /* for */
725 dest_wstr[LARGE_STRI_BUFFER_LENGTH] = '\0';
726 unicode_string.Length = LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR);
727 unicode_string.MaximumLength = unicode_string.Length + sizeof(WCHAR);
728 unicode_string.Buffer = dest_wstr;
729
730 result = p_ui64tow(ulonglong2str->value, dest_wstr, ulonglong2str->base);
731 pRtlUnicodeStringToAnsiString(&ansi_str, &unicode_string, 1);
732 ok(result == dest_wstr,
733 "(test %d): _ui64tow(0x%s, [out], %d) has result %p, expected: %p\n",
735 ulonglong2str->base, result, dest_wstr);
736 ok(memcmp(dest_wstr, expected_wstr, LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR)) == 0,
737 "(test %d): _ui64tow(0x%s, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
739 ulonglong2str->base, ansi_str.Buffer, ulonglong2str->Buffer);
740 pRtlFreeAnsiString(&ansi_str);
741}

Referenced by test_ulonglongtow().

◆ one_ultoa_test()

static void one_ultoa_test ( int  test_num,
const ulong2str_t ulong2str 
)
static

Definition at line 256 of file string.c.

257{
258 char dest_str[LARGE_STRI_BUFFER_LENGTH + 1];
259 ULONG value;
261
262 memset(dest_str, '-', LARGE_STRI_BUFFER_LENGTH);
263 dest_str[LARGE_STRI_BUFFER_LENGTH] = '\0';
265 result = p_ultoa(ulong2str->value, dest_str, ulong2str->base);
266 ok(result == dest_str,
267 "(test %d): _ultoa(%u, [out], %d) has result %p, expected: %p\n",
268 test_num, value, ulong2str->base, result, dest_str);
270 "(test %d): _ultoa(%u, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
271 test_num, value, ulong2str->base, dest_str, ulong2str->Buffer);
272}
uint32_t ULONG
Definition: typedefs.h:59

Referenced by test_ulongtoa().

◆ one_ultow_test()

static void one_ultow_test ( int  test_num,
const ulong2str_t ulong2str 
)
static

Definition at line 364 of file string.c.

365{
366 int pos;
367 WCHAR expected_wstr[LARGE_STRI_BUFFER_LENGTH + 1];
368 WCHAR dest_wstr[LARGE_STRI_BUFFER_LENGTH + 1];
369 UNICODE_STRING unicode_string;
370 STRING ansi_str;
371 ULONG value;
373
374 for (pos = 0; pos < LARGE_STRI_BUFFER_LENGTH; pos++) {
375 expected_wstr[pos] = ulong2str->Buffer[pos];
376 } /* for */
377 expected_wstr[LARGE_STRI_BUFFER_LENGTH] = '\0';
378
379 for (pos = 0; pos < LARGE_STRI_BUFFER_LENGTH; pos++) {
380 dest_wstr[pos] = '-';
381 } /* for */
382 dest_wstr[LARGE_STRI_BUFFER_LENGTH] = '\0';
383 unicode_string.Length = LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR);
384 unicode_string.MaximumLength = unicode_string.Length + sizeof(WCHAR);
385 unicode_string.Buffer = dest_wstr;
386
388 result = p_ultow(value, dest_wstr, ulong2str->base);
389 pRtlUnicodeStringToAnsiString(&ansi_str, &unicode_string, 1);
390 ok(result == dest_wstr,
391 "(test %d): _ultow(%u, [out], %d) has result %p, expected: %p\n",
392 test_num, value, ulong2str->base, result, dest_wstr);
393 ok(memcmp(dest_wstr, expected_wstr, LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR)) == 0,
394 "(test %d): _ultow(%u, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
395 test_num, value, ulong2str->base, ansi_str.Buffer, ulong2str->Buffer);
396 pRtlFreeAnsiString(&ansi_str);
397}

Referenced by test_ulongtow().

◆ p_bsearch()

static const void *static void *__cdecl * p_bsearch ( void ,
void ,
size_t  ,
size_t  ,
int(__cdecl *compar)(const void *, const void *)   
)
static

◆ START_TEST()

START_TEST ( string  )

Definition at line 1304 of file string.c.

1305{
1307
1308 if (p_ultoa)
1309 test_ulongtoa();
1310 if (p_ui64toa)
1312 if (p_atoi64)
1313 test_atoi64();
1314 if (p_ultow)
1315 test_ulongtow();
1316 if (p_ui64tow)
1318 if (p_wtoi)
1319 test_wtoi();
1320 if (p_wtol)
1321 test_wtol();
1322 if (p_wtoi64)
1323 test_wtoi64();
1324 if (p_wcschr)
1325 test_wcschr();
1326 if (p_wcsrchr)
1327 test_wcsrchr();
1328 if (p_wcslwr && p_wcsupr)
1330 if (patoi)
1331 test_atoi();
1332 if (patol)
1333 test_atol();
1334 if (p_qsort)
1335 test_qsort();
1336 if (p_bsearch)
1337 test_bsearch();
1338 if (p__snprintf)
1340}
static void test_atoi(void)
Definition: string.c:3117
static void test_atol(void)
Definition: string.c:3134
static void test_ulongtow(void)
Definition: string.c:400
static void test_ulonglongtow(void)
Definition: string.c:744
static void test__snprintf(void)
Definition: string.c:1273
static void test_bsearch(void)
Definition: string.c:1255
static void test_wtol(void)
Definition: string.c:933
static void test_wcsrchr(void)
Definition: string.c:1134
static void test_wcschr(void)
Definition: string.c:1122
static void test_wcslwrupr(void)
Definition: string.c:1146
static void test_ulonglongtoa(void)
Definition: string.c:641
static const char static void InitFunctionPtrs(void)
Definition: string.c:65
static void test_qsort(void)
Definition: string.c:1196
static void test_ulongtoa(void)
Definition: string.c:275
static void test_atoi64(void)
Definition: string.c:1074
static void test_wtoi64(void)
Definition: string.c:1097
static void test_wtoi(void)
Definition: string.c:891

◆ strcomparefunc()

static int __cdecl strcomparefunc ( const void a,
const void b 
)
static

Definition at line 1186 of file string.c.

1187{
1188 const char * const *p = a;
1189 const char * const *q = b;
1190
1191 ok (a != b, "must never get the same pointer\n");
1192
1193 return lstrcmpA(*p, *q);
1194}
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18

Referenced by test_qsort().

◆ test__snprintf()

static void test__snprintf ( void  )
static

Definition at line 1273 of file string.c.

1274{
1275 const char *origstring = "XXXXXXXXXXXX";
1276 const char *teststring = "hello world";
1277 char buffer[32];
1278 int res;
1279
1280 res = p__snprintf(NULL, 0, teststring);
1281 ok(res == lstrlenA(teststring) || broken(res == -1) /* <= w2k */,
1282 "_snprintf returned %d, expected %d.\n", res, lstrlenA(teststring));
1283
1284 if (res != -1)
1285 {
1286 res = p__snprintf(NULL, 1, teststring);
1287 ok(res == lstrlenA(teststring) /* WinXP */ || res < 0 /* Vista and greater */,
1288 "_snprintf returned %d, expected %d or < 0.\n", res, lstrlenA(teststring));
1289 }
1290 res = p__snprintf(buffer, strlen(teststring) - 1, teststring);
1291 ok(res < 0, "_snprintf returned %d, expected < 0.\n", res);
1292
1293 strcpy(buffer, origstring);
1294 res = p__snprintf(buffer, strlen(teststring), teststring);
1295 ok(res == lstrlenA(teststring), "_snprintf returned %d, expected %d.\n", res, lstrlenA(teststring));
1296 ok(!strcmp(buffer, "hello worldX"), "_snprintf returned buffer '%s', expected 'hello worldX'.\n", buffer);
1297
1298 strcpy(buffer, origstring);
1299 res = p__snprintf(buffer, strlen(teststring) + 1, teststring);
1300 ok(res == lstrlenA(teststring), "_snprintf returned %d, expected %d.\n", res, lstrlenA(teststring));
1301 ok(!strcmp(buffer, teststring), "_snprintf returned buffer '%s', expected '%s'.\n", buffer, teststring);
1302}
#define broken(x)
Definition: _sntprintf.h:21
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613
GLuint buffer
Definition: glext.h:5915
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145

Referenced by START_TEST().

◆ test_atoi()

static void test_atoi ( void  )
static

Definition at line 907 of file string.c.

908{
909 int test_num;
910 int result;
911
912 for (test_num = 0; test_num < NB_STR2LONG; test_num++) {
913 result = patoi(str2long[test_num].str);
914 ok(result == str2long[test_num].value,
915 "(test %d): call failed: _atoi(\"%s\") has result %d, expected: %d\n",
916 test_num, str2long[test_num].str, result, str2long[test_num].value);
917 }
918}
static const str2long_t str2long[]
Definition: string.c:785
#define NB_STR2LONG
Definition: string.c:888
const WCHAR * str

◆ test_atoi64()

static void test_atoi64 ( void  )
static

Definition at line 1074 of file string.c.

1075{
1076 int test_num;
1078
1079 for (test_num = 0; test_num < NB_STR2LONGLONG; test_num++) {
1080 result = p_atoi64(str2longlong[test_num].str);
1081 if (str2longlong[test_num].overflow)
1082 ok(result == str2longlong[test_num].value ||
1083 (result == ((str2longlong[test_num].overflow == -1) ?
1084 ULL(0x80000000,0x00000000) : ULL(0x7fffffff,0xffffffff))),
1085 "(test %d): call failed: _atoi64(\"%s\") has result 0x%s, expected: 0x%s\n",
1086 test_num, str2longlong[test_num].str, wine_dbgstr_longlong(result),
1088 else
1089 ok(result == str2longlong[test_num].value,
1090 "(test %d): call failed: _atoi64(\"%s\") has result 0x%s, expected: 0x%s\n",
1091 test_num, str2longlong[test_num].str, wine_dbgstr_longlong(result),
1093 }
1094}
#define NB_STR2LONGLONG
Definition: string.c:1071
#define ULL(a, b)
Definition: string.c:442
static const str2longlong_t str2longlong[]
Definition: string.c:956
int64_t LONGLONG
Definition: typedefs.h:68

Referenced by START_TEST().

◆ test_atol()

static void test_atol ( void  )
static

Definition at line 920 of file string.c.

921{
922 int test_num;
923 int result;
924
925 for (test_num = 0; test_num < NB_STR2LONG; test_num++) {
926 result = patol(str2long[test_num].str);
927 ok(result == str2long[test_num].value,
928 "(test %d): call failed: _atol(\"%s\") has result %d, expected: %d\n",
929 test_num, str2long[test_num].str, result, str2long[test_num].value);
930 }
931}

◆ test_bsearch()

static void test_bsearch ( void  )
static

Definition at line 1255 of file string.c.

1256{
1257 int arr[7] = { 1, 3, 4, 8, 16, 23, 42 };
1258 int *x, l, i, j;
1259
1260 /* just try all array sizes */
1261 for (j=1;j<sizeof(arr)/sizeof(arr[0]);j++) {
1262 for (i=0;i<j;i++) {
1263 l = arr[i];
1264 x = p_bsearch (&l, arr, j, sizeof(arr[0]), intcomparefunc);
1265 ok (x == &arr[i], "bsearch did not find %d entry in loopsize %d.\n", i, j);
1266 }
1267 l = 4242;
1268 x = p_bsearch (&l, arr, j, sizeof(arr[0]), intcomparefunc);
1269 ok (x == NULL, "bsearch did find 4242 entry in loopsize %d.\n", j);
1270 }
1271}
r l[0]
Definition: byte_order.h:168
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static int __cdecl intcomparefunc(const void *a, const void *b)
Definition: string.c:1168

Referenced by START_TEST().

◆ test_qsort()

static void test_qsort ( void  )
static

Definition at line 1196 of file string.c.

1197{
1198 int arr[5] = { 23, 42, 8, 4, 16 };
1199 char carr[5] = { 42, 23, 4, 8, 16 };
1200 const char *strarr[7] = {
1201 "Hello",
1202 "Wine",
1203 "World",
1204 "!",
1205 "Hopefully",
1206 "Sorted",
1207 "."
1208 };
1209
1210 p_qsort ((void*)arr, 0, sizeof(int), intcomparefunc);
1211 ok(arr[0] == 23, "badly sorted, nmemb=0, arr[0] is %d\n", arr[0]);
1212 ok(arr[1] == 42, "badly sorted, nmemb=0, arr[1] is %d\n", arr[1]);
1213 ok(arr[2] == 8, "badly sorted, nmemb=0, arr[2] is %d\n", arr[2]);
1214 ok(arr[3] == 4, "badly sorted, nmemb=0, arr[3] is %d\n", arr[3]);
1215 ok(arr[4] == 16, "badly sorted, nmemb=0, arr[4] is %d\n", arr[4]);
1216
1217 p_qsort ((void*)arr, 1, sizeof(int), intcomparefunc);
1218 ok(arr[0] == 23, "badly sorted, nmemb=1, arr[0] is %d\n", arr[0]);
1219 ok(arr[1] == 42, "badly sorted, nmemb=1, arr[1] is %d\n", arr[1]);
1220 ok(arr[2] == 8, "badly sorted, nmemb=1, arr[2] is %d\n", arr[2]);
1221 ok(arr[3] == 4, "badly sorted, nmemb=1, arr[3] is %d\n", arr[3]);
1222 ok(arr[4] == 16, "badly sorted, nmemb=1, arr[4] is %d\n", arr[4]);
1223
1224 p_qsort ((void*)arr, 5, 0, intcomparefunc);
1225 ok(arr[0] == 23, "badly sorted, size=0, arr[0] is %d\n", arr[0]);
1226 ok(arr[1] == 42, "badly sorted, size=0, arr[1] is %d\n", arr[1]);
1227 ok(arr[2] == 8, "badly sorted, size=0, arr[2] is %d\n", arr[2]);
1228 ok(arr[3] == 4, "badly sorted, size=0, arr[3] is %d\n", arr[3]);
1229 ok(arr[4] == 16, "badly sorted, size=0, arr[4] is %d\n", arr[4]);
1230
1231 p_qsort ((void*)arr, 5, sizeof(int), intcomparefunc);
1232 ok(arr[0] == 4, "badly sorted, arr[0] is %d\n", arr[0]);
1233 ok(arr[1] == 8, "badly sorted, arr[1] is %d\n", arr[1]);
1234 ok(arr[2] == 16, "badly sorted, arr[2] is %d\n", arr[2]);
1235 ok(arr[3] == 23, "badly sorted, arr[3] is %d\n", arr[3]);
1236 ok(arr[4] == 42, "badly sorted, arr[4] is %d\n", arr[4]);
1237
1238 p_qsort ((void*)carr, 5, sizeof(char), charcomparefunc);
1239 ok(carr[0] == 4, "badly sorted, carr[0] is %d\n", carr[0]);
1240 ok(carr[1] == 8, "badly sorted, carr[1] is %d\n", carr[1]);
1241 ok(carr[2] == 16, "badly sorted, carr[2] is %d\n", carr[2]);
1242 ok(carr[3] == 23, "badly sorted, carr[3] is %d\n", carr[3]);
1243 ok(carr[4] == 42, "badly sorted, carr[4] is %d\n", carr[4]);
1244
1245 p_qsort ((void*)strarr, 7, sizeof(char*), strcomparefunc);
1246 ok(!strcmp(strarr[0],"!"), "badly sorted, strarr[0] is %s\n", strarr[0]);
1247 ok(!strcmp(strarr[1],"."), "badly sorted, strarr[1] is %s\n", strarr[1]);
1248 ok(!strcmp(strarr[2],"Hello"), "badly sorted, strarr[2] is %s\n", strarr[2]);
1249 ok(!strcmp(strarr[3],"Hopefully"), "badly sorted, strarr[3] is %s\n", strarr[3]);
1250 ok(!strcmp(strarr[4],"Sorted"), "badly sorted, strarr[4] is %s\n", strarr[4]);
1251 ok(!strcmp(strarr[5],"Wine"), "badly sorted, strarr[5] is %s\n", strarr[5]);
1252 ok(!strcmp(strarr[6],"World"), "badly sorted, strarr[6] is %s\n", strarr[6]);
1253}
static int __cdecl charcomparefunc(const void *a, const void *b)
Definition: string.c:1177
static int __cdecl strcomparefunc(const void *a, const void *b)
Definition: string.c:1186

Referenced by START_TEST().

◆ test_ulonglongtoa()

static void test_ulonglongtoa ( void  )
static

Definition at line 641 of file string.c.

642{
643 int test_num;
644
645 for (test_num = 0; test_num < NB_ULONGLONG2STR; test_num++) {
646 if (ulonglong2str[test_num].mask & 0x01) {
647 one_i64toa_test(test_num, &ulonglong2str[test_num]);
648 } /* if */
649 if (p_ui64toa != NULL) {
650 if (ulonglong2str[test_num].mask & 0x02) {
651 one_ui64toa_test(test_num, &ulonglong2str[test_num]);
652 } /* if */
653 } /* if */
654 } /* for */
655}
GLenum GLint GLuint mask
Definition: glext.h:6028
static void one_ui64toa_test(int test_num, const ulonglong2str_t *ulonglong2str)
Definition: string.c:623
static void one_i64toa_test(int test_num, const ulonglong2str_t *ulonglong2str)
Definition: string.c:594
#define NB_ULONGLONG2STR
Definition: string.c:591

Referenced by START_TEST().

◆ test_ulonglongtow()

static void test_ulonglongtow ( void  )
static

Definition at line 744 of file string.c.

745{
746 int test_num;
748
749 for (test_num = 0; test_num < NB_ULONGLONG2STR; test_num++) {
750 if (ulonglong2str[test_num].mask & 0x10) {
751 one_i64tow_test(test_num, &ulonglong2str[test_num]);
752 } /* if */
753 if (p_ui64tow) {
754 if (ulonglong2str[test_num].mask & 0x20) {
755 one_ui64tow_test(test_num, &ulonglong2str[test_num]);
756 } /* if */
757 } /* if */
758 } /* for */
759
760 if (0) {
761 /* Crashes on XP and W2K3 */
762 result = p_i64tow(ulonglong2str[0].value, NULL, 10);
763 ok(result == NULL,
764 "(test d): _i64tow(0x%s, NULL, 10) has result %p, expected: NULL\n",
766 }
767
768 if (p_ui64tow) {
769 if (0) {
770 /* Crashes on XP and W2K3 */
771 result = p_ui64tow(ulonglong2str[0].value, NULL, 10);
772 ok(result == NULL,
773 "(test e): _ui64tow(0x%s, NULL, 10) has result %p, expected: NULL\n",
775 }
776 } /* if */
777}
static void one_i64tow_test(int test_num, const ulonglong2str_t *ulonglong2str)
Definition: string.c:658
static void one_ui64tow_test(int test_num, const ulonglong2str_t *ulonglong2str)
Definition: string.c:708

Referenced by START_TEST().

◆ test_ulongtoa()

static void test_ulongtoa ( void  )
static

Definition at line 275 of file string.c.

276{
277 int test_num;
278
279 for (test_num = 0; test_num < NB_ULONG2STR; test_num++) {
280 if (ulong2str[test_num].mask & 0x01) {
281 one_itoa_test(test_num, &ulong2str[test_num]);
282 } /* if */
283 if (ulong2str[test_num].mask & 0x02) {
284 one_ltoa_test(test_num, &ulong2str[test_num]);
285 } /* if */
286 if (ulong2str[test_num].mask & 0x04) {
287 one_ultoa_test(test_num, &ulong2str[test_num]);
288 } /* if */
289 } /* for */
290}
static void one_itoa_test(int test_num, const ulong2str_t *ulong2str)
Definition: string.c:218
#define NB_ULONG2STR
Definition: string.c:215
static void one_ultoa_test(int test_num, const ulong2str_t *ulong2str)
Definition: string.c:256
static void one_ltoa_test(int test_num, const ulong2str_t *ulong2str)
Definition: string.c:237

Referenced by START_TEST().

◆ test_ulongtow()

static void test_ulongtow ( void  )
static

Definition at line 400 of file string.c.

401{
402 int test_num;
404
405 for (test_num = 0; test_num < NB_ULONG2STR; test_num++) {
406 if (ulong2str[test_num].mask & 0x10) {
407 one_itow_test(test_num, &ulong2str[test_num]);
408 } /* if */
409 if (ulong2str[test_num].mask & 0x20) {
410 one_ltow_test(test_num, &ulong2str[test_num]);
411 } /* if */
412 if (ulong2str[test_num].mask & 0x40) {
413 one_ultow_test(test_num, &ulong2str[test_num]);
414 } /* if */
415 } /* for */
416
417 if (0) {
418 /* Crashes on XP and W2K3 */
419 result = p_itow(ulong2str[0].value, NULL, 10);
420 ok(result == NULL,
421 "(test a): _itow(%d, NULL, 10) has result %p, expected: NULL\n",
423 }
424
425 if (0) {
426 /* Crashes on XP and W2K3 */
427 result = p_ltow(ulong2str[0].value, NULL, 10);
428 ok(result == NULL,
429 "(test b): _ltow(%d, NULL, 10) has result %p, expected: NULL\n",
431 }
432
433 if (0) {
434 /* Crashes on XP and W2K3 */
435 result = p_ultow(ulong2str[0].value, NULL, 10);
436 ok(result == NULL,
437 "(test c): _ultow(%d, NULL, 10) has result %p, expected: NULL\n",
439 }
440}
static void one_itow_test(int test_num, const ulong2str_t *ulong2str)
Definition: string.c:293
static void one_ltow_test(int test_num, const ulong2str_t *ulong2str)
Definition: string.c:328
static void one_ultow_test(int test_num, const ulong2str_t *ulong2str)
Definition: string.c:364

Referenced by START_TEST().

◆ test_wcschr()

static void test_wcschr ( void  )
static

Definition at line 1122 of file string.c.

1123{
1124 static const WCHAR teststringW[] = {'a','b','r','a','c','a','d','a','b','r','a',0};
1125
1126 ok(p_wcschr(teststringW, 'a') == teststringW + 0,
1127 "wcschr should have returned a pointer to the first 'a' character\n");
1128 ok(p_wcschr(teststringW, 0) == teststringW + 11,
1129 "wcschr should have returned a pointer to the null terminator\n");
1130 ok(p_wcschr(teststringW, 'x') == NULL,
1131 "wcschr should have returned NULL\n");
1132}

Referenced by START_TEST().

◆ test_wcslwrupr()

static void test_wcslwrupr ( void  )
static

Definition at line 1146 of file string.c.

1147{
1148 static WCHAR teststringW[] = {'a','b','r','a','c','a','d','a','b','r','a',0};
1149 static WCHAR emptyW[] = {0};
1150 static const WCHAR constemptyW[] = {0};
1151
1152 if (0) /* crashes on native */
1153 {
1154 static const WCHAR conststringW[] = {'a','b','r','a','c','a','d','a','b','r','a',0};
1155 ok(p_wcslwr((LPWSTR)conststringW) == conststringW, "p_wcslwr returned different string\n");
1156 ok(p_wcsupr((LPWSTR)conststringW) == conststringW, "p_wcsupr returned different string\n");
1157 ok(p_wcslwr(NULL) == NULL, "p_wcslwr didn't returned NULL\n");
1158 ok(p_wcsupr(NULL) == NULL, "p_wcsupr didn't returned NULL\n");
1159 }
1160 ok(p_wcslwr(teststringW) == teststringW, "p_wcslwr returned different string\n");
1161 ok(p_wcsupr(teststringW) == teststringW, "p_wcsupr returned different string\n");
1162 ok(p_wcslwr(emptyW) == emptyW, "p_wcslwr returned different string\n");
1163 ok(p_wcsupr(emptyW) == emptyW, "p_wcsupr returned different string\n");
1164 ok(p_wcslwr((LPWSTR)constemptyW) == constemptyW, "p_wcslwr returned different string\n");
1165 ok(p_wcsupr((LPWSTR)constemptyW) == constemptyW, "p_wcsupr returned different string\n");
1166}
static const WCHAR emptyW[]
Definition: navigate.c:40

Referenced by START_TEST().

◆ test_wcsrchr()

static void test_wcsrchr ( void  )
static

Definition at line 1134 of file string.c.

1135{
1136 static const WCHAR teststringW[] = {'a','b','r','a','c','a','d','a','b','r','a',0};
1137
1138 ok(p_wcsrchr(teststringW, 'a') == teststringW + 10,
1139 "wcsrchr should have returned a pointer to the last 'a' character\n");
1140 ok(p_wcsrchr(teststringW, 0) == teststringW + 11,
1141 "wcsrchr should have returned a pointer to the null terminator\n");
1142 ok(p_wcsrchr(teststringW, 'x') == NULL,
1143 "wcsrchr should have returned NULL\n");
1144}

Referenced by START_TEST().

◆ test_wtoi()

static void test_wtoi ( void  )
static

Definition at line 891 of file string.c.

892{
893 int test_num;
894 UNICODE_STRING uni;
895 int result;
896
897 for (test_num = 0; test_num < NB_STR2LONG; test_num++) {
898 pRtlCreateUnicodeStringFromAsciiz(&uni, str2long[test_num].str);
899 result = p_wtoi(uni.Buffer);
900 ok(result == str2long[test_num].value,
901 "(test %d): call failed: _wtoi(\"%s\") has result %d, expected: %d\n",
902 test_num, str2long[test_num].str, result, str2long[test_num].value);
903 pRtlFreeUnicodeString(&uni);
904 } /* for */
905}

Referenced by START_TEST().

◆ test_wtoi64()

static void test_wtoi64 ( void  )
static

Definition at line 1097 of file string.c.

1098{
1099 int test_num;
1100 UNICODE_STRING uni;
1102
1103 for (test_num = 0; test_num < NB_STR2LONGLONG; test_num++) {
1104 pRtlCreateUnicodeStringFromAsciiz(&uni, str2longlong[test_num].str);
1105 result = p_wtoi64(uni.Buffer);
1106 if (str2longlong[test_num].overflow)
1107 ok(result == str2longlong[test_num].value ||
1108 (result == ((str2longlong[test_num].overflow == -1) ?
1109 ULL(0x80000000,0x00000000) : ULL(0x7fffffff,0xffffffff))),
1110 "(test %d): call failed: _atoi64(\"%s\") has result 0x%s, expected: 0x%s\n",
1111 test_num, str2longlong[test_num].str, wine_dbgstr_longlong(result),
1113 else
1114 ok(result == str2longlong[test_num].value,
1115 "(test %d): call failed: _atoi64(\"%s\") has result 0x%s, expected: 0x%s\n",
1116 test_num, str2longlong[test_num].str, wine_dbgstr_longlong(result),
1118 pRtlFreeUnicodeString(&uni);
1119 }
1120}

Referenced by START_TEST().

◆ test_wtol()

static void test_wtol ( void  )
static

Definition at line 933 of file string.c.

934{
935 int test_num;
936 UNICODE_STRING uni;
937 LONG result;
938
939 for (test_num = 0; test_num < NB_STR2LONG; test_num++) {
940 pRtlCreateUnicodeStringFromAsciiz(&uni, str2long[test_num].str);
941 result = p_wtol(uni.Buffer);
942 ok(result == str2long[test_num].value,
943 "(test %d): call failed: _wtol(\"%s\") has result %d, expected: %d\n",
944 test_num, str2long[test_num].str, result, str2long[test_num].value);
945 pRtlFreeUnicodeString(&uni);
946 } /* for */
947}

Referenced by START_TEST().

◆ void()

static void ( __cdecl p_qsort)
static

◆ VOID()

static VOID ( WINAPI pRtlFreeAnsiString)
static

Variable Documentation

◆ BOOLEAN

Definition at line 31 of file string.c.

◆ hntdll

HMODULE hntdll = 0
static

Definition at line 30 of file string.c.

Referenced by InitFunctionPtrs().

◆ INT

INT

Definition at line 39 of file string.c.

◆ int

int

Definition at line 48 of file string.c.

◆ LPCSTR

Definition at line 33 of file string.c.

◆ LPSTR

Definition at line 39 of file string.c.

◆ LPWSTR

Definition at line 48 of file string.c.

◆ size_t

Definition at line 60 of file string.c.

◆ str2long

const str2long_t str2long[]
static

Definition at line 785 of file string.c.

Referenced by test_atoi(), test_atol(), test_wtoi(), and test_wtol().

◆ str2longlong

const str2longlong_t str2longlong[]
static

Definition at line 956 of file string.c.

Referenced by test_atoi64(), and test_wtoi64().

◆ ulong2str

◆ ulonglong2str

◆ WCHAR

Definition at line 57 of file string.c.