ReactOS  0.4.12-dev-918-g6c6e7b8
string.c File Reference
#include "wine/test.h"
#include <string.h>
#include <mbstring.h>
#include <wchar.h>
#include <stdlib.h>
#include <stdio.h>
#include <mbctype.h>
#include <locale.h>
#include <errno.h>
#include <limits.h>
#include <math.h>
#include "winbase.h"
#include "winnls.h"
Include dependency graph for string.c:

Go to the source code of this file.

Macros

#define expect_eq(expr, value, type, format)   { type ret = (expr); ok((value) == ret, #expr " expected " format " got " format "\n", value, ret); }
 
#define expect_bin(buf, value, len)   { ok(memcmp((buf), value, len) == 0, "Binary buffer mismatch - expected %s, got %s\n", buf_to_string((unsigned char *)value, len, 1), buf_to_string((buf), len, 0)); }
 
#define SETNOFAIL(x, y)   x = (void*)GetProcAddress(hMsvcrt,y)
 
#define SET(x, y)   SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y)
 
#define test_codepage(num)   test_cp_table(num, result_cp_##num##_mbctype);
 
#define okchars(dst, b0, b1, b2, b3, b4, b5, b6, b7)
 
#define TEST_STRNCPY_LEN   10
 

Functions

static charbuf_to_string (const unsigned char *bin, int len, int nr)
 
static void *__cdeclpmemcpy (void *, const void *, size_t n)
 
static int (__cdecl *p_memcpy_s)(void *
 
static int *__cdeclpmemcmp (void *, const void *, size_t n)
 
static size_t (__cdecl *p_strnlen)(const char *
 
static __int64 (__cdecl *p_strtoi64)(const char *
 
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static errno_t (__cdecl *p_gcvt_s)(char *
 
static _locale_t (__cdecl *p__create_locale)(int
 
static const char *static void (__cdecl *p__free_locale)(_locale_t)
 
static double (__cdecl *p__atof_l)(const char *
 
static void test_swab (void)
 
static void test_cp_table (int cp, int *result)
 
static void test_mbcp (void)
 
static void test_mbsspn (void)
 
static void test_mbsspnp (void)
 
static void test_strdup (void)
 
static void test_strcpy_s (void)
 
static void test_memcpy_s (void)
 
static void test_memmove_s (void)
 
static void test_strcat_s (void)
 
static void test__mbscat_s (void)
 
static void test__mbsnbcpy_s (void)
 
static void test__mbscpy_s (void)
 
static void test_wcscpy_s (void)
 
static void test__wcsupr_s (void)
 
static void test__wcslwr_s (void)
 
static void test_mbcjisjms (void)
 
static void test_mbcjmsjis (void)
 
static void test_mbctohira (void)
 
static void test_mbctokata (void)
 
static void test_mbbtombc (void)
 
static void test_mbctombb (void)
 
static void test_ismbckata (void)
 
static void test_ismbclegal (void)
 
static void test_strtok (void)
 
static void test_strtol (void)
 
static void test_strnlen (void)
 
static void test__strtoi64 (void)
 
static BOOL almost_equal (double d1, double d2)
 
static void test__strtod (void)
 
static void test_mbstowcs (void)
 
static void test_gcvt (void)
 
static void test__itoa_s (void)
 
static void test__strlwr_s (void)
 
static void test_wcsncat_s (void)
 
static void test__mbsnbcat_s (void)
 
static void test__mbsupr_s (void)
 
static void test__mbslwr_s (void)
 
static void test__mbstok (void)
 
static void test__ultoa_s (void)
 
static void test_wctob (void)
 
static void test_wctomb (void)
 
static void test_tolower (void)
 
static void test__atodbl (void)
 
static void test__stricmp (void)
 
static void test__wcstoi64 (void)
 
static void test_atoi (void)
 
static void test_atof (void)
 
static void test_strncpy (void)
 
static void test_strxfrm (void)
 
static void test__strnset_s (void)
 
static void test__wcsset_s (void)
 
static void test__mbscmp (void)
 
static void test__ismbclx (void)
 
static void test__memicmp (void)
 
static void test__memicmp_l (void)
 
static void test__strupr (void)
 
static void test__tcsncoll (void)
 
static void test__tcsnicoll (void)
 
static void test___strncnt (void)
 
static void test_C_locale (void)
 
 START_TEST (string)
 

Variables

static size_t
 
static const charsrc
 
static size_t len
 
static size_t size
 
static size_t const unsigned char size_t count
 
static const unsigned char *static size_t const wchar_twcSrc
 
static size_t elem
 
static char int
 
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
 
static intp__mb_cur_max
 
static unsigned charp_mbctype
 
static size_t numberOfElements
 
static wchar_t
 
static _locale_t
 
static HMODULE hMsvcrt
 
static int result_cp_932_mbctype []
 
static int result_cp_936_mbctype []
 
static int result_cp_949_mbctype []
 
static int result_cp_950_mbctype []
 
struct {
   const char *   string
 
   const char *   delimiter
 
   int   exp_offsetret1
 
   int   exp_offsetret2
 
   int   exp_offsetret3
 
testcases_strtok []
 

Macro Definition Documentation

◆ expect_bin

#define expect_bin (   buf,
  value,
  len 
)    { ok(memcmp((buf), value, len) == 0, "Binary buffer mismatch - expected %s, got %s\n", buf_to_string((unsigned char *)value, len, 1), buf_to_string((buf), len, 0)); }

Definition at line 53 of file string.c.

◆ expect_eq

#define expect_eq (   expr,
  value,
  type,
  format 
)    { type ret = (expr); ok((value) == ret, #expr " expected " format " got " format "\n", value, ret); }

Definition at line 52 of file string.c.

◆ okchars

#define okchars (   dst,
  b0,
  b1,
  b2,
  b3,
  b4,
  b5,
  b6,
  b7 
)
Value:
ok(dst[0] == b0 && dst[1] == b1 && dst[2] == b2 && dst[3] == b3 && \
dst[4] == b4 && dst[5] == b5 && dst[6] == b6 && dst[7] == b7, \
"Bad result: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",\
dst[0], dst[1], dst[2], dst[3], dst[4], dst[5], dst[6], dst[7])
static CRYPT_DATA_BLOB b1[]
Definition: msg.c:573
#define ok(value,...)
Definition: CComObject.cpp:34
static CRYPT_DATA_BLOB b3[]
Definition: msg.c:592
GLenum GLenum dst
Definition: glext.h:6340
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:582
static CRYPT_DATA_BLOB b4
Definition: msg.c:2284

Definition at line 617 of file string.c.

◆ SET

#define SET (   x,
  y 
)    SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y)

Definition at line 112 of file string.c.

◆ SETNOFAIL

#define SETNOFAIL (   x,
  y 
)    x = (void*)GetProcAddress(hMsvcrt,y)

Definition at line 111 of file string.c.

◆ test_codepage

#define test_codepage (   num)    test_cp_table(num, result_cp_##num##_mbctype);

Definition at line 217 of file string.c.

◆ TEST_STRNCPY_LEN

#define TEST_STRNCPY_LEN   10

Function Documentation

◆ __int64()

static unsigned __int64 ( __cdecl p_strtoi64) const
static

Referenced by test__strtoi64(), and test__wcstoi64().

◆ _locale_t()

static _locale_t ( __cdecl p__create_locale)
static

◆ almost_equal()

static BOOL almost_equal ( double  d1,
double  d2 
)
inlinestatic

Definition at line 1798 of file string.c.

1798  {
1799  if(d1-d2>-1e-30 && d1-d2<1e-30)
1800  return TRUE;
1801  return FALSE;
1802 }
#define TRUE
Definition: types.h:120
#define e
Definition: ke_i.h:82

Referenced by test__atodbl(), test__strtod(), and test_atof().

◆ buf_to_string()

static char* buf_to_string ( const unsigned char bin,
int  len,
int  nr 
)
static

Definition at line 38 of file string.c.

39 {
40  static char buf[2][1024];
41  char *w = buf[nr];
42  int i;
43 
44  for (i = 0; i < len; i++)
45  {
46  sprintf(w, "%02x ", (unsigned char)bin[i]);
47  w += strlen(w);
48  }
49  return buf[nr];
50 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
ULONG nr
Definition: thread.c:7
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define sprintf(buf, format,...)
Definition: sprintf.c:55
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
static size_t len
Definition: string.c:60
static struct _PeImage bin

◆ double()

static double ( __cdecl p__atof_l) const
static

◆ errno_t()

static const char mbstate_t* static wchar_t const char mbstate_t* static const wchar_t int* static errno_t ( __cdecl p_gcvt_s)
static

◆ int()

static int ( __cdecl p_memcpy_s)
static

◆ pmemcmp()

static int* __cdecl* pmemcmp ( void ,
const void ,
size_t  n 
)
static

Referenced by START_TEST().

◆ pmemcpy()

static void* __cdecl* pmemcpy ( void ,
const void ,
size_t  n 
)
static

Referenced by START_TEST().

◆ size_t()

static size_t ( __cdecl p_strnlen) const
static

◆ START_TEST()

START_TEST ( string  )

Definition at line 3679 of file string.c.

3680 {
3681  char mem[100];
3682  static const char xilstring[]="c:/xilinx";
3683  int nLen;
3684 
3685  hMsvcrt = GetModuleHandleA("msvcrt.dll");
3686  if (!hMsvcrt)
3687  hMsvcrt = GetModuleHandleA("msvcrtd.dll");
3688  ok(hMsvcrt != 0, "GetModuleHandleA failed\n");
3689  SET(pmemcpy,"memcpy");
3690  p_memcpy_s = (void*)GetProcAddress( hMsvcrt, "memcpy_s" );
3691  p_memmove_s = (void*)GetProcAddress( hMsvcrt, "memmove_s" );
3692  SET(pmemcmp,"memcmp");
3693  SET(p_mbctype,"_mbctype");
3694  SET(p__mb_cur_max,"__mb_cur_max");
3695  SET(p_strcpy, "strcpy");
3696  pstrcpy_s = (void *)GetProcAddress( hMsvcrt,"strcpy_s" );
3697  pstrcat_s = (void *)GetProcAddress( hMsvcrt,"strcat_s" );
3698  p_mbscat_s = (void*)GetProcAddress( hMsvcrt, "_mbscat_s" );
3699  p_mbsnbcat_s = (void *)GetProcAddress( hMsvcrt,"_mbsnbcat_s" );
3700  p_mbsnbcpy_s = (void *)GetProcAddress( hMsvcrt,"_mbsnbcpy_s" );
3701  p__mbscpy_s = (void *)GetProcAddress( hMsvcrt,"_mbscpy_s" );
3702  p_wcscpy_s = (void *)GetProcAddress( hMsvcrt,"wcscpy_s" );
3703  p_wcsncpy_s = (void *)GetProcAddress( hMsvcrt,"wcsncpy_s" );
3704  p_wcsncat_s = (void *)GetProcAddress( hMsvcrt,"wcsncat_s" );
3705  p_wcsupr_s = (void *)GetProcAddress( hMsvcrt,"_wcsupr_s" );
3706  p_strnlen = (void *)GetProcAddress( hMsvcrt,"strnlen" );
3707  p_strtoi64 = (void *)GetProcAddress(hMsvcrt, "_strtoi64");
3708  p_strtoui64 = (void *)GetProcAddress(hMsvcrt, "_strtoui64");
3709  p_wcstoi64 = (void *)GetProcAddress(hMsvcrt, "_wcstoi64");
3710  p_wcstoui64 = (void *)GetProcAddress(hMsvcrt, "_wcstoui64");
3711  pmbstowcs_s = (void *)GetProcAddress(hMsvcrt, "mbstowcs_s");
3712  pwcstombs_s = (void *)GetProcAddress(hMsvcrt, "wcstombs_s");
3713  pwcsrtombs = (void *)GetProcAddress(hMsvcrt, "wcsrtombs");
3714  p_gcvt_s = (void *)GetProcAddress(hMsvcrt, "_gcvt_s");
3715  p_itoa_s = (void *)GetProcAddress(hMsvcrt, "_itoa_s");
3716  p_strlwr_s = (void *)GetProcAddress(hMsvcrt, "_strlwr_s");
3717  p_ultoa_s = (void *)GetProcAddress(hMsvcrt, "_ultoa_s");
3718  p_wcslwr_s = (void*)GetProcAddress(hMsvcrt, "_wcslwr_s");
3719  p_mbsupr_s = (void*)GetProcAddress(hMsvcrt, "_mbsupr_s");
3720  p_mbslwr_s = (void*)GetProcAddress(hMsvcrt, "_mbslwr_s");
3721  p_wctob = (void*)GetProcAddress(hMsvcrt, "wctob");
3722  p_wcrtomb = (void*)GetProcAddress(hMsvcrt, "wcrtomb");
3723  p_tolower = (void*)GetProcAddress(hMsvcrt, "tolower");
3724  p_towlower = (void*)GetProcAddress(hMsvcrt, "towlower");
3725  p__towlower_l = (void*)GetProcAddress(hMsvcrt, "_towlower_l");
3726  p_towupper = (void*)GetProcAddress(hMsvcrt, "towupper");
3727  p__towupper_l = (void*)GetProcAddress(hMsvcrt, "_towupper_l");
3728  p__create_locale = (void*)GetProcAddress(hMsvcrt, "_create_locale");
3729  p__free_locale = (void*)GetProcAddress(hMsvcrt, "_free_locale");
3730  p_mbrlen = (void*)GetProcAddress(hMsvcrt, "mbrlen");
3731  p_mbrtowc = (void*)GetProcAddress(hMsvcrt, "mbrtowc");
3732  p_mbsrtowcs = (void*)GetProcAddress(hMsvcrt, "mbsrtowcs");
3733  p_mbsrtowcs_s = (void*)GetProcAddress(hMsvcrt, "mbsrtowcs_s");
3734  p__atodbl_l = (void*)GetProcAddress(hMsvcrt, "_atodbl_l");
3735  p__atof_l = (void*)GetProcAddress(hMsvcrt, "_atof_l");
3736  p__strtod_l = (void*)GetProcAddress(hMsvcrt, "_strtod_l");
3737  p__strnset_s = (void*)GetProcAddress(hMsvcrt, "_strnset_s");
3738  p__wcsset_s = (void*)GetProcAddress(hMsvcrt, "_wcsset_s");
3739  p__mbsnlen = (void*)GetProcAddress(hMsvcrt, "_mbsnlen");
3740  p__mbccpy_s = (void*)GetProcAddress(hMsvcrt, "_mbccpy_s");
3741  p__memicmp = (void*)GetProcAddress(hMsvcrt, "_memicmp");
3742  p__memicmp_l = (void*)GetProcAddress(hMsvcrt, "_memicmp_l");
3743  p___strncnt = (void*)GetProcAddress(hMsvcrt, "__strncnt");
3744 
3745  /* MSVCRT memcpy behaves like memmove for overlapping moves,
3746  MFC42 CString::Insert seems to rely on that behaviour */
3747  strcpy(mem,xilstring);
3748  nLen=strlen(xilstring);
3749  pmemcpy(mem+5, mem,nLen+1);
3750  ok(pmemcmp(mem+5,xilstring, nLen) == 0,
3751  "Got result %s\n",mem+5);
3752 
3753  /* run tolower tests first */
3754  test_tolower();
3755  test_swab();
3756  test_mbcp();
3757  test_mbsspn();
3758  test_mbsspnp();
3759  test_strdup();
3760  test_strcpy_s();
3761  test_memcpy_s();
3762  test_memmove_s();
3763  test_strcat_s();
3764  test__mbscat_s();
3765  test__mbsnbcpy_s();
3766  test__mbscpy_s();
3767  test_mbcjisjms();
3768  test_mbcjmsjis();
3769  test_mbctohira();
3770  test_mbctokata();
3771  test_mbbtombc();
3772  test_mbctombb();
3773  test_ismbckata();
3774  test_ismbclegal();
3775  test_strtok();
3776  test__mbstok();
3777  test_wcscpy_s();
3778  test__wcsupr_s();
3779  test_strtol();
3780  test_strnlen();
3781  test__strtoi64();
3782  test__strtod();
3783  test_mbstowcs();
3784  test_gcvt();
3785  test__itoa_s();
3786  test__strlwr_s();
3787  test_wcsncat_s();
3788  test__mbsnbcat_s();
3789  test__ultoa_s();
3790  test__wcslwr_s();
3791  test__mbsupr_s();
3792  test__mbslwr_s();
3793  test_wctob();
3794  test_wctomb();
3795  test__atodbl();
3796  test__stricmp();
3797  test__wcstoi64();
3798  test_atoi();
3799  test_atof();
3800  test_strncpy();
3801  test_strxfrm();
3802  test__strnset_s();
3803  test__wcsset_s();
3804  test__mbscmp();
3805  test__ismbclx();
3806  test__memicmp();
3807  test__memicmp_l();
3808  test__strupr();
3809  test__tcsncoll();
3810  test__tcsnicoll();
3811  test___strncnt();
3812  test_C_locale();
3813 }
static void test_wctob(void)
Definition: string.c:2702
static void test_swab(void)
Definition: string.c:116
static void test_strcpy_s(void)
Definition: string.c:553
static void test__strlwr_s(void)
Definition: string.c:2270
static void test__memicmp_l(void)
Definition: string.c:3323
static void test__tcsnicoll(void)
Definition: string.c:3494
static void test_memcpy_s(void)
Definition: string.c:623
static void test__mbslwr_s(void)
Definition: string.c:2550
#define SET(x, y)
Definition: string.c:112
static void test_ismbclegal(void)
Definition: string.c:1446
static void test__strtoi64(void)
Definition: string.c:1653
static void test_mbstowcs(void)
Definition: string.c:1911
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void test_strdup(void)
Definition: string.c:545
static void test_ismbckata(void)
Definition: string.c:1415
static void test_mbcjmsjis(void)
Definition: string.c:1280
static void test_mbctombb(void)
Definition: string.c:1393
static void test_mbsspn(void)
Definition: string.c:512
static void test__memicmp(void)
Definition: string.c:3288
static void test__mbsupr_s(void)
Definition: string.c:2493
static void test__atodbl(void)
Definition: string.c:2848
static void test__strtod(void)
Definition: string.c:1804
static void test_wcsncat_s(void)
Definition: string.c:2327
static HMODULE hMsvcrt
Definition: string.c:114
static int *__cdecl * pmemcmp(void *, const void *, size_t n)
static void test__strupr(void)
Definition: string.c:3366
static void test_strncpy(void)
Definition: string.c:3074
static void test__itoa_s(void)
Definition: string.c:2174
static void test__stricmp(void)
Definition: string.c:2908
static void test_gcvt(void)
Definition: string.c:2139
static void test__mbscmp(void)
Definition: string.c:3235
static void test_mbsspnp(void)
Definition: string.c:527
static void test__mbscpy_s(void)
Definition: string.c:943
#define ok(value,...)
Definition: CComObject.cpp:34
static void test_wctomb(void)
Definition: string.c:2737
static void test__tcsncoll(void)
Definition: string.c:3409
static void test_wcscpy_s(void)
Definition: string.c:979
static unsigned char * p_mbctype
Definition: string.c:85
static void test_atoi(void)
Definition: string.c:3027
static void test_C_locale(void)
Definition: string.c:3612
static void test_mbctokata(void)
Definition: string.c:1338
static void test__wcsupr_s(void)
Definition: string.c:1080
static void test_strnlen(void)
Definition: string.c:1633
static void test_strxfrm(void)
Definition: string.c:3104
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
static void test_atof(void)
Definition: string.c:3044
static void test__ismbclx(void)
Definition: string.c:3265
static void test_strtol(void)
Definition: string.c:1565
static void test__mbscat_s(void)
Definition: string.c:816
static void test_mbcjisjms(void)
Definition: string.c:1254
static void test__mbstok(void)
Definition: string.c:2606
static void test_mbbtombc(void)
Definition: string.c:1367
static void test__mbsnbcat_s(void)
Definition: string.c:2366
static void test_strtok(void)
Definition: string.c:1538
static void test___strncnt(void)
Definition: string.c:3577
static void test_mbctohira(void)
Definition: string.c:1308
Definition: mem.c:156
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define GetProcAddress(x, y)
Definition: compat.h:410
static void test__mbsnbcpy_s(void)
Definition: string.c:896
static void test_mbcp(void)
Definition: string.c:221
static void test__wcslwr_s(void)
Definition: string.c:1167
static void test_memmove_s(void)
Definition: string.c:691
static void test__ultoa_s(void)
Definition: string.c:2624
static void test__strnset_s(void)
Definition: string.c:3171
static void test_strcat_s(void)
Definition: string.c:753
static void *__cdecl * pmemcpy(void *, const void *, size_t n)
static int * p__mb_cur_max
Definition: string.c:84
static void test__wcstoi64(void)
Definition: string.c:2940
static void test_tolower(void)
Definition: string.c:2776
static void test__wcsset_s(void)
Definition: string.c:3201

◆ test___strncnt()

static void test___strncnt ( void  )
static

Definition at line 3577 of file string.c.

3578 {
3579  static const struct
3580  {
3581  const char *str;
3582  size_t size;
3583  size_t ret;
3584  }
3585  strncnt_tests[] =
3586  {
3587  { NULL, 0, 0 },
3588  { "a", 0, 0 },
3589  { "a", 1, 1 },
3590  { "a", 10, 1 },
3591  { "abc", 1, 1 },
3592  };
3593  unsigned int i;
3594  size_t ret;
3595 
3596  if (!p___strncnt)
3597  {
3598  win_skip("__strncnt() is not available.\n");
3599  return;
3600  }
3601 
3602  if (0) /* crashes */
3603  ret = p___strncnt(NULL, 1);
3604 
3605  for (i = 0; i < ARRAY_SIZE(strncnt_tests); ++i)
3606  {
3607  ret = p___strncnt(strncnt_tests[i].str, strncnt_tests[i].size);
3608  ok(ret == strncnt_tests[i].ret, "%u: unexpected return value %u.\n", i, (int)ret);
3609  }
3610 }
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
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
GLsizeiptr size
Definition: glext.h:5919
int ret
#define ARRAY_SIZE(a)
Definition: main.h:24
static size_t size
Definition: string.c:62
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__atodbl()

static void test__atodbl ( void  )
static

Definition at line 2848 of file string.c.

2849 {
2850  _CRT_DOUBLE d;
2851  char num[32];
2852  int ret;
2853 
2854  if(!p__atodbl_l) {
2855  /* Old versions of msvcrt use different values for _OVERFLOW and _UNDERFLOW
2856  * Because of this lets skip _atodbl tests when _atodbl_l is not available */
2857  win_skip("_atodbl_l is not available\n");
2858  return;
2859  }
2860 
2861  num[0] = 0;
2862  ret = p__atodbl_l(&d, num, NULL);
2863  ok(ret == 0, "_atodbl_l(&d, \"\", NULL) returned %d, expected 0\n", ret);
2864  ok(d.x == 0, "d.x = %lf, expected 0\n", d.x);
2865  ret = _atodbl(&d, num);
2866  ok(ret == 0, "_atodbl(&d, \"\") returned %d, expected 0\n", ret);
2867  ok(d.x == 0, "d.x = %lf, expected 0\n", d.x);
2868 
2869  strcpy(num, "t");
2870  ret = p__atodbl_l(&d, num, NULL);
2871  ok(ret == 0, "_atodbl_l(&d, \"t\", NULL) returned %d, expected 0\n", ret);
2872  ok(d.x == 0, "d.x = %lf, expected 0\n", d.x);
2873  ret = _atodbl(&d, num);
2874  ok(ret == 0, "_atodbl(&d, \"t\") returned %d, expected 0\n", ret);
2875  ok(d.x == 0, "d.x = %lf, expected 0\n", d.x);
2876 
2877  strcpy(num, "0");
2878  ret = p__atodbl_l(&d, num, NULL);
2879  ok(ret == 0, "_atodbl_l(&d, \"0\", NULL) returned %d, expected 0\n", ret);
2880  ok(d.x == 0, "d.x = %lf, expected 0\n", d.x);
2881  ret = _atodbl(&d, num);
2882  ok(ret == 0, "_atodbl(&d, \"0\") returned %d, expected 0\n", ret);
2883  ok(d.x == 0, "d.x = %lf, expected 0\n", d.x);
2884 
2885  strcpy(num, "123");
2886  ret = p__atodbl_l(&d, num, NULL);
2887  ok(ret == 0, "_atodbl_l(&d, \"123\", NULL) returned %d, expected 0\n", ret);
2888  ok(d.x == 123, "d.x = %lf, expected 123\n", d.x);
2889  ret = _atodbl(&d, num);
2890  ok(ret == 0, "_atodbl(&d, \"123\") returned %d, expected 0\n", ret);
2891  ok(d.x == 123, "d.x = %lf, expected 123\n", d.x);
2892 
2893  strcpy(num, "1e-309");
2894  ret = p__atodbl_l(&d, num, NULL);
2895  ok(ret == _UNDERFLOW, "_atodbl_l(&d, \"1e-309\", NULL) returned %d, expected _UNDERFLOW\n", ret);
2896  ok(d.x!=0 && almost_equal(d.x, 0), "d.x = %le, expected 0\n", d.x);
2897  ret = _atodbl(&d, num);
2898  ok(ret == _UNDERFLOW, "_atodbl(&d, \"1e-309\") returned %d, expected _UNDERFLOW\n", ret);
2899  ok(d.x!=0 && almost_equal(d.x, 0), "d.x = %le, expected 0\n", d.x);
2900 
2901  strcpy(num, "1e309");
2902  ret = p__atodbl_l(&d, num, NULL);
2903  ok(ret == _OVERFLOW, "_atodbl_l(&d, \"1e309\", NULL) returned %d, expected _OVERFLOW\n", ret);
2904  ret = _atodbl(&d, num);
2905  ok(ret == _OVERFLOW, "_atodbl(&d, \"1e309\") returned %d, expected _OVERFLOW\n", ret);
2906 }
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define d
Definition: ke_i.h:81
GLuint GLuint num
Definition: glext.h:9618
int ret
#define _UNDERFLOW
Definition: math.h:42
int _atodbl(void *value, char *str)
Definition: stubs.c:29
static BOOL almost_equal(double d1, double d2)
Definition: string.c:1798
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define win_skip
Definition: test.h:141
#define _OVERFLOW
Definition: math.h:41

Referenced by START_TEST().

◆ test__ismbclx()

static void test__ismbclx ( void  )
static

Definition at line 3265 of file string.c.

3266 {
3267  int cp, ret;
3268 
3269  ret = _ismbcl0(0);
3270  ok(!ret, "got %d\n", ret);
3271 
3272  cp = _setmbcp(1252);
3273 
3274  ret = _ismbcl0(0x8140);
3275  ok(!ret, "got %d\n", ret);
3276 
3277  _setmbcp(932);
3278 
3279  ret = _ismbcl0(0);
3280  ok(!ret, "got %d\n", ret);
3281 
3282  ret = _ismbcl0(0x8140);
3283  ok(ret, "got %d\n", ret);
3284 
3285  _setmbcp(cp);
3286 }
#define ok(value,...)
Definition: CComObject.cpp:34
int __cdecl _setmbcp(int)
Definition: _setmbcp.c:218
_Check_return_ _CRTIMP int __cdecl _ismbcl0(_In_ unsigned int _Ch)
int ret
POINT cp
Definition: magnifier.c:60

Referenced by START_TEST().

◆ test__itoa_s()

static void test__itoa_s ( void  )
static

Definition at line 2174 of file string.c.

2175 {
2176  errno_t ret;
2177  char buffer[33];
2178 
2179  if (!p_itoa_s)
2180  {
2181  win_skip("Skipping _itoa_s tests\n");
2182  return;
2183  }
2184 
2185  errno = EBADF;
2186  ret = p_itoa_s(0, NULL, 0, 0);
2187  ok(ret == EINVAL, "Expected _itoa_s to return EINVAL, got %d\n", ret);
2188  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2189 
2190  memset(buffer, 'X', sizeof(buffer));
2191  errno = EBADF;
2192  ret = p_itoa_s(0, buffer, 0, 0);
2193  ok(ret == EINVAL, "Expected _itoa_s to return EINVAL, got %d\n", ret);
2194  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2195  ok(buffer[0] == 'X', "Expected the output buffer to be untouched\n");
2196 
2197  memset(buffer, 'X', sizeof(buffer));
2198  errno = EBADF;
2199  ret = p_itoa_s(0, buffer, sizeof(buffer), 0);
2200  ok(ret == EINVAL, "Expected _itoa_s to return EINVAL, got %d\n", ret);
2201  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2202  ok(buffer[0] == '\0', "Expected the output buffer to be null terminated\n");
2203 
2204  memset(buffer, 'X', sizeof(buffer));
2205  errno = EBADF;
2206  ret = p_itoa_s(0, buffer, sizeof(buffer), 64);
2207  ok(ret == EINVAL, "Expected _itoa_s to return EINVAL, got %d\n", ret);
2208  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2209  ok(buffer[0] == '\0', "Expected the output buffer to be null terminated\n");
2210 
2211  memset(buffer, 'X', sizeof(buffer));
2212  errno = EBADF;
2213  ret = p_itoa_s(12345678, buffer, 4, 10);
2214  ok(ret == ERANGE, "Expected _itoa_s to return ERANGE, got %d\n", ret);
2215  ok(errno == ERANGE, "Expected errno to be ERANGE, got %d\n", errno);
2216  ok(!memcmp(buffer, "\000765", 4),
2217  "Expected the output buffer to be null terminated with truncated output\n");
2218 
2219  memset(buffer, 'X', sizeof(buffer));
2220  errno = EBADF;
2221  ret = p_itoa_s(12345678, buffer, 8, 10);
2222  ok(ret == ERANGE, "Expected _itoa_s to return ERANGE, got %d\n", ret);
2223  ok(errno == ERANGE, "Expected errno to be ERANGE, got %d\n", errno);
2224  ok(!memcmp(buffer, "\0007654321", 8),
2225  "Expected the output buffer to be null terminated with truncated output\n");
2226 
2227  memset(buffer, 'X', sizeof(buffer));
2228  errno = EBADF;
2229  ret = p_itoa_s(-12345678, buffer, 9, 10);
2230  ok(ret == ERANGE, "Expected _itoa_s to return ERANGE, got %d\n", ret);
2231  ok(errno == ERANGE, "Expected errno to be ERANGE, got %d\n", errno);
2232  ok(!memcmp(buffer, "\00087654321", 9),
2233  "Expected the output buffer to be null terminated with truncated output\n");
2234 
2235  ret = p_itoa_s(12345678, buffer, 9, 10);
2236  ok(ret == 0, "Expected _itoa_s to return 0, got %d\n", ret);
2237  ok(!strcmp(buffer, "12345678"),
2238  "Expected output buffer string to be \"12345678\", got \"%s\"\n",
2239  buffer);
2240 
2241  ret = p_itoa_s(43690, buffer, sizeof(buffer), 2);
2242  ok(ret == 0, "Expected _itoa_s to return 0, got %d\n", ret);
2243  ok(!strcmp(buffer, "1010101010101010"),
2244  "Expected output buffer string to be \"1010101010101010\", got \"%s\"\n",
2245  buffer);
2246 
2247  ret = p_itoa_s(1092009, buffer, sizeof(buffer), 36);
2248  ok(ret == 0, "Expected _itoa_s to return 0, got %d\n", ret);
2249  ok(!strcmp(buffer, "nell"),
2250  "Expected output buffer string to be \"nell\", got \"%s\"\n",
2251  buffer);
2252 
2253  ret = p_itoa_s(5704, buffer, sizeof(buffer), 18);
2254  ok(ret == 0, "Expected _itoa_s to return 0, got %d\n", ret);
2255  ok(!strcmp(buffer, "hag"),
2256  "Expected output buffer string to be \"hag\", got \"%s\"\n",
2257  buffer);
2258 
2259  ret = p_itoa_s(-12345678, buffer, sizeof(buffer), 10);
2260  ok(ret == 0, "Expected _itoa_s to return 0, got %d\n", ret);
2261  ok(!strcmp(buffer, "-12345678"),
2262  "Expected output buffer string to be \"-12345678\", got \"%s\"\n",
2263  buffer);
2264 
2265  itoa(100, buffer, 100);
2266  ok(!strcmp(buffer, "10"),
2267  "Expected output buffer string to be \"10\", got \"%s\"\n", buffer);
2268 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: arc.h:39
GLuint buffer
Definition: glext.h:5915
int errno
Definition: arc.h:36
smooth NULL
Definition: ftsmooth.c:416
int errno_t
Definition: crtdefs.h:353
#define ok(value,...)
Definition: CComObject.cpp:34
_CRTIMP char *__cdecl itoa(_In_ int _Val, _Pre_notnull_ _Post_z_ char *_DstBuf, _In_ int _Radix)
#define ERANGE
Definition: acclib.h:92
int ret
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__mbscat_s()

static void test__mbscat_s ( void  )
static

Definition at line 816 of file string.c.

817 {
818  unsigned char dst[8], src[4];
819  int err;
820  int prev_cp = _getmbcp();
821 
822  if(!p_mbscat_s)
823  {
824  win_skip("_mbscat_s not found\n");
825  return;
826  }
827 
828 
829  src[0] = dst[0] = 0;
830  err = p_mbscat_s(NULL, sizeof(dst), src);
831  ok(err == EINVAL, "_mbscat_s returned %d\n", err);
832 
833  err = p_mbscat_s(dst, sizeof(dst), NULL);
834  ok(err == EINVAL, "_mbscat_s returned %d\n", err);
835 
836  dst[0] = 'a';
837  err = p_mbscat_s(dst, 1, src);
838  ok(err == EINVAL, "_mbscat_s returned %d\n", err);
839 
840  memset(dst, 'a', sizeof(dst));
841  dst[6] = 0;
842  src[0] = 'b';
843  src[1] = 0;
844 
845  err = p_mbscat_s(dst, sizeof(dst), src);
846  ok(err == 0, "_mbscat_s returned %d\n", err);
847  ok(!memcmp(dst, "aaaaaab", 8), "dst = %s\n", dst);
848 
849  err = p_mbscat_s(dst, sizeof(dst), src);
850  ok(err == ERANGE, "_mbscat_s returned %d\n", err);
851  ok(!dst[0], "dst[0] = %c\n", dst[0]);
852  ok(dst[1] == 'a', "dst[1] = %c\n", dst[1]);
853 
854  _setmbcp(932);
855  /* test invalid str in dst */
856  dst[0] = 0x81;
857  dst[1] = 0x81;
858  dst[2] = 0x52;
859  dst[3] = 0;
860  src[0] = 'a';
861  src[1] = 0;
862  err = p_mbscat_s(dst, sizeof(dst), src);
863  ok(err == 0, "_mbscat_s returned %d\n", err);
864 
865  /* test invalid str in src */
866  dst[0] = 0;
867  src[0] = 0x81;
868  src[1] = 0x81;
869  src[2] = 0x52;
870  src[3] = 0;
871  err = p_mbscat_s(dst, sizeof(dst), src);
872  ok(err == 0, "_mbscat_s returned %d\n", err);
873 
874  /* test dst with leading byte on the end of buffer */
875  dst[0] = 'a';
876  dst[1] = 0x81;
877  dst[2] = 0;
878  src[0] = 'R';
879  src[1] = 0;
880  err = p_mbscat_s(dst, sizeof(dst), src);
881  ok(err == EILSEQ, "_mbscat_s returned %d\n", err);
882  ok(!memcmp(dst, "aR", 3), "dst = %s\n", dst);
883 
884  /* test src with leading byte on the end of buffer */
885  dst[0] = 'a';
886  dst[1] = 0;
887  src[0] = 'b';
888  src[1] = 0x81;
889  src[2] = 0;
890  err = p_mbscat_s(dst, sizeof(dst), src);
891  ok(err == EILSEQ, "_mbscat_s returned %d\n", err);
892  ok(!memcmp(dst, "ab", 3), "dst = %s\n", dst);
893  _setmbcp(prev_cp);
894 }
#define EILSEQ
Definition: errno.h:97
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: arc.h:39
_CRTIMP int __cdecl _getmbcp(void)
Definition: locale.c:1472
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
int __cdecl _setmbcp(int)
Definition: _setmbcp.c:218
#define ERANGE
Definition: acclib.h:92
GLenum src
Definition: glext.h:6340
#define err(...)
GLenum GLenum dst
Definition: glext.h:6340
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__mbscmp()

static void test__mbscmp ( void  )
static

Definition at line 3235 of file string.c.

3236 {
3237  static const unsigned char a[] = {'a',0}, b[] = {'b',0};
3238  int ret;
3239 
3240  if (!p_mbrlen)
3241  {
3242  win_skip("_mbscmp tests\n");
3243  return;
3244  }
3245 
3246  ret = _mbscmp(NULL, NULL);
3247  ok(ret == INT_MAX, "got %d\n", ret);
3248 
3249  ret = _mbscmp(a, NULL);
3250  ok(ret == INT_MAX, "got %d\n", ret);
3251 
3252  ret = _mbscmp(NULL, a);
3253  ok(ret == INT_MAX, "got %d\n", ret);
3254 
3255  ret = _mbscmp(a, a);
3256  ok(!ret, "got %d\n", ret);
3257 
3258  ret = _mbscmp(a, b);
3259  ok(ret == -1, "got %d\n", ret);
3260 
3261  ret = _mbscmp(b, a);
3262  ok(ret == 1, "got %d\n", ret);
3263 }
#define INT_MAX
Definition: limits.h:40
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
_Check_return_ _CRTIMP int __cdecl _mbscmp(_In_z_ const unsigned char *_Str1, _In_z_ const unsigned char *_Str2)
int ret
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__mbscpy_s()

static void test__mbscpy_s ( void  )
static

Definition at line 943 of file string.c.

944 {
945  const unsigned char src[] = "source string";
946  unsigned char dest[16];
947  int ret;
948 
949  if(!p__mbscpy_s)
950  {
951  win_skip("_mbscpy_s not found\n");
952  return;
953  }
954 
955  ret = p__mbscpy_s(NULL, 0, src);
956  ok(ret == EINVAL, "got %d\n", ret);
957  ret = p__mbscpy_s(NULL, sizeof(dest), src);
958  ok(ret == EINVAL, "got %d\n", ret);
959  ret = p__mbscpy_s(dest, 0, src);
960  ok(ret == EINVAL, "got %d\n", ret);
961  dest[0] = 'x';
962  ret = p__mbscpy_s(dest, sizeof(dest), NULL);
963  ok(ret == EINVAL, "got %d\n", ret);
964  ok(!dest[0], "dest buffer was not modified on invalid argument\n");
965 
966  memset(dest, 'X', sizeof(dest));
967  ret = p__mbscpy_s(dest, sizeof(dest), src);
968  ok(!ret, "got %d\n", ret);
969  ok(!memcmp(dest, src, sizeof(src)), "dest = %s\n", dest);
970  ok(dest[sizeof(src)] == 'X', "unused part of buffer was modified\n");
971 
972  memset(dest, 'X', sizeof(dest));
973  ret = p__mbscpy_s(dest, 4, src);
974  ok(ret == ERANGE, "got %d\n", ret);
975  ok(!dest[0], "incorrect dest buffer (%d)\n", dest[0]);
976  ok(dest[1] == src[1], "incorrect dest buffer (%d)\n", dest[1]);
977 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: arc.h:39
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define ERANGE
Definition: acclib.h:92
int ret
GLenum src
Definition: glext.h:6340
static char * dest
Definition: rtl.c:135
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__mbslwr_s()

static void test__mbslwr_s ( void  )
static

Definition at line 2550 of file string.c.

2551 {
2552  errno_t ret;
2553  unsigned char buffer[20];
2554 
2555  if (!p_mbslwr_s)
2556  {
2557  win_skip("Skipping _mbslwr_s tests\n");
2558  return;
2559  }
2560 
2561  errno = EBADF;
2562  ret = p_mbslwr_s(NULL, 0);
2563  ok(ret == 0, "Expected _mbslwr_s to return 0, got %d\n", ret);
2564 
2565  errno = EBADF;
2566  ret = p_mbslwr_s(NULL, sizeof(buffer));
2567  ok(ret == EINVAL, "Expected _mbslwr_s to return EINVAL, got %d\n", ret);
2568  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2569 
2570  errno = EBADF;
2571  ret = p_mbslwr_s(buffer, 0);
2572  ok(ret == EINVAL, "Expected _mbslwr_s to return EINVAL, got %d\n", ret);
2573  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2574 
2575  memcpy(buffer, "ABCDEFGH", sizeof("ABCDEFGH"));
2576  errno = EBADF;
2577  ret = p_mbslwr_s(buffer, sizeof("ABCDEFGH"));
2578  ok(ret == 0, "Expected _mbslwr_s to return 0, got %d\n", ret);
2579  ok(!memcmp(buffer, "abcdefgh", sizeof("abcdefgh")),
2580  "Expected the output buffer to be \"abcdefgh\", got \"%s\"\n",
2581  buffer);
2582 
2583  memcpy(buffer, "ABCDEFGH", sizeof("ABCDEFGH"));
2584  errno = EBADF;
2585  ret = p_mbslwr_s(buffer, sizeof(buffer));
2586  ok(ret == 0, "Expected _mbslwr_s to return 0, got %d\n", ret);
2587  ok(!memcmp(buffer, "abcdefgh", sizeof("abcdefgh")),
2588  "Expected the output buffer to be \"abcdefgh\", got \"%s\"\n",
2589  buffer);
2590 
2591  memcpy(buffer, "ABCDEFGH", sizeof("ABCDEFGH"));
2592  errno = EBADF;
2593  ret = p_mbslwr_s(buffer, 4);
2594  ok(ret == EINVAL, "Expected _mbslwr_s to return EINVAL, got %d\n", ret);
2595  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2596 
2597  memcpy(buffer, "ABCDEFGH\0IJKLMNOP", sizeof("ABCDEFGH\0IJKLMNOP"));
2598  errno = EBADF;
2599  ret = p_mbslwr_s(buffer, sizeof(buffer));
2600  ok(ret == 0, "Expected _mbslwr_s to return 0, got %d\n", ret);
2601  ok(!memcmp(buffer, "abcdefgh\0IJKLMNOP", sizeof("abcdefgh\0IJKLMNOP")),
2602  "Expected the output buffer to be \"abcdefgh\\0IJKLMNOP\", got \"%s\"\n",
2603  buffer);
2604 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: arc.h:39
GLuint buffer
Definition: glext.h:5915
int errno
Definition: arc.h:36
smooth NULL
Definition: ftsmooth.c:416
int errno_t
Definition: crtdefs.h:353
#define ok(value,...)
Definition: CComObject.cpp:34
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__mbsnbcat_s()

static void test__mbsnbcat_s ( void  )
static

Definition at line 2366 of file string.c.

2367 {
2368  unsigned char dest[16];
2369  const unsigned char first[] = "dinosaur";
2370  const unsigned char second[] = "duck";
2371  int ret;
2372 
2373  if (!p_mbsnbcat_s)
2374  {
2375  win_skip("Skipping _mbsnbcat_s tests\n");
2376  return;
2377  }
2378 
2379  /* Test invalid arguments. */
2380  ret = p_mbsnbcat_s(NULL, 0, NULL, 0);
2381  ok(ret == 0, "Expected _mbsnbcat_s to return 0, got %d\n", ret);
2382 
2383  errno = EBADF;
2384  ret = p_mbsnbcat_s(NULL, 10, NULL, 0);
2385  ok(ret == EINVAL, "Expected _mbsnbcat_s to return EINVAL, got %d\n", ret);
2386  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2387 
2388  errno = EBADF;
2389  ret = p_mbsnbcat_s(NULL, 0, NULL, 10);
2390  ok(ret == EINVAL, "Expected _mbsnbcat_s to return EINVAL, got %d\n", ret);
2391  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2392 
2393  memset(dest, 'X', sizeof(dest));
2394  errno = EBADF;
2395  ret = p_mbsnbcat_s(dest, 0, NULL, 0);
2396  ok(ret == EINVAL, "Expected _mbsnbcat_s to return EINVAL, got %d\n", ret);
2397  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2398  ok(dest[0] == 'X', "Expected the output buffer to be untouched\n");
2399 
2400  memset(dest, 'X', sizeof(dest));
2401  errno = EBADF;
2402  ret = p_mbsnbcat_s(dest, 0, second, 0);
2403  ok(ret == EINVAL, "Expected _mbsnbcat_s to return EINVAL, got %d\n", ret);
2404  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2405  ok(dest[0] == 'X', "Expected the output buffer to be untouched\n");
2406 
2407  memset(dest, 'X', sizeof(dest));
2408  errno = EBADF;
2409  ret = p_mbsnbcat_s(dest, sizeof(dest), NULL, 0);
2410  ok(ret == EINVAL, "Expected _mbsnbcat_s to return EINVAL, got %d\n", ret);
2411  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2412  ok(dest[0] == '\0', "Expected the output buffer to be null terminated\n");
2413 
2414  memset(dest, 'X', sizeof(dest));
2415  errno = EBADF;
2416  ret = p_mbsnbcat_s(dest, sizeof(dest), NULL, 10);
2417  ok(ret == EINVAL, "Expected _mbsnbcat_s to return EINVAL, got %d\n", ret);
2418  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2419  ok(dest[0] == '\0', "Expected the output buffer to be null terminated\n");
2420 
2421  memset(dest, 'X', sizeof(dest));
2422  dest[0] = '\0';
2423  ret = p_mbsnbcat_s(dest, sizeof(dest), second, sizeof(second));
2424  ok(ret == 0, "Expected _mbsnbcat_s to return 0, got %d\n", ret);
2425  ok(!memcmp(dest, second, sizeof(second)),
2426  "Expected the output buffer string to be \"duck\"\n");
2427 
2428  /* Test source truncation behavior. */
2429  memset(dest, 'X', sizeof(dest));
2430  memcpy(dest, first, sizeof(first));
2431  ret = p_mbsnbcat_s(dest, sizeof(dest), second, 0);
2432  ok(ret == 0, "Expected _mbsnbcat_s to return 0, got %d\n", ret);
2433  ok(!memcmp(dest, first, sizeof(first)),
2434  "Expected the output buffer string to be \"dinosaur\"\n");
2435 
2436  memset(dest, 'X', sizeof(dest));
2437  memcpy(dest, first, sizeof(first));
2438  ret = p_mbsnbcat_s(dest, sizeof(dest), second, sizeof(second));
2439  ok(ret == 0, "Expected _mbsnbcat_s to return 0, got %d\n", ret);
2440  ok(!memcmp(dest, "dinosaurduck", sizeof("dinosaurduck")),
2441  "Expected the output buffer string to be \"dinosaurduck\"\n");
2442 
2443  memset(dest, 'X', sizeof(dest));
2444  memcpy(dest, first, sizeof(first));
2445  ret = p_mbsnbcat_s(dest, sizeof(dest), second, sizeof(second) + 1);
2446  ok(ret == 0, "Expected _mbsnbcat_s to return 0, got %d\n", ret);
2447  ok(!memcmp(dest, "dinosaurduck", sizeof("dinosaurduck")),
2448  "Expected the output buffer string to be \"dinosaurduck\"\n");
2449 
2450  memset(dest, 'X', sizeof(dest));
2451  memcpy(dest, first, sizeof(first));
2452  ret = p_mbsnbcat_s(dest, sizeof(dest), second, sizeof(second) - 1);
2453  ok(ret == 0, "Expected _mbsnbcat_s to return 0, got %d\n", ret);
2454  ok(!memcmp(dest, "dinosaurduck", sizeof("dinosaurduck")),
2455  "Expected the output buffer string to be \"dinosaurduck\"\n");
2456 
2457  memset(dest, 'X', sizeof(dest));
2458  memcpy(dest, first, sizeof(first));
2459  ret = p_mbsnbcat_s(dest, sizeof(dest), second, sizeof(second) - 2);
2460  ok(ret == 0, "Expected _mbsnbcat_s to return 0, got %d\n", ret);
2461  ok(!memcmp(dest, "dinosaurduc", sizeof("dinosaurduc")),
2462  "Expected the output buffer string to be \"dinosaurduc\"\n");
2463 
2464  /* Test destination truncation behavior. */
2465  memset(dest, 'X', sizeof(dest));
2466  memcpy(dest, first, sizeof(first));
2467  errno = EBADF;
2468  ret = p_mbsnbcat_s(dest, sizeof(first) - 1, second, sizeof(second));
2469  ok(ret == EINVAL, "Expected _mbsnbcat_s to return EINVAL, got %d\n", ret);
2470  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2471  ok(!memcmp(dest, "\0inosaur", sizeof("\0inosaur") - 1),
2472  "Expected the output buffer string to be \"\\0inosaur\" without ending null terminator\n");
2473 
2474  memset(dest, 'X', sizeof(dest));
2475  memcpy(dest, first, sizeof(first));
2476  errno = EBADF;
2477  ret = p_mbsnbcat_s(dest, sizeof(first), second, sizeof(second));
2478  ok(ret == ERANGE, "Expected _mbsnbcat_s to return ERANGE, got %d\n", ret);
2479  ok(errno == ERANGE, "Expected errno to be ERANGE, got %d\n", errno);
2480  ok(!memcmp(dest, "\0inosaurd", sizeof("\0inosaurd") - 1),
2481  "Expected the output buffer string to be \"\\0inosaurd\" without ending null terminator\n");
2482 
2483  memset(dest, 'X', sizeof(dest));
2484  memcpy(dest, first, sizeof(first));
2485  errno = EBADF;
2486  ret = p_mbsnbcat_s(dest, sizeof(first) + 1, second, sizeof(second));
2487  ok(ret == ERANGE, "Expected _mbsnbcat_s to return ERANGE, got %d\n", ret);
2488  ok(errno == ERANGE, "Expected errno to be ERANGE, got %d\n", errno);
2489  ok(!memcmp(dest, "\0inosaurdu", sizeof("\0inosaurdu") - 1),
2490  "Expected the output buffer string to be \"\\0inosaurdu\" without ending null terminator\n");
2491 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: arc.h:39
const GLint * first
Definition: glext.h:5794
int errno
Definition: arc.h:36
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define ERANGE
Definition: acclib.h:92
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static char * dest
Definition: rtl.c:135
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__mbsnbcpy_s()

static void test__mbsnbcpy_s ( void  )
static

Definition at line 896 of file string.c.

897 {
898  unsigned char dest[8];
899  const unsigned char big[] = "atoolongstringforthislittledestination";
900  const unsigned char small[] = "small";
901  int ret;
902 
903  if(!p_mbsnbcpy_s)
904  {
905  win_skip("_mbsnbcpy_s not found\n");
906  return;
907  }
908 
909  memset(dest, 'X', sizeof(dest));
910  ret = p_mbsnbcpy_s(dest, sizeof(dest), small, sizeof(small));
911  ok(ret == 0, "_mbsnbcpy_s: Copying a string into a big enough destination returned %d, expected 0\n", ret);
912  ok(dest[0] == 's' && dest[1] == 'm' && dest[2] == 'a' && dest[3] == 'l' &&
913  dest[4] == 'l' && dest[5] == '\0'&& dest[6] == 'X' && dest[7] == 'X',
914  "Unexpected return data from _mbsnbcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
915  dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]);
916 
917  /* WTF? */
918  memset(dest, 'X', sizeof(dest));
919  ret = p_mbsnbcpy_s(dest, sizeof(dest) - 2, big, sizeof(small));
920  ok(ret == ERANGE, "_mbsnbcpy_s: Copying a too long string returned %d, expected ERANGE\n", ret);
921  ok(dest[0] == '\0'&& dest[1] == 't' && dest[2] == 'o' && dest[3] == 'o' &&
922  dest[4] == 'l' && dest[5] == 'o' && dest[6] == 'X' && dest[7] == 'X',
923  "Unexpected return data from _mbsnbcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
924  dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]);
925 
926  memset(dest, 'X', sizeof(dest));
927  ret = p_mbsnbcpy_s(dest, sizeof(dest) - 2, big, 4);
928  ok(ret == 0, "_mbsnbcpy_s: Copying a too long string with a count cap returned %d, expected 0\n", ret);
929  ok(dest[0] == 'a' && dest[1] == 't' && dest[2] == 'o' && dest[3] == 'o' &&
930  dest[4] == '\0'&& dest[5] == 'X' && dest[6] == 'X' && dest[7] == 'X',
931  "Unexpected return data from _mbsnbcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
932  dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]);
933 
934  memset(dest, 'X', sizeof(dest));
935  ret = p_mbsnbcpy_s(dest, sizeof(dest) - 2, small, sizeof(small) + 10);
936  ok(ret == 0, "_mbsnbcpy_s: Copying more data than the source string len returned %d, expected 0\n", ret);
937  ok(dest[0] == 's' && dest[1] == 'm' && dest[2] == 'a' && dest[3] == 'l' &&
938  dest[4] == 'l' && dest[5] == '\0'&& dest[6] == 'X' && dest[7] == 'X',
939  "Unexpected return data from _mbsnbcpy_s: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
940  dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]);
941 }
#define small
Definition: rpcndr.h:115
#define ok(value,...)
Definition: CComObject.cpp:34
#define ERANGE
Definition: acclib.h:92
int ret
static char * dest
Definition: rtl.c:135
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__mbstok()

static void test__mbstok ( void  )
static

Definition at line 2606 of file string.c.

2607 {
2608  const unsigned char delim[] = "t";
2609 
2610  char str[] = "!.!test";
2611  unsigned char *ret;
2612 
2613  strtok(str, "!");
2614 
2615  ret = _mbstok(NULL, delim);
2616  /* most versions of msvcrt use the same buffer for strtok and _mbstok */
2617  ok(!ret || broken((char*)ret==str+4),
2618  "_mbstok(NULL, \"t\") = %p, expected NULL (%p)\n", ret, str);
2619 
2620  ret = _mbstok(NULL, delim);
2621  ok(!ret, "_mbstok(NULL, \"t\") = %p, expected NULL\n", ret);
2622 }
_Check_return_ _CRTIMP unsigned char *__cdecl _mbstok(_Inout_opt_z_ unsigned char *_Str, _In_z_ const unsigned char *_Delim)
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
int ret
#define broken(x)
Definition: _sntprintf.h:21
char * strtok(char *String, const char *Delimiters)
Definition: utclib.c:338

Referenced by START_TEST().

◆ test__mbsupr_s()

static void test__mbsupr_s ( void  )
static

Definition at line 2493 of file string.c.

2494 {
2495  errno_t ret;
2496  unsigned char buffer[20];
2497 
2498  if (!p_mbsupr_s)
2499  {
2500  win_skip("Skipping _mbsupr_s tests\n");
2501  return;
2502  }
2503 
2504  errno = EBADF;
2505  ret = p_mbsupr_s(NULL, 0);
2506  ok(ret == 0, "Expected _mbsupr_s to return 0, got %d\n", ret);
2507 
2508  errno = EBADF;
2509  ret = p_mbsupr_s(NULL, sizeof(buffer));
2510  ok(ret == EINVAL, "Expected _mbsupr_s to return EINVAL, got %d\n", ret);
2511  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2512 
2513  errno = EBADF;
2514  ret = p_mbsupr_s(buffer, 0);
2515  ok(ret == EINVAL, "Expected _mbsupr_s to return EINVAL, got %d\n", ret);
2516  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2517 
2518  memcpy(buffer, "abcdefgh", sizeof("abcdefgh"));
2519  errno = EBADF;
2520  ret = p_mbsupr_s(buffer, sizeof("abcdefgh"));
2521  ok(ret == 0, "Expected _mbsupr_s to return 0, got %d\n", ret);
2522  ok(!memcmp(buffer, "ABCDEFGH", sizeof("ABCDEFGH")),
2523  "Expected the output buffer to be \"ABCDEFGH\", got \"%s\"\n",
2524  buffer);
2525 
2526  memcpy(buffer, "abcdefgh", sizeof("abcdefgh"));
2527  errno = EBADF;
2528  ret = p_mbsupr_s(buffer, sizeof(buffer));
2529  ok(ret == 0, "Expected _mbsupr_s to return 0, got %d\n", ret);
2530  ok(!memcmp(buffer, "ABCDEFGH", sizeof("ABCDEFGH")),
2531  "Expected the output buffer to be \"ABCDEFGH\", got \"%s\"\n",
2532  buffer);
2533 
2534  memcpy(buffer, "abcdefgh", sizeof("abcdefgh"));
2535  errno = EBADF;
2536  ret = p_mbsupr_s(buffer, 4);
2537  ok(ret == EINVAL, "Expected _mbsupr_s to return EINVAL, got %d\n", ret);
2538  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2539 
2540  memcpy(buffer, "abcdefgh\0ijklmnop", sizeof("abcdefgh\0ijklmnop"));
2541  errno = EBADF;
2542  ret = p_mbsupr_s(buffer, sizeof(buffer));
2543  ok(ret == 0, "Expected _mbsupr_s to return 0, got %d\n", ret);
2544  ok(!memcmp(buffer, "ABCDEFGH\0ijklmnop", sizeof("ABCDEFGH\0ijklmnop")),
2545  "Expected the output buffer to be \"ABCDEFGH\\0ijklmnop\", got \"%s\"\n",
2546  buffer);
2547 
2548 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: arc.h:39
GLuint buffer
Definition: glext.h:5915
int errno
Definition: arc.h:36
smooth NULL
Definition: ftsmooth.c:416
int errno_t
Definition: crtdefs.h:353
#define ok(value,...)
Definition: CComObject.cpp:34
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__memicmp()

static void test__memicmp ( void  )
static

Definition at line 3288 of file string.c.

3289 {
3290  static const char *s1 = "abc";
3291  static const char *s2 = "aBd";
3292  int ret;
3293 
3294  ret = p__memicmp(NULL, NULL, 0);
3295  ok(!ret, "got %d\n", ret);
3296 
3297  ret = p__memicmp(s1, s2, 2);
3298  ok(!ret, "got %d\n", ret);
3299 
3300  ret = p__memicmp(s1, s2, 3);
3301  ok(ret == -1, "got %d\n", ret);
3302 
3303  if (!p__memicmp_l)
3304  return;
3305 
3306  /* Following calls crash on WinXP/W2k3. */
3307  errno = 0xdeadbeef;
3308  ret = p__memicmp(NULL, NULL, 1);
3309  ok(ret == _NLSCMPERROR, "got %d\n", ret);
3310  ok(errno == EINVAL, "errno is %d, expected EINVAL\n", errno);
3311 
3312  errno = 0xdeadbeef;
3313  ret = p__memicmp(s1, NULL, 1);
3314  ok(ret == _NLSCMPERROR, "got %d\n", ret);
3315  ok(errno == EINVAL, "errno is %d, expected EINVAL\n", errno);
3316 
3317  errno = 0xdeadbeef;
3318  ret = p__memicmp(NULL, s2, 1);
3319  ok(ret == _NLSCMPERROR, "got %d\n", ret);
3320  ok(errno == EINVAL, "errno is %d, expected EINVAL\n", errno);
3321 }
struct S2 s2
Definition: arc.h:39
int errno
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
struct S1 s1
int ret
#define _NLSCMPERROR
Definition: string.h:17

Referenced by START_TEST().

◆ test__memicmp_l()

static void test__memicmp_l ( void  )
static

Definition at line 3323 of file string.c.

3324 {
3325  static const char *s1 = "abc";
3326  static const char *s2 = "aBd";
3327  int ret;
3328 
3329  if (!p__memicmp_l)
3330  {
3331  win_skip("_memicmp_l not found.\n");
3332  return;
3333  }
3334 
3335  errno = 0xdeadbeef;
3336  ret = p__memicmp_l(NULL, NULL, 0, NULL);
3337  ok(!ret, "got %d\n", ret);
3338  ok(errno == 0xdeadbeef, "errno is %d, expected 0xdeadbeef\n", errno);
3339 
3340  errno = 0xdeadbeef;
3341  ret = p__memicmp_l(NULL, NULL, 1, NULL);
3342  ok(ret == _NLSCMPERROR, "got %d\n", ret);
3343  ok(errno == EINVAL, "errno is %d, expected EINVAL\n", errno);
3344 
3345  errno = 0xdeadbeef;
3346  ret = p__memicmp_l(s1, NULL, 1, NULL);
3347  ok(ret == _NLSCMPERROR, "got %d\n", ret);
3348  ok(errno == EINVAL, "errno is %d, expected EINVAL\n", errno);
3349 
3350  errno = 0xdeadbeef;
3351  ret = p__memicmp_l(NULL, s2, 1, NULL);
3352  ok(ret == _NLSCMPERROR, "got %d\n", ret);
3353  ok(errno == EINVAL, "errno is %d, expected EINVAL\n", errno);
3354 
3355  errno = 0xdeadbeef;
3356  ret = p__memicmp_l(s1, s2, 2, NULL);
3357  ok(!ret, "got %d\n", ret);
3358  ok(errno == 0xdeadbeef, "errno is %d, expected 0xdeadbeef\n", errno);
3359 
3360  errno = 0xdeadbeef;
3361  ret = p__memicmp_l(s1, s2, 3, NULL);
3362  ok(ret == -1, "got %d\n", ret);
3363  ok(errno == 0xdeadbeef, "errno is %d, expected 0xdeadbeef\n", errno);
3364 }
struct S2 s2
Definition: arc.h:39
int errno
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
struct S1 s1
int ret
#define _NLSCMPERROR
Definition: string.h:17
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__stricmp()

static void test__stricmp ( void  )
static

Definition at line 2908 of file string.c.

2909 {
2910  int ret;
2911 
2912  ret = _stricmp("test", "test");
2913  ok(ret == 0, "_stricmp returned %d\n", ret);
2914  ret = _stricmp("a", "z");
2915  ok(ret < 0, "_stricmp returned %d\n", ret);
2916  ret = _stricmp("z", "a");
2917  ok(ret > 0, "_stricmp returned %d\n", ret);
2918  ret = _stricmp("\xa5", "\xb9");
2919  ok(ret < 0, "_stricmp returned %d\n", ret);
2920 
2921  if(!setlocale(LC_ALL, "polish")) {
2922  win_skip("stricmp tests\n");
2923  return;
2924  }
2925 
2926  ret = _stricmp("test", "test");
2927  ok(ret == 0, "_stricmp returned %d\n", ret);
2928  ret = _stricmp("a", "z");
2929  ok(ret < 0, "_stricmp returned %d\n", ret);
2930  ret = _stricmp("z", "a");
2931  ok(ret > 0, "_stricmp returned %d\n", ret);
2932  ret = _stricmp("\xa5", "\xb9");
2933  ok(ret == 0, "_stricmp returned %d\n", ret);
2934  ret = _stricmp("a", "\xb9");
2935  ok(ret < 0, "_stricmp returned %d\n", ret);
2936 
2937  setlocale(LC_ALL, "C");
2938 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define LC_ALL
Definition: locale.h:25
int _stricmp(const char *str1, const char *str2)
Definition: string.c:11
int ret
#define setlocale(n, s)
Definition: locale.h:46
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__strlwr_s()

static void test__strlwr_s ( void  )
static

Definition at line 2270 of file string.c.

2271 {
2272  errno_t ret;
2273  char buffer[20];
2274 
2275  if (!p_strlwr_s)
2276  {
2277  win_skip("Skipping _strlwr_s tests\n");
2278  return;
2279  }
2280 
2281  errno = EBADF;
2282  ret = p_strlwr_s(NULL, 0);
2283  ok(ret == EINVAL, "Expected _strlwr_s to return EINVAL, got %d\n", ret);
2284  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2285 
2286  errno = EBADF;
2287  ret = p_strlwr_s(NULL, sizeof(buffer));
2288  ok(ret == EINVAL, "Expected _strlwr_s to return EINVAL, got %d\n", ret);
2289  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2290 
2291  errno = EBADF;
2292  ret = p_strlwr_s(buffer, 0);
2293  ok(ret == EINVAL, "Expected _strlwr_s to return EINVAL, got %d\n", ret);
2294  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2295 
2296  strcpy(buffer, "GoRrIsTeR");
2297  errno = EBADF;
2298  ret = p_strlwr_s(buffer, 5);
2299  ok(ret == EINVAL, "Expected _strlwr_s to return EINVAL, got %d\n", ret);
2300  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2301  ok(!memcmp(buffer, "\0oRrIsTeR", sizeof("\0oRrIsTeR")),
2302  "Expected the output buffer to be \"\\0oRrIsTeR\"\n");
2303 
2304  strcpy(buffer, "GoRrIsTeR");
2305  errno = EBADF;
2306  ret = p_strlwr_s(buffer, sizeof("GoRrIsTeR") - 1);
2307  ok(ret == EINVAL, "Expected _strlwr_s to return EINVAL, got %d\n", ret);
2308  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2309  ok(!memcmp(buffer, "\0oRrIsTeR", sizeof("\0oRrIsTeR")),
2310  "Expected the output buffer to be \"\\0oRrIsTeR\"\n");
2311 
2312  strcpy(buffer, "GoRrIsTeR");
2313  ret = p_strlwr_s(buffer, sizeof("GoRrIsTeR"));
2314  ok(ret == 0, "Expected _strlwr_s to return 0, got %d\n", ret);
2315  ok(!strcmp(buffer, "gorrister"),
2316  "Expected the output buffer to be \"gorrister\", got \"%s\"\n",
2317  buffer);
2318 
2319  memcpy(buffer, "GoRrIsTeR\0ELLEN", sizeof("GoRrIsTeR\0ELLEN"));
2320  ret = p_strlwr_s(buffer, sizeof(buffer));
2321  ok(ret == 0, "Expected _strlwr_s to return 0, got %d\n", ret);
2322  ok(!memcmp(buffer, "gorrister\0ELLEN", sizeof("gorrister\0ELLEN")),
2323  "Expected the output buffer to be \"gorrister\\0ELLEN\", got \"%s\"\n",
2324  buffer);
2325 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: arc.h:39
GLuint buffer
Definition: glext.h:5915
int errno
Definition: arc.h:36
smooth NULL
Definition: ftsmooth.c:416
int errno_t
Definition: crtdefs.h:353
#define ok(value,...)
Definition: CComObject.cpp:34
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__strnset_s()

static void test__strnset_s ( void  )
static

Definition at line 3171 of file string.c.

3172 {
3173  char buf[5] = {0};
3174  int r;
3175 
3176  if(!p__strnset_s) {
3177  win_skip("_strnset_s not available\n");
3178  return;
3179  }
3180 
3181  r = p__strnset_s(NULL, 0, 'a', 0);
3182  ok(r == 0, "r = %d\n", r);
3183 
3184  buf[0] = buf[1] = buf[2] = 'b';
3185  r = p__strnset_s(buf, sizeof(buf), 'a', 2);
3186  ok(r == 0, "r = %d\n", r);
3187  ok(!strcmp(buf, "aab"), "buf = %s\n", buf);
3188 
3189  r = p__strnset_s(buf, 0, 'a', 0);
3190  ok(r == EINVAL, "r = %d\n", r);
3191 
3192  r = p__strnset_s(NULL, 0, 'a', 1);
3193  ok(r == EINVAL, "r = %d\n", r);
3194 
3195  buf[3] = 'b';
3196  r = p__strnset_s(buf, sizeof(buf)-1, 'c', 2);
3197  ok(r == EINVAL, "r = %d\n", r);
3198  ok(!buf[0] && buf[1]=='c' && buf[2]=='b', "buf = %s\n", buf);
3199 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
Definition: arc.h:39
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__strtod()

static void test__strtod ( void  )
static

Definition at line 1804 of file string.c.

1805 {
1806  const char double1[] = "12.1";
1807  const char double2[] = "-13.721";
1808  const char double3[] = "INF";
1809  const char double4[] = ".21e12";
1810  const char double5[] = "214353e-3";
1811  const char double6[] = "NAN";
1812  const char overflow[] = "1d9999999999999999999";
1813  const char white_chars[] = " d10";
1814 
1815  char *end;
1816  double d;
1817 
1818  d = strtod(double1, &end);
1819  ok(almost_equal(d, 12.1), "d = %lf\n", d);
1820  ok(end == double1+4, "incorrect end (%d)\n", (int)(end-double1));
1821 
1822  d = strtod(double2, &end);
1823  ok(almost_equal(d, -13.721), "d = %lf\n", d);
1824  ok(end == double2+7, "incorrect end (%d)\n", (int)(end-double2));
1825 
1826  d = strtod(double3, &end);
1827  ok(almost_equal(d, 0), "d = %lf\n", d);
1828  ok(end == double3, "incorrect end (%d)\n", (int)(end-double3));
1829 
1830  d = strtod(double4, &end);
1831  ok(almost_equal(d, 210000000000.0), "d = %lf\n", d);
1832  ok(end == double4+6, "incorrect end (%d)\n", (int)(end-double4));
1833 
1834  d = strtod(double5, &end);
1835  ok(almost_equal(d, 214.353), "d = %lf\n", d);
1836  ok(end == double5+9, "incorrect end (%d)\n", (int)(end-double5));
1837 
1838  d = strtod(double6, &end);
1839  ok(almost_equal(d, 0), "d = %lf\n", d);
1840  ok(end == double6, "incorrect end (%d)\n", (int)(end-double6));
1841 
1842  d = strtod("12.1d2", NULL);
1843  ok(almost_equal(d, 12.1e2), "d = %lf\n", d);
1844 
1845  d = strtod(white_chars, &end);
1846  ok(almost_equal(d, 0), "d = %lf\n", d);
1847  ok(end == white_chars, "incorrect end (%d)\n", (int)(end-white_chars));
1848 
1849  if (!p__strtod_l)
1850  win_skip("_strtod_l not found\n");
1851  else
1852  {
1853  errno = EBADF;
1854  d = strtod(NULL, NULL);
1855  ok(almost_equal(d, 0.0), "d = %lf\n", d);
1856  ok(errno == EINVAL, "errno = %x\n", errno);
1857 
1858  errno = EBADF;
1859  end = (char *)0xdeadbeef;
1860  d = strtod(NULL, &end);
1861  ok(almost_equal(d, 0.0), "d = %lf\n", d);
1862  ok(errno == EINVAL, "errno = %x\n", errno);
1863  ok(!end, "incorrect end ptr %p\n", end);
1864 
1865  errno = EBADF;
1866  d = p__strtod_l(NULL, NULL, NULL);
1867  ok(almost_equal(d, 0.0), "d = %lf\n", d);
1868  ok(errno == EINVAL, "errno = %x\n", errno);
1869  }
1870 
1871  /* Set locale with non '.' decimal point (',') */
1872  if(!setlocale(LC_ALL, "Polish")) {
1873  win_skip("system with limited locales\n");
1874  return;
1875  }
1876 
1877  d = strtod("12.1", NULL);
1878  ok(almost_equal(d, 12.0), "d = %lf\n", d);
1879 
1880  d = strtod("12,1", NULL);
1881  ok(almost_equal(d, 12.1), "d = %lf\n", d);
1882 
1883  setlocale(LC_ALL, "C");
1884 
1885  /* Precision tests */
1886  d = strtod("0.1", NULL);
1887  ok(almost_equal(d, 0.1), "d = %lf\n", d);
1888  d = strtod("-0.1", NULL);
1889  ok(almost_equal(d, -0.1), "d = %lf\n", d);
1890  d = strtod("0.1281832188491894198128921", NULL);
1891  ok(almost_equal(d, 0.1281832188491894198128921), "d = %lf\n", d);
1892  d = strtod("0.82181281288121", NULL);
1893  ok(almost_equal(d, 0.82181281288121), "d = %lf\n", d);
1894  d = strtod("21921922352523587651128218821", NULL);
1895  ok(almost_equal(d, 21921922352523587651128218821.0), "d = %lf\n", d);
1896  d = strtod("0.1d238", NULL);
1897  ok(almost_equal(d, 0.1e238L), "d = %lf\n", d);
1898  d = strtod("0.1D-4736", NULL);
1899  ok(almost_equal(d, 0.1e-4736L), "d = %lf\n", d);
1900 
1901  errno = 0xdeadbeef;
1902  strtod(overflow, &end);
1903  ok(errno == ERANGE, "errno = %x\n", errno);
1904  ok(end == overflow+21, "incorrect end (%d)\n", (int)(end-overflow));
1905 
1906  errno = 0xdeadbeef;
1907  strtod("-1d309", NULL);
1908  ok(errno == ERANGE, "errno = %x\n", errno);
1909 }
_Check_return_ double __cdecl strtod(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr)
Definition: arc.h:39
GLuint GLuint end
Definition: gl.h:1545
int errno
Definition: arc.h:36
#define e
Definition: ke_i.h:82
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define LC_ALL
Definition: locale.h:25
#define d
Definition: ke_i.h:81
#define ERANGE
Definition: acclib.h:92
static const WCHAR L[]
Definition: oid.c:1250
static BOOL almost_equal(double d1, double d2)
Definition: string.c:1798
#define setlocale(n, s)
Definition: locale.h:46
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__strtoi64()

static void test__strtoi64 ( void  )
static

Definition at line 1653 of file string.c.

1654 {
1655  static const char no1[] = "31923";
1656  static const char no2[] = "-213312";
1657  static const char no3[] = "12aa";
1658  static const char no4[] = "abc12";
1659  static const char overflow[] = "99999999999999999999";
1660  static const char neg_overflow[] = "-99999999999999999999";
1661  static const char hex[] = "0x123";
1662  static const char oct[] = "000123";
1663  static const char blanks[] = " 12 212.31";
1664 
1665  __int64 res;
1666  unsigned __int64 ures;
1667  char *endpos;
1668 
1669  if(!p_strtoi64 || !p_strtoui64) {
1670  win_skip("_strtoi64 or _strtoui64 not found\n");
1671  return;
1672  }
1673 
1674  errno = 0xdeadbeef;
1675  res = p_strtoi64(no1, NULL, 10);
1676  ok(res == 31923, "res != 31923\n");
1677  res = p_strtoi64(no2, NULL, 10);
1678  ok(res == -213312, "res != -213312\n");
1679  res = p_strtoi64(no3, NULL, 10);
1680  ok(res == 12, "res != 12\n");
1681  res = p_strtoi64(no4, &endpos, 10);
1682  ok(res == 0, "res != 0\n");
1683  ok(endpos == no4, "Scanning was not stopped on first character\n");
1684  res = p_strtoi64(hex, &endpos, 10);
1685  ok(res == 0, "res != 0\n");
1686  ok(endpos == hex+1, "Incorrect endpos (%p-%p)\n", hex, endpos);
1687  res = p_strtoi64(oct, &endpos, 10);
1688  ok(res == 123, "res != 123\n");
1689  ok(endpos == oct+strlen(oct), "Incorrect endpos (%p-%p)\n", oct, endpos);
1690  res = p_strtoi64(blanks, &endpos, 10);
1691  ok(res == 12, "res != 12\n");
1692  ok(endpos == blanks+10, "Incorrect endpos (%p-%p)\n", blanks, endpos);
1693  ok(errno == 0xdeadbeef, "errno = %x\n", errno);
1694 
1695  errno = 0xdeadbeef;
1696  res = p_strtoi64(overflow, &endpos, 10);
1697  ok(res == _I64_MAX, "res != _I64_MAX\n");
1698  ok(endpos == overflow+strlen(overflow), "Incorrect endpos (%p-%p)\n", overflow, endpos);
1699  ok(errno == ERANGE, "errno = %x\n", errno);
1700 
1701  errno = 0xdeadbeef;
1702  res = p_strtoi64(neg_overflow, &endpos, 10);
1703  ok(res == _I64_MIN, "res != _I64_MIN\n");
1704  ok(endpos == neg_overflow+strlen(neg_overflow), "Incorrect endpos (%p-%p)\n", neg_overflow, endpos);
1705  ok(errno == ERANGE, "errno = %x\n", errno);
1706 
1707  errno = 0xdeadbeef;
1708  res = p_strtoi64(no1, &endpos, 16);
1709  ok(res == 203043, "res != 203043\n");
1710  ok(endpos == no1+strlen(no1), "Incorrect endpos (%p-%p)\n", no1, endpos);
1711  res = p_strtoi64(no2, &endpos, 16);
1712  ok(res == -2175762, "res != -2175762\n");
1713  ok(endpos == no2+strlen(no2), "Incorrect endpos (%p-%p)\n", no2, endpos);
1714  res = p_strtoi64(no3, &endpos, 16);
1715  ok(res == 4778, "res != 4778\n");
1716  ok(endpos == no3+strlen(no3), "Incorrect endpos (%p-%p)\n", no3, endpos);
1717  res = p_strtoi64(no4, &endpos, 16);
1718  ok(res == 703506, "res != 703506\n");
1719  ok(endpos == no4+strlen(no4), "Incorrect endpos (%p-%p)\n", no4, endpos);
1720  res = p_strtoi64(hex, &endpos, 16);
1721  ok(res == 291, "res != 291\n");
1722  ok(endpos == hex+strlen(hex), "Incorrect endpos (%p-%p)\n", hex, endpos);
1723  res = p_strtoi64(oct, &endpos, 16);
1724  ok(res == 291, "res != 291\n");
1725  ok(endpos == oct+strlen(oct), "Incorrect endpos (%p-%p)\n", oct, endpos);
1726  res = p_strtoi64(blanks, &endpos, 16);
1727  ok(res == 18, "res != 18\n");
1728  ok(endpos == blanks+10, "Incorrect endpos (%p-%p)\n", blanks, endpos);
1729  ok(errno == 0xdeadbeef, "errno = %x\n", errno);
1730 
1731  errno = 0xdeadbeef;
1732  res = p_strtoi64(hex, &endpos, 36);
1733  ok(res == 1541019, "res != 1541019\n");
1734  ok(endpos == hex+strlen(hex), "Incorrect endpos (%p-%p)\n", hex, endpos);
1735  ok(errno == 0xdeadbeef, "errno = %x\n", errno);
1736 
1737  errno = 0xdeadbeef;
1738  res = p_strtoi64(no1, &endpos, 0);
1739  ok(res == 31923, "res != 31923\n");
1740  ok(endpos == no1+strlen(no1), "Incorrect endpos (%p-%p)\n", no1, endpos);
1741  res = p_strtoi64(no2, &endpos, 0);
1742  ok(res == -213312, "res != -213312\n");
1743  ok(endpos == no2+strlen(no2), "Incorrect endpos (%p-%p)\n", no2, endpos);
1744  res = p_strtoi64(no3, &endpos, 10);
1745  ok(res == 12, "res != 12\n");
1746  ok(endpos == no3+2, "Incorrect endpos (%p-%p)\n", no3, endpos);
1747  res = p_strtoi64(no4, &endpos, 10);
1748  ok(res == 0, "res != 0\n");
1749  ok(endpos == no4, "Incorrect endpos (%p-%p)\n", no4, endpos);
1750  res = p_strtoi64(hex, &endpos, 10);
1751  ok(res == 0, "res != 0\n");
1752  ok(endpos == hex+1, "Incorrect endpos (%p-%p)\n", hex, endpos);
1753  res = p_strtoi64(oct, &endpos, 10);
1754  ok(res == 123, "res != 123\n");
1755  ok(endpos == oct+strlen(oct), "Incorrect endpos (%p-%p)\n", oct, endpos);
1756  res = p_strtoi64(blanks, &endpos, 10);
1757  ok(res == 12, "res != 12\n");
1758  ok(endpos == blanks+10, "Incorrect endpos (%p-%p)\n", blanks, endpos);
1759  ok(errno == 0xdeadbeef, "errno = %x\n", errno);
1760 
1761  errno = 0xdeadbeef;
1762  ures = p_strtoui64(no1, &endpos, 0);
1763  ok(ures == 31923, "ures != 31923\n");
1764  ok(endpos == no1+strlen(no1), "Incorrect endpos (%p-%p)\n", no1, endpos);
1765  ures = p_strtoui64(no2, &endpos, 0);
1766  ok(ures == -213312, "ures != -213312\n");
1767  ok(endpos == no2+strlen(no2), "Incorrect endpos (%p-%p)\n", no2, endpos);
1768  ures = p_strtoui64(no3, &endpos, 10);
1769  ok(ures == 12, "ures != 12\n");
1770  ok(endpos == no3+2, "Incorrect endpos (%p-%p)\n", no3, endpos);
1771  ures = p_strtoui64(no4, &endpos, 10);
1772  ok(ures == 0, "ures != 0\n");
1773  ok(endpos == no4, "Incorrect endpos (%p-%p)\n", no4, endpos);
1774  ures = p_strtoui64(hex, &endpos, 10);
1775  ok(ures == 0, "ures != 0\n");
1776  ok(endpos == hex+1, "Incorrect endpos (%p-%p)\n", hex, endpos);
1777  ures = p_strtoui64(oct, &endpos, 10);
1778  ok(ures == 123, "ures != 123\n");
1779  ok(endpos == oct+strlen(oct), "Incorrect endpos (%p-%p)\n", oct, endpos);
1780  ures = p_strtoui64(blanks, &endpos, 10);
1781  ok(ures == 12, "ures != 12\n");
1782  ok(endpos == blanks+10, "Incorrect endpos (%p-%p)\n", blanks, endpos);
1783  ok(errno == 0xdeadbeef, "errno = %x\n", errno);
1784 
1785  errno = 0xdeadbeef;
1786  ures = p_strtoui64(overflow, &endpos, 10);
1787  ok(ures == _UI64_MAX, "ures != _UI64_MAX\n");
1788  ok(endpos == overflow+strlen(overflow), "Incorrect endpos (%p-%p)\n", overflow, endpos);
1789  ok(errno == ERANGE, "errno = %x\n", errno);
1790 
1791  errno = 0xdeadbeef;
1792  ures = p_strtoui64(neg_overflow, &endpos, 10);
1793  ok(ures == 1, "ures != 1\n");
1794  ok(endpos == neg_overflow+strlen(neg_overflow), "Incorrect endpos (%p-%p)\n", neg_overflow, endpos);
1795  ok(errno == ERANGE, "errno = %x\n", errno);
1796 }
#define _UI64_MAX
Definition: limits.h:63
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int errno
static const char hex[16]
Definition: profile.c:123
static __int64(__cdecl *p_strtoi64)(const char *
smooth NULL
Definition: ftsmooth.c:416
#define _I64_MAX
Definition: limits.h:62
#define ok(value,...)
Definition: CComObject.cpp:34
#define ERANGE
Definition: acclib.h:92
#define _I64_MIN
Definition: limits.h:61
ios_base &_STLP_CALL oct(ios_base &__s)
Definition: _ios_base.h:327
GLuint res
Definition: glext.h:9613
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__strupr()

static void test__strupr ( void  )
static

Definition at line 3366 of file string.c.

3367 {
3368  const char str[] = "123";
3369  char str2[4];
3370  char *mem, *p;
3371  DWORD prot;
3372 
3374  ok(mem != NULL, "VirtualAlloc failed\n");
3375  memcpy(mem, str, sizeof(str));
3376  ok(VirtualProtect(mem, sizeof(str), PAGE_READONLY, &prot), "VirtualProtect failed\n");
3377 
3378  strcpy(str2, "aBc");
3379  p = _strupr(str2);
3380  ok(p == str2, "_strupr returned %p\n", p);
3381  ok(!strcmp(str2, "ABC"), "str2 = %s\n", str2);
3382 
3383  p = _strupr(mem);
3384  ok(p == mem, "_strupr returned %p\n", p);
3385  ok(!strcmp(mem, "123"), "mem = %s\n", mem);
3386 
3387  if(!setlocale(LC_ALL, "english")) {
3388  VirtualFree(mem, sizeof(str), MEM_RELEASE);
3389  win_skip("English locale _strupr tests\n");
3390  return;
3391  }
3392 
3393  strcpy(str2, "aBc");
3394  p = _strupr(str2);
3395  ok(p == str2, "_strupr returned %p\n", p);
3396  ok(!strcmp(str2, "ABC"), "str2 = %s\n", str2);
3397 
3398  if (0) /* crashes on Windows */
3399  {
3400  p = _strupr(mem);
3401  ok(p == mem, "_strupr returned %p\n", p);
3402  ok(!strcmp(mem, "123"), "mem = %s\n", mem);
3403  }
3404 
3405  setlocale(LC_ALL, "C");
3406  VirtualFree(mem, sizeof(str), MEM_RELEASE);
3407 }
#define MEM_COMMIT
Definition: nt_native.h:1313
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:74
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define LC_ALL
Definition: locale.h:25
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL NTAPI VirtualProtect(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flNewProtect, OUT PDWORD lpflOldProtect)
Definition: virtmem.c:144
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
_CRTIMP char *__cdecl _strupr(_Inout_z_ char *_String)
#define PAGE_READONLY
Definition: compat.h:127
Definition: mem.c:156
#define MEM_RELEASE
Definition: nt_native.h:1316
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define setlocale(n, s)
Definition: locale.h:46
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:128
GLfloat GLfloat p
Definition: glext.h:8902
#define win_skip
Definition: test.h:141
#define PAGE_READWRITE
Definition: nt_native.h:1304

Referenced by START_TEST().

◆ test__tcsncoll()

static void test__tcsncoll ( void  )
static

Definition at line 3409 of file string.c.

3410 {
3411  struct test {
3412  const char *locale;
3413  const char *str1;
3414  const char *str2;
3415  size_t count;
3416  int exp;
3417  };
3418  static const struct test tests[] = {
3419  { "English", "ABCD", "ABCD", 4, 0 },
3420  { "English", "ABCD", "ABCD", 10, 0 },
3421 
3422  { "English", "ABC", "ABCD", 3, 0 },
3423  { "English", "ABC", "ABCD", 4, -1 },
3424  { "English", "ABC", "ABCD", 10, -1 },
3425 
3426  { "English", "ABCD", "ABC", 3, 0 },
3427  { "English", "ABCD", "ABC", 4, 1 },
3428  { "English", "ABCD", "ABC", 10, 1 },
3429 
3430  { "English", "ABCe", "ABCf", 3, 0 },
3431  { "English", "abcd", "ABCD", 10, -1 },
3432 
3433  { "C", "ABCD", "ABCD", 4, 0 },
3434  { "C", "ABCD", "ABCD", 10, 0 },
3435 
3436  { "C", "ABC", "ABCD", 3, 0 },
3437  { "C", "ABC", "ABCD", 10, -1 },
3438 
3439  { "C", "ABCD", "ABC", 3, 0 },
3440  { "C", "ABCD", "ABC", 10, 1 },
3441 
3442  { "C", "ABCe", "ABCf", 3, 0 },
3443  { "C", "abcd", "ABCD", 10, 1 },
3444  };
3445  WCHAR str1W[16];
3446  WCHAR str2W[16];
3447  char str1[16];
3448  char str2[16];
3449  size_t len;
3450  int i, ret;
3451 
3452  for (i = 0; i < ARRAY_SIZE(tests); i++)
3453  {
3454  if (!setlocale(LC_ALL, tests[i].locale))
3455  {
3456  win_skip("%s locale _tcsncoll tests\n", tests[i].locale);
3457  for (; i+1 < ARRAY_SIZE(tests); i++)
3458  if (strcmp(tests[i].locale, tests[i+1].locale)) break;
3459  continue;
3460  }
3461 
3462  memset(str1, 0xee, sizeof(str1));
3463  strcpy(str1, tests[i].str1);
3464 
3465  memset(str2, 0xff, sizeof(str2));
3466  strcpy(str2, tests[i].str2);
3467 
3468  ret = _strncoll(str1, str2, tests[i].count);
3469  if (!tests[i].exp)
3470  ok(!ret, "expected 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count);
3471  else if (tests[i].exp < 0)
3472  ok(ret < 0, "expected < 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count);
3473  else
3474  ok(ret > 0, "expected > 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count);
3475 
3476  memset(str1W, 0xee, sizeof(str1W));
3477  len = mbstowcs(str1W, str1, ARRAY_SIZE(str1W));
3478  str1W[len] = 0;
3479 
3480  memset(str2W, 0xff, sizeof(str2W));
3481  len = mbstowcs(str2W, str2, ARRAY_SIZE(str2W));
3482  str2W[len] = 0;
3483 
3484  ret = _wcsncoll(str1W, str2W, tests[i].count);
3485  if (!tests[i].exp)
3486  ok(!ret, "expected 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count);
3487  else if (tests[i].exp < 0)
3488  ok(ret < 0, "expected < 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count);
3489  else
3490  ok(ret > 0, "expected > 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count);
3491  }
3492 }
struct param_test tests[]
size_t __cdecl mbstowcs(_Out_writes_opt_z_(_MaxCount) wchar_t *_Dest, _In_z_ const char *_Source, _In_ size_t _MaxCount)
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define test
Definition: rosglue.h:37
_Check_return_ _CRTIMP int __cdecl _wcsncoll(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2, _In_ size_t _MaxCount)
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
Definition: _locale.h:75
#define ok(value,...)
Definition: CComObject.cpp:34
#define LC_ALL
Definition: locale.h:25
_Check_return_ _CRTIMP int __cdecl _strncoll(_In_z_ const char *_Str1, _In_z_ const char *_Str2, _In_ size_t _MaxCount)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static size_t len
Definition: string.c:60
int ret
GLenum GLsizei len
Definition: glext.h:6722
static const wchar_t void * locale
Definition: printf.c:73
#define ARRAY_SIZE(a)
Definition: main.h:24
static size_t const unsigned char size_t count
Definition: string.c:63
DWORD exp
Definition: msg.c:15681
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define setlocale(n, s)
Definition: locale.h:46
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__tcsnicoll()

static void test__tcsnicoll ( void  )
static

Definition at line 3494 of file string.c.

3495 {
3496  struct test {
3497  const char *locale;
3498  const char *str1;
3499  const char *str2;
3500  size_t count;
3501  int exp;
3502  };
3503  static const struct test tests[] = {
3504  { "English", "abcd", "ABCD", 4, 0 },
3505  { "English", "abcd", "ABCD", 10, 0 },
3506 
3507  { "English", "abc", "ABCD", 3, 0 },
3508  { "English", "abc", "ABCD", 4, -1 },
3509  { "English", "abc", "ABCD", 10, -1 },
3510 
3511  { "English", "abcd", "ABC", 3, 0 },
3512  { "English", "abcd", "ABC", 4, 1 },
3513  { "English", "abcd", "ABC", 10, 1 },
3514 
3515  { "English", "abcE", "ABCF", 3, 0 },
3516 
3517  { "C", "abcd", "ABCD", 4, 0 },
3518  { "C", "abcd", "ABCD", 10, 0 },
3519 
3520  { "C", "abc", "ABCD", 3, 0 },
3521  { "C", "abc", "ABCD", 10, -1 },
3522 
3523  { "C", "abcd", "ABC", 3, 0 },
3524  { "C", "abcd", "ABC", 10, 1 },
3525 
3526  { "C", "abce", "ABCf", 3, 0 },
3527  };
3528  WCHAR str1W[16];
3529  WCHAR str2W[16];
3530  char str1[16];
3531  char str2[16];
3532  size_t len;
3533  int i, ret;
3534 
3535  for (i = 0; i < ARRAY_SIZE(tests); i++)
3536  {
3537  if (!setlocale(LC_ALL, tests[i].locale))
3538  {
3539  win_skip("%s locale _tcsnicoll tests\n", tests[i].locale);
3540  for (; i+1 < ARRAY_SIZE(tests); i++)
3541  if (strcmp(tests[i].locale, tests[i+1].locale)) break;
3542  continue;
3543  }
3544 
3545  memset(str1, 0xee, sizeof(str1));
3546  strcpy(str1, tests[i].str1);
3547 
3548  memset(str2, 0xff, sizeof(str2));
3549  strcpy(str2, tests[i].str2);
3550 
3551  ret = _strnicoll(str1, str2, tests[i].count);
3552  if (!tests[i].exp)
3553  ok(!ret, "expected 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count);
3554  else if (tests[i].exp < 0)
3555  ok(ret < 0, "expected < 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count);
3556  else
3557  ok(ret > 0, "expected > 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count);
3558 
3559  memset(str1W, 0xee, sizeof(str1W));
3560  len = mbstowcs(str1W, str1, ARRAY_SIZE(str1W));
3561  str1W[len] = 0;
3562 
3563  memset(str2W, 0xff, sizeof(str2W));
3564  len = mbstowcs(str2W, str2, ARRAY_SIZE(str2W));
3565  str2W[len] = 0;
3566 
3567  ret = _wcsnicoll(str1W, str2W, tests[i].count);
3568  if (!tests[i].exp)
3569  ok(!ret, "expected 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count);
3570  else if (tests[i].exp < 0)
3571  ok(ret < 0, "expected < 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count);
3572  else
3573  ok(ret > 0, "expected > 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count);
3574  }
3575 }
struct param_test tests[]
size_t __cdecl mbstowcs(_Out_writes_opt_z_(_MaxCount) wchar_t *_Dest, _In_z_ const char *_Source, _In_ size_t _MaxCount)
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define test
Definition: rosglue.h:37
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
Definition: _locale.h:75
#define ok(value,...)
Definition: CComObject.cpp:34
#define LC_ALL
Definition: locale.h:25
__wchar_t WCHAR
Definition: xmlstorage.h:180
static size_t len
Definition: string.c:60
int ret
_Check_return_ _CRTIMP int __cdecl _wcsnicoll(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2, _In_ size_t _MaxCount)
GLenum GLsizei len
Definition: glext.h:6722
static const wchar_t void * locale
Definition: printf.c:73
_Check_return_ _CRTIMP int __cdecl _strnicoll(_In_z_ const char *_Str1, _In_z_ const char *_Str2, _In_ size_t _MaxCount)
#define ARRAY_SIZE(a)
Definition: main.h:24
static size_t const unsigned char size_t count
Definition: string.c:63
DWORD exp
Definition: msg.c:15681
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define setlocale(n, s)
Definition: locale.h:46
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__ultoa_s()

static void test__ultoa_s ( void  )
static

Definition at line 2624 of file string.c.

2625 {
2626  errno_t ret;
2627  char buffer[33];
2628 
2629  if (!p_ultoa_s)
2630  {
2631  win_skip("Skipping _ultoa_s tests\n");
2632  return;
2633  }
2634 
2635  errno = EBADF;
2636  ret = p_ultoa_s(0, NULL, 0, 0);
2637  ok(ret == EINVAL, "Expected _ultoa_s to return EINVAL, got %d\n", ret);
2638  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2639 
2640  memset(buffer, 'X', sizeof(buffer));
2641  errno = EBADF;
2642  ret = p_ultoa_s(0, buffer, 0, 0);
2643  ok(ret == EINVAL, "Expected _ultoa_s to return EINVAL, got %d\n", ret);
2644  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2645  ok(buffer[0] == 'X', "Expected the output buffer to be untouched\n");
2646 
2647  memset(buffer, 'X', sizeof(buffer));
2648  errno = EBADF;
2649  ret = p_ultoa_s(0, buffer, sizeof(buffer), 0);
2650  ok(ret == EINVAL, "Expected _ultoa_s to return EINVAL, got %d\n", ret);
2651  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2652  ok(buffer[0] == '\0', "Expected the output buffer to be null terminated\n");
2653 
2654  memset(buffer, 'X', sizeof(buffer));
2655  errno = EBADF;
2656  ret = p_ultoa_s(0, buffer, sizeof(buffer), 64);
2657  ok(ret == EINVAL, "Expected _ultoa_s to return EINVAL, got %d\n", ret);
2658  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
2659  ok(buffer[0] == '\0', "Expected the output buffer to be null terminated\n");
2660 
2661  memset(buffer, 'X', sizeof(buffer));
2662  errno = EBADF;
2663  ret = p_ultoa_s(12345678, buffer, 4, 10);
2664  ok(ret == ERANGE, "Expected _ultoa_s to return ERANGE, got %d\n", ret);
2665  ok(errno == ERANGE, "Expected errno to be ERANGE, got %d\n", errno);
2666  ok(!memcmp(buffer, "\000765", 4),
2667  "Expected the output buffer to be null terminated with truncated output\n");
2668 
2669  memset(buffer, 'X', sizeof(buffer));
2670  errno = EBADF;
2671  ret = p_ultoa_s(12345678, buffer, 8, 10);
2672  ok(ret == ERANGE, "Expected _ultoa_s to return ERANGE, got %d\n", ret);
2673  ok(errno == ERANGE, "Expected errno to be ERANGE, got %d\n", errno);
2674  ok(!memcmp(buffer, "\0007654321", 8),
2675  "Expected the output buffer to be null terminated with truncated output\n");
2676 
2677  ret = p_ultoa_s(12345678, buffer, 9, 10);
2678  ok(ret == 0, "Expected _ultoa_s to return 0, got %d\n", ret);
2679  ok(!strcmp(buffer, "12345678"),
2680  "Expected output buffer string to be \"12345678\", got \"%s\"\n",
2681  buffer);
2682 
2683  ret = p_ultoa_s(43690, buffer, sizeof(buffer), 2);
2684  ok(ret == 0, "Expected _ultoa_s to return 0, got %d\n", ret);
2685  ok(!strcmp(buffer, "1010101010101010"),
2686  "Expected output buffer string to be \"1010101010101010\", got \"%s\"\n",
2687  buffer);
2688 
2689  ret = p_ultoa_s(1092009, buffer, sizeof(buffer), 36);
2690  ok(ret == 0, "Expected _ultoa_s to return 0, got %d\n", ret);
2691  ok(!strcmp(buffer, "nell"),
2692  "Expected output buffer string to be \"nell\", got \"%s\"\n",
2693  buffer);
2694 
2695  ret = p_ultoa_s(5704, buffer, sizeof(buffer), 18);
2696  ok(ret == 0, "Expected _ultoa_s to return 0, got %d\n", ret);
2697  ok(!strcmp(buffer, "hag"),
2698  "Expected output buffer string to be \"hag\", got \"%s\"\n",
2699  buffer);
2700 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: arc.h:39
GLuint buffer
Definition: glext.h:5915
int errno
Definition: arc.h:36
smooth NULL
Definition: ftsmooth.c:416
int errno_t
Definition: crtdefs.h:353
#define ok(value,...)
Definition: CComObject.cpp:34
#define ERANGE
Definition: acclib.h:92
int ret
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__wcslwr_s()

static void test__wcslwr_s ( void  )
static

Definition at line 1167 of file string.c.

1168 {
1169  static const WCHAR mixedString[] = {'M', 'i', 'X', 'e', 'D', 'l', 'o', 'w',
1170  'e', 'r', 'U', 'P', 'P', 'E', 'R', 0};
1171  static const WCHAR expectedString[] = {'m', 'i', 'x', 'e', 'd', 'l', 'o',
1172  'w', 'e', 'r', 'u', 'p', 'p', 'e',
1173  'r', 0};
1174  WCHAR buffer[2*ARRAY_SIZE(mixedString)];
1175  int ret;
1176 
1177  if (!p_wcslwr_s)
1178  {
1179  win_skip("_wcslwr_s not found\n");
1180  return;
1181  }
1182 
1183  /* Test NULL input string and invalid size. */
1184  errno = EBADF;
1185  ret = p_wcslwr_s(NULL, 0);
1186  ok(ret == EINVAL, "expected EINVAL, got %d\n", ret);
1187  ok(errno == EINVAL, "expected errno EINVAL, got %d\n", errno);
1188 
1189  /* Test NULL input string and valid size. */
1190  errno = EBADF;
1191  ret = p_wcslwr_s(NULL, ARRAY_SIZE(buffer));
1192  ok(ret == EINVAL, "expected EINVAL, got %d\n", ret);
1193  ok(errno == EINVAL, "expected errno EINVAL, got %d\n", errno);
1194 
1195  /* Test empty string with zero size. */
1196  errno = EBADF;
1197  buffer[0] = 'a';
1198  ret = p_wcslwr_s(buffer, 0);
1199  ok(ret == EINVAL, "expected EINVAL, got %d\n", ret);
1200  ok(errno == EINVAL, "expected errno EINVAL, got %d\n", errno);
1201  ok(buffer[0] == 0, "expected empty string\n");
1202 
1203  /* Test empty string with size of one. */
1204  buffer[0] = 0;
1205  ret = p_wcslwr_s(buffer, 1);
1206  ok(ret == 0, "got %d\n", ret);
1207  ok(buffer[0] == 0, "expected buffer to be unchanged\n");
1208 
1209  /* Test one-byte buffer with zero size. */
1210  errno = EBADF;
1211  buffer[0] = 'x';
1212  ret = p_wcslwr_s(buffer, 0);
1213  ok(ret == EINVAL, "expected EINVAL, got %d\n", ret);
1214  ok(errno == EINVAL, "expected errno to be EINVAL, got %d\n", errno);
1215  ok(buffer[0] == '\0', "expected empty string\n");
1216 
1217  /* Test one-byte buffer with size of one. */
1218  errno = EBADF;
1219  buffer[0] = 'x';
1220  ret = p_wcslwr_s(buffer, 1);
1221  ok(ret == EINVAL, "expected EINVAL, got %d\n", ret);
1222  ok(errno == EINVAL, "expected errno to be EINVAL, got %d\n", errno);
1223  ok(buffer[0] == '\0', "expected empty string\n");
1224 
1225  /* Test invalid size. */
1226  wcscpy(buffer, mixedString);
1227  errno = EBADF;
1228  ret = p_wcslwr_s(buffer, 0);
1229  ok(ret == EINVAL, "Expected EINVAL, got %d\n", ret);
1230  ok(errno == EINVAL, "expected errno to be EINVAL, got %d\n", errno);
1231  ok(buffer[0] == '\0', "expected empty string\n");
1232 
1233  /* Test normal string uppercasing. */
1234  wcscpy(buffer, mixedString);
1235  ret = p_wcslwr_s(buffer, ARRAY_SIZE(mixedString));
1236  ok(ret == 0, "expected 0, got %d\n", ret);
1237  ok(!wcscmp(buffer, expectedString), "expected lowercase\n");
1238 
1239  /* Test uppercasing with a shorter buffer size count. */
1240  wcscpy(buffer, mixedString);
1241  errno = EBADF;
1242  ret = p_wcslwr_s(buffer, ARRAY_SIZE(mixedString) - 1);
1243  ok(ret == EINVAL, "expected EINVAL, got %d\n", ret);
1244  ok(errno == EINVAL, "expected errno to be EINVAL, got %d\n", errno);
1245  ok(buffer[0] == '\0', "expected empty string\n");
1246 
1247  /* Test uppercasing with a longer buffer size count. */
1248  wcscpy(buffer, mixedString);
1249  ret = p_wcslwr_s(buffer, ARRAY_SIZE(buffer));
1250  ok(ret == 0, "expected 0, got %d\n", ret);
1251  ok(!wcscmp(buffer, expectedString), "expected lowercase\n");
1252 }
Definition: arc.h:39
GLuint buffer
Definition: glext.h:5915
int errno
Definition: arc.h:36
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define ARRAY_SIZE(a)
Definition: main.h:24
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__wcsset_s()

static void test__wcsset_s ( void  )
static

Definition at line 3201 of file string.c.

3202 {
3203  wchar_t str[10];
3204  int r;
3205 
3206  if(!p__wcsset_s) {
3207  win_skip("_wcsset_s not available\n");
3208  return;
3209  }
3210 
3211  r = p__wcsset_s(NULL, 0, 'a');
3212  ok(r == EINVAL, "r = %d\n", r);
3213 
3214  str[0] = 'a';
3215  r = p__wcsset_s(str, 0, 'a');
3216  ok(r == EINVAL, "r = %d\n", r);
3217  ok(str[0] == 'a', "str[0] = %d\n", str[0]);
3218 
3219  str[0] = 'a';
3220  str[1] = 'b';
3221  r = p__wcsset_s(str, 2, 'c');
3222  ok(r == EINVAL, "r = %d\n", r);
3223  ok(!str[0], "str[0] = %d\n", str[0]);
3224  ok(str[1] == 'b', "str[1] = %d\n", str[1]);
3225 
3226  str[0] = 'a';
3227  str[1] = 0;
3228  str[2] = 'b';
3229  r = p__wcsset_s(str, 3, 'c');
3230  ok(str[0] == 'c', "str[0] = %d\n", str[0]);
3231  ok(str[1] == 0, "str[1] = %d\n", str[1]);
3232  ok(str[2] == 'b', "str[2] = %d\n", str[2]);
3233 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
Definition: arc.h:39
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__wcstoi64()

static void test__wcstoi64 ( void  )
static

Definition at line 2940 of file string.c.

2941 {
2942  static const WCHAR digit[] = { '9', 0 };
2943  static const WCHAR space[] = { ' ', 0 };
2944  static const WCHAR stock[] = { 0x3231, 0 }; /* PARENTHESIZED IDEOGRAPH STOCK */
2945  static const WCHAR cjk_1[] = { 0x4e00, 0 }; /* CJK Ideograph, First */
2946  static const WCHAR tamil[] = { 0x0bef, 0 }; /* TAMIL DIGIT NINE */
2947  static const WCHAR thai[] = { 0x0e59, 0 }; /* THAI DIGIT NINE */
2948  static const WCHAR fullwidth[] = { 0xff19, 0 }; /* FULLWIDTH DIGIT NINE */
2949  static const WCHAR superscript1[] = { 0xb9, 0 }; /* SUPERSCRIPT ONE */
2950  static const WCHAR minus_0x91[] = { '-', 0x0e50, 'x', 0xff19, '1', 0 };
2951  static const WCHAR plus_071[] = { '+', 0x0e50, 0xff17, '1', 0 };
2952  static const WCHAR hex[] = { 0xff19, 'f', 0x0e59, 0xff46, 0 };
2953  static const WCHAR zeros[] = {
2954  0x660, 0x6f0, 0x966, 0x9e6, 0xa66, 0xae6, 0xb66, 0xc66, 0xce6,
2955  0xd66, 0xe50, 0xed0, 0xf20, 0x1040, 0x17e0, 0x1810, 0xff10
2956  };
2957  int i;
2958 
2959  __int64 res;
2960  unsigned __int64 ures;
2961  WCHAR *endpos;
2962 
2963  if (!p_wcstoi64 || !p_wcstoui64) {
2964  win_skip("_wcstoi64 or _wcstoui64 not found\n");
2965  return;
2966  }
2967 
2968  res = p_wcstoi64(digit, NULL, 10);
2969  ok(res == 9, "res != 9\n");
2970  res = p_wcstoi64(space, &endpos, 0);
2971  ok(endpos == space, "endpos != space\n");
2972  res = p_wcstoi64(stock, &endpos, 10);
2973  ok(res == 0, "res != 0\n");
2974  ok(endpos == stock, "Incorrect endpos (%p-%p)\n", stock, endpos);
2975  res = p_wcstoi64(cjk_1, NULL, 0);
2976  ok(res == 0, "res != 0\n");
2977  res = p_wcstoi64(tamil, &endpos, 10);
2978  ok(res == 0, "res != 0\n");
2979  ok(endpos == tamil, "Incorrect endpos (%p-%p)\n", tamil, endpos);
2980  res = p_wcstoi64(thai, NULL, 10);
2981  ok(res == 9, "res != 9\n");
2982  res = p_wcstoi64(fullwidth, NULL, 10);
2983  ok(res == 9, "res != 9\n");
2984  res = p_wcstoi64(superscript1, NULL, 10);
2985  ok(res == 0, "res != 0\n");
2986  res = p_wcstoi64(hex, NULL, 16);
2987  ok(res == 0x9f9, "res != 0x9f9\n");
2988  res = p_wcstoi64(minus_0x91, NULL, 0);
2989  ok(res == -0x91, "res != -0x91\n");
2990  res = p_wcstoi64(plus_071, NULL, 0);
2991  ok(res == 071, "res != 071\n");
2992 
2993  ures = p_wcstoui64(digit, NULL, 10);
2994  ok(ures == 9, "ures != 9\n");
2995  ures = p_wcstoui64(space, &endpos, 0);
2996  ok(endpos == space, "endpos != space\n");
2997  ures = p_wcstoui64(stock, &endpos, 10);
2998  ok(ures == 0, "ures != 0\n");
2999  ok(endpos == stock, "Incorrect endpos (%p-%p)\n", stock, endpos);
3000  ures = p_wcstoui64(tamil, &endpos, 10);
3001  ok(ures == 0, "ures != 0\n");
3002  ok(endpos == tamil, "Incorrect endpos (%p-%p)\n", tamil, endpos);
3003  ures = p_wcstoui64(thai, NULL, 10);
3004  ok(ures == 9, "ures != 9\n");
3005  ures = p_wcstoui64(fullwidth, NULL, 10);
3006  ok(ures == 9, "ures != 9\n");
3007  ures = p_wcstoui64(superscript1, NULL, 10);
3008  ok(ures == 0, "ures != 0\n");
3009  ures = p_wcstoui64(hex, NULL, 16);
3010  ok(ures == 0x9f9, "ures != 0x9f9\n");
3011  ures = p_wcstoui64(plus_071, NULL, 0);
3012  ok(ures == 071, "ures != 071\n");
3013 
3014  /* Test various unicode digits */
3015  for (i = 0; i < ARRAY_SIZE(zeros); ++i) {
3016  WCHAR tmp[] = {zeros[i] + 4, zeros[i], zeros[i] + 5, 0};
3017  res = p_wcstoi64(tmp, NULL, 0);
3018  ok(res == 405, "with zero = U+%04X: got %d, expected 405\n", zeros[i], (int)res);
3019  tmp[1] = zeros[i] + 10;
3020  res = p_wcstoi64(tmp, NULL, 16);
3021  ok(res == 4, "with zero = U+%04X: got %d, expected 4\n", zeros[i], (int)res);
3022  }
3023 
3024  return;
3025 }
static const char hex[16]
Definition: profile.c:123
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
static __int64(__cdecl *p_strtoi64)(const char *
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ARRAY_SIZE(a)
Definition: main.h:24
GLuint res
Definition: glext.h:9613
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test__wcsupr_s()

static void test__wcsupr_s ( void  )
static

Definition at line 1080 of file string.c.

1081 {
1082  static const WCHAR mixedString[] = {'M', 'i', 'X', 'e', 'D', 'l', 'o', 'w',
1083  'e', 'r', 'U', 'P', 'P', 'E', 'R', 0};
1084  static const WCHAR expectedString[] = {'M', 'I', 'X', 'E', 'D', 'L', 'O',
1085  'W', 'E', 'R', 'U', 'P', 'P', 'E',
1086  'R', 0};
1087  WCHAR testBuffer[2*ARRAY_SIZE(mixedString)];
1088  int ret;
1089 
1090  if (!p_wcsupr_s)
1091  {
1092  win_skip("_wcsupr_s not found\n");
1093  return;
1094  }
1095 
1096  /* Test NULL input string and invalid size. */
1097  errno = EBADF;
1098  ret = p_wcsupr_s(NULL, 0);
1099  ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret);
1100  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
1101 
1102  /* Test NULL input string and valid size. */
1103  errno = EBADF;
1104  ret = p_wcsupr_s(NULL, ARRAY_SIZE(testBuffer));
1105  ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret);
1106  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
1107 
1108  /* Test empty string with zero size. */
1109  errno = EBADF;
1110  testBuffer[0] = '\0';
1111  ret = p_wcsupr_s(testBuffer, 0);
1112  ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret);
1113  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
1114  ok(testBuffer[0] == '\0', "Expected the buffer to be unchanged\n");
1115 
1116  /* Test empty string with size of one. */
1117  testBuffer[0] = '\0';
1118  ret = p_wcsupr_s(testBuffer, 1);
1119  ok(ret == 0, "Expected _wcsupr_s to succeed, got %d\n", ret);
1120  ok(testBuffer[0] == '\0', "Expected the buffer to be unchanged\n");
1121 
1122  /* Test one-byte buffer with zero size. */
1123  errno = EBADF;
1124  testBuffer[0] = 'x';
1125  ret = p_wcsupr_s(testBuffer, 0);
1126  ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret);
1127  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
1128  ok(testBuffer[0] == '\0', "Expected the first buffer character to be null\n");
1129 
1130  /* Test one-byte buffer with size of one. */
1131  errno = EBADF;
1132  testBuffer[0] = 'x';
1133  ret = p_wcsupr_s(testBuffer, 1);
1134  ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret);
1135  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
1136  ok(testBuffer[0] == '\0', "Expected the first buffer character to be null\n");
1137 
1138  /* Test invalid size. */
1139  wcscpy(testBuffer, mixedString);
1140  errno = EBADF;
1141  ret = p_wcsupr_s(testBuffer, 0);
1142  ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret);
1143  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
1144  ok(testBuffer[0] == '\0', "Expected the first buffer character to be null\n");
1145 
1146  /* Test normal string uppercasing. */
1147  wcscpy(testBuffer, mixedString);
1148  ret = p_wcsupr_s(testBuffer, ARRAY_SIZE(mixedString));
1149  ok(ret == 0, "Expected _wcsupr_s to succeed, got %d\n", ret);
1150  ok(!wcscmp(testBuffer, expectedString), "Expected the string to be fully upper-case\n");
1151 
1152  /* Test uppercasing with a shorter buffer size count. */
1153  wcscpy(testBuffer, mixedString);
1154  errno = EBADF;
1155  ret = p_wcsupr_s(testBuffer, ARRAY_SIZE(mixedString) - 1);
1156  ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret);
1157  ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
1158  ok(testBuffer[0] == '\0', "Expected the first buffer character to be null\n");
1159 
1160  /* Test uppercasing with a longer buffer size count. */
1161  wcscpy(testBuffer, mixedString);
1162  ret = p_wcsupr_s(testBuffer, ARRAY_SIZE(testBuffer));
1163  ok(ret == 0, "Expected _wcsupr_s to succeed, got %d\n", ret);
1164  ok(!wcscmp(testBuffer, expectedString), "Expected the string to be fully upper-case\n");
1165 }
Definition: arc.h:39
int errno
Definition: arc.h:36
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define ARRAY_SIZE(a)
Definition: main.h:24
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_atof()

static void test_atof ( void  )
static

Definition at line 3044 of file string.c.

3045 {
3046  double d;
3047 
3048  d = atof("0.0");
3049  ok(almost_equal(d, 0.0), "d = %lf\n", d);
3050 
3051  d = atof("1.0");
3052  ok(almost_equal(d, 1.0), "d = %lf\n", d);
3053 
3054  d = atof("-1.0");
3055  ok(almost_equal(d, -1.0), "d = %lf\n", d);
3056 
3057  if (!p__atof_l)
3058  {
3059  win_skip("_atof_l not found\n");
3060  return;
3061  }
3062 
3063  errno = EBADF;
3064  d = atof(NULL);
3065  ok(almost_equal(d, 0.0), "d = %lf\n", d);
3066  ok(errno == EINVAL, "errno = %x\n", errno);
3067 
3068  errno = EBADF;
3069  d = p__atof_l(NULL, NULL);
3070  ok(almost_equal(d, 0.0), "d = %lf\n", d);
3071  ok(errno == EINVAL, "errno = %x\n", errno);
3072 }
Definition: arc.h:39
int errno
Definition: arc.h:36
_Check_return_ _CRTIMP double __cdecl atof(_In_z_ const char *str)
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define d
Definition: ke_i.h:81
static BOOL almost_equal(double d1, double d2)
Definition: string.c:1798
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_atoi()

static void test_atoi ( void  )
static

Definition at line 3027 of file string.c.

3028 {
3029  int r;
3030 
3031  r = atoi("0");
3032  ok(r == 0, "atoi(0) = %d\n", r);
3033 
3034  r = atoi("-1");
3035  ok(r == -1, "atoi(-1) = %d\n", r);
3036 
3037  r = atoi("1");
3038  ok(r == 1, "atoi(1) = %d\n", r);
3039 
3040  r = atoi("4294967296");
3041  ok(r == 0, "atoi(4294967296) = %d\n", r);
3042 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define ok(value,...)
Definition: CComObject.cpp:34
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)

Referenced by START_TEST().

◆ test_C_locale()

static void test_C_locale ( void  )
static

Definition at line 3612 of file string.c.

3613 {
3614  int i, j;
3615  wint_t ret, exp;
3616  _locale_t locale;
3617  static const char *locales[] = { NULL, "C" };
3618 
3619  /* C locale only converts case for [a-zA-Z] */
3620  setlocale(LC_ALL, "C");
3621  for (i = 0; i <= 0xffff; i++)
3622  {
3623  ret = p_towlower(i);
3624  if (i >= 'A' && i <= 'Z')
3625  {
3626  exp = i + 'a' - 'A';
3627  ok(ret == exp, "expected %x, got %x for C locale\n", exp, ret);
3628  }
3629  else
3630  todo_wine_if(ret != i)
3631  ok(ret == i, "expected self %x, got %x for C locale\n", i, ret);
3632 
3633  ret = p_towupper(i);
3634  if (i >= 'a' && i <= 'z')
3635  {
3636  exp = i + 'A' - 'a';
3637  ok(ret == exp, "expected %x, got %x for C locale\n", exp, ret);
3638  }
3639  else
3640  todo_wine_if(ret != i)
3641  ok(ret == i, "expected self %x, got %x for C locale\n", i, ret);
3642  }
3643 
3644  if (!p__towlower_l || !p__towupper_l || !p__create_locale)
3645  {
3646  win_skip("_towlower_l/_towupper_l/_create_locale not available\n");
3647  return;
3648  }
3649 
3650  for (i = 0; i < ARRAY_SIZE(locales); i++) {
3651  locale = locales[i] ? p__create_locale(LC_ALL, locales[i]) : NULL;
3652 
3653  for (j = 0; j <= 0xffff; j++) {
3654  ret = p__towlower_l(j, locale);
3655  if (j >= 'A' && j <= 'Z')
3656  {
3657  exp = j + 'a' - 'A';
3658  ok(ret == exp, "expected %x, got %x for C locale\n", exp, ret);
3659  }
3660  else
3661  todo_wine_if(ret != j)
3662  ok(ret == j, "expected self %x, got %x for C locale\n", j, ret);
3663 
3664  ret = p__towupper_l(j, locale);
3665  if (j >= 'a' && j <= 'z')
3666  {
3667  exp = j + 'A' - 'a';
3668  ok(ret == exp, "expected %x, got %x for C locale\n", exp, ret);
3669  }
3670  else
3671  todo_wine_if(ret != j)
3672  ok(ret == j, "expected self %x, got %x for C locale\n", j, ret);
3673  }
3674 
3675  p__free_locale(locale);
3676  }
3677 }
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
Definition: _locale.h:75
int wint_t
Definition: _apple.h:38
smooth NULL
Definition: ftsmooth.c:416
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
#define ok(value,...)
Definition: CComObject.cpp:34
#define todo_wine_if(is_todo)
Definition: test.h:155
#define LC_ALL
Definition: locale.h:25
int ret
static const wchar_t void * locale
Definition: printf.c:73
#define ARRAY_SIZE(a)
Definition: main.h:24
DWORD exp
Definition: msg.c:15681
#define setlocale(n, s)
Definition: locale.h:46
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_cp_table()

static void test_cp_table ( int  cp,
int result 
)
static

Definition at line 198 of file string.c.

199 {
200  int i;
201  int count = 0;
202  int curr = 0;
203  _setmbcp(cp);
204  for (i = 0; i < 256; i++)
205  {
206  if (count == 0)
207  {
208  curr = result[0];
209  count = result[1];
210  result += 2;
211  }
212  ok(p_mbctype[i] == curr, "CP%d: Mismatch in ctype for character %d - %d instead of %d\n", cp, i-1, p_mbctype[i], curr);
213  count--;
214  }
215 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
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
#define ok(value,...)
Definition: CComObject.cpp:34
int __cdecl _setmbcp(int)
Definition: _setmbcp.c:218
static unsigned char * p_mbctype
Definition: string.c:85
POINT cp
Definition: magnifier.c:60
GLuint64EXT * result
Definition: glext.h:11304

◆ test_gcvt()

static void test_gcvt ( void  )
static

Definition at line 2139 of file string.c.

2140 {
2141  char buf[1024], *res;
2142  errno_t err;
2143 
2144  if(!p_gcvt_s) {
2145  win_skip("Skipping _gcvt tests\n");
2146  return;
2147  }
2148 
2149  errno = 0;
2150  res = _gcvt(1.2, -1, buf);
2151  ok(res == NULL, "res != NULL\n");
2152  ok(errno == ERANGE, "errno = %d\n", errno);
2153 
2154  errno = 0;
2155  res = _gcvt(1.2, 5, NULL);
2156  ok(res == NULL, "res != NULL\n");
2157  ok(errno == EINVAL, "errno = %d\n", errno);
2158 
2159  res = gcvt(1.2, 5, buf);
2160  ok(res == buf, "res != buf\n");
2161  ok(!strcmp(buf, "1.2"), "buf = %s\n", buf);
2162 
2163  buf[0] = 'x';
2164  err = p_gcvt_s(buf, 5, 1.2, 10);
2165  ok(err == ERANGE, "err = %d\n", err);
2166  ok(buf[0] == '\0', "buf[0] = %c\n", buf[0]);
2167 
2168  buf[0] = 'x';
2169  err = p_gcvt_s(buf, 4, 123456, 2);
2170  ok(err == ERANGE, "err = %d\n", err);
2171  ok(buf[0] == '\0', "buf[0] = %c\n", buf[0]);
2172 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: arc.h:39
int errno
smooth NULL
Definition: ftsmooth.c:416
int errno_t
Definition: crtdefs.h:353
#define ok(value,...)
Definition: CComObject.cpp:34
#define ERANGE
Definition: acclib.h:92
#define err(...)
GLuint res
Definition: glext.h:9613
_CRTIMP char *__cdecl _gcvt(_In_ double _Val, _In_ int _NumOfDigits, _Pre_notnull_ _Post_z_ char *_DstBuf)
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
_CRTIMP char *__cdecl gcvt(_In_ double _Val, _In_ int _NumOfDigits, _Pre_notnull_ _Post_z_ char *_DstBuf)
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_ismbckata()

static void test_ismbckata ( void  )
static

Definition at line 1415 of file string.c.

1415  {
1416  struct katakana_pair {
1417  UINT c;
1418  BOOL exp;
1419  };
1420  static const struct katakana_pair tests[] = {
1421  {0x8152, FALSE}, {0x8153, FALSE}, {0x8154, FALSE}, {0x8155, FALSE},
1422  {0x82a0, FALSE}, {0x833f, FALSE}, {0x8340, TRUE }, {0x837e, TRUE },
1423  {0x837f, FALSE}, {0x8380, TRUE }, {0x8396, TRUE }, {0x8397, FALSE},
1424  {0xa5, FALSE}, {0xb0, FALSE}, {0xdd, FALSE}
1425  };
1426  unsigned int prev_cp = _getmbcp();
1427  int ret;
1428  unsigned int i;
1429 
1431  for (i = 0; i < ARRAY_SIZE(tests); i++) {
1432  ret = _ismbckata(tests[i].c);
1433  ok(!ret, "expected 0, got %d for %04x\n", ret, tests[i].c);
1434  }
1435 
1436  _setmbcp(932);
1437  for (i = 0; i < ARRAY_SIZE(tests); i++) {
1438  ret = _ismbckata(tests[i].c);
1439  ok(!!ret == tests[i].exp, "expected %d, got %d for %04x\n",
1440  tests[i].exp, !!ret, tests[i].c);
1441  }
1442 
1443  _setmbcp(prev_cp);
1444 }
struct param_test tests[]
#define TRUE
Definition: types.h:120
_CRTIMP int __cdecl _getmbcp(void)
Definition: locale.c:1472
#define _MB_CP_SBCS
Definition: msvcrt.h:828
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
Definition: CComObject.cpp:34
int __cdecl _setmbcp(int)
Definition: _setmbcp.c:218
const GLubyte * c
Definition: glext.h:8905
_Check_return_ _CRTIMP int __cdecl _ismbckata(_In_ unsigned int _Ch)
int ret
#define ARRAY_SIZE(a)
Definition: main.h:24
unsigned int UINT
Definition: ndis.h:50
DWORD exp
Definition: msg.c:15681
#define c
Definition: ke_i.h:80

Referenced by START_TEST().

◆ test_ismbclegal()

static void test_ismbclegal ( void  )
static

Definition at line 1446 of file string.c.

1446  {
1447  unsigned int prev_cp = _getmbcp();
1448  int ret, exp, err;
1449  unsigned int i;
1450 
1451  _setmbcp(932); /* Japanese */
1452  err = 0;
1453  for(i = 0; i < 0x10000; i++) {
1454  ret = _ismbclegal(i);
1455  exp = ((HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0x9F) ||
1456  (HIBYTE(i) >= 0xE0 && HIBYTE(i) <= 0xFC)) &&
1457  ((LOBYTE(i) >= 0x40 && LOBYTE(i) <= 0x7E) ||
1458  (LOBYTE(i) >= 0x80 && LOBYTE(i) <= 0xFC));
1459  if(ret != exp) {
1460  err = 1;
1461  break;
1462  }
1463  }
1464  ok(!err, "_ismbclegal (932) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i);
1465  _setmbcp(936); /* Chinese (GBK) */
1466  err = 0;
1467  for(i = 0; i < 0x10000; i++) {
1468  ret = _ismbclegal(i);
1469  exp = HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0xFE &&
1470  LOBYTE(i) >= 0x40 && LOBYTE(i) <= 0xFE;
1471  if(ret != exp) {
1472  err = 1;
1473  break;
1474  }
1475  }
1476  ok(!err, "_ismbclegal (936) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i);
1477  _setmbcp(949); /* Korean */
1478  err = 0;
1479  for(i = 0; i < 0x10000; i++) {
1480  ret = _ismbclegal(i);
1481  exp = HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0xFE &&
1482  LOBYTE(i) >= 0x41 && LOBYTE(i) <= 0xFE;
1483  if(ret != exp) {
1484  err = 1;
1485  break;
1486  }
1487  }
1488  ok(!err, "_ismbclegal (949) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i);
1489  _setmbcp(950); /* Chinese (Big5) */
1490  err = 0;
1491  for(i = 0; i < 0x10000; i++) {
1492  ret = _ismbclegal(i);
1493  exp = HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0xFE &&
1494  ((LOBYTE(i) >= 0x40 && LOBYTE(i) <= 0x7E) ||
1495  (LOBYTE(i) >= 0xA1 && LOBYTE(i) <= 0xFE));
1496  if(ret != exp) {
1497  err = 1;
1498  break;
1499  }
1500  }
1501  ok(!err, "_ismbclegal (950) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i);
1502  _setmbcp(1361); /* Korean (Johab) */
1503  err = 0;
1504  for(i = 0; i < 0x10000; i++) {
1505  ret = _ismbclegal(i);
1506  exp = ((HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0xD3) ||
1507  (HIBYTE(i) >= 0xD8 && HIBYTE(i) <= 0xF9)) &&
1508  ((LOBYTE(i) >= 0x31 && LOBYTE(i) <= 0x7E) ||
1509  (LOBYTE(i) >= 0x81 && LOBYTE(i) <= 0xFE)) &&
1510  HIBYTE(i) != 0xDF;
1511  if(ret != exp) {
1512  err = 1;
1513  break;
1514  }
1515  }
1516  todo_wine ok(!err, "_ismbclegal (1361) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i);
1517 
1518  _setmbcp(prev_cp);
1519 }
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
_CRTIMP int __cdecl _getmbcp(void)
Definition: locale.c:1472
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
#define ok(value,...)
Definition: CComObject.cpp:34
_Check_return_ _CRTIMP int __cdecl _ismbclegal(_In_ unsigned int _Ch)
int __cdecl _setmbcp(int)
Definition: _setmbcp.c:218
int ret
#define todo_wine
Definition: test.h:154
#define err(...)
DWORD exp
Definition: msg.c:15681

Referenced by START_TEST().

◆ test_mbbtombc()

static void test_mbbtombc ( void  )
static

Definition at line 1367 of file string.c.

1368 {
1369  static const unsigned int mbbmbc[][2] = {
1370  {0x1f, 0x1f}, {0x20, 0x8140}, {0x39, 0x8258}, {0x40, 0x8197},
1371  {0x41, 0x8260}, {0x5e, 0x814f}, {0x7e, 0x8150}, {0x7f, 0x7f},
1372  {0x80, 0x80}, {0x81, 0x81}, {0xa0, 0xa0}, {0xa7, 0x8340},
1373  {0xb0, 0x815b}, {0xd1, 0x8380}, {0xff, 0xff}, {0,0}};
1374  int cp[] = { 932, 936, 939, 950, 1361, _MB_CP_SBCS };
1375  int i, j;
1376  int prev_cp = _getmbcp();
1377 
1378  for (i = 0; i < ARRAY_SIZE(cp); i++)
1379  {
1380  _setmbcp(cp[i]);
1381  for (j = 0; mbbmbc[j][0] != 0; j++)
1382  {
1383  unsigned int exp, ret;
1384  ret = _mbbtombc(mbbmbc[j][0]);
1385  exp = (cp[i] == 932) ? mbbmbc[j][1] : mbbmbc[j][0];
1386  ok(ret == exp, "Expected 0x%x, got 0x%x (0x%x, codepage %d)\n",
1387  exp, ret, mbbmbc[j][0], cp[i]);
1388  }
1389  }
1390  _setmbcp(prev_cp);
1391 }
_Check_return_ _CRTIMP unsigned int __cdecl _mbbtombc(_In_ unsigned int _Ch)
_CRTIMP int __cdecl _getmbcp(void)
Definition: locale.c:1472
#define _MB_CP_SBCS
Definition: msvcrt.h:828
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
#define ok(value,...)
Definition: CComObject.cpp:34
int __cdecl _setmbcp(int)
Definition: _setmbcp.c:218
int ret
#define ARRAY_SIZE(a)
Definition: main.h:24
DWORD exp
Definition: msg.c:15681
POINT cp
Definition: magnifier.c:60

Referenced by START_TEST().

◆ test_mbcjisjms()

static void test_mbcjisjms ( void  )
static

Definition at line 1254 of file string.c.

1255 {
1256  /* List of value-pairs to test. The test assumes the last pair to be {0, ..} */
1257  unsigned int jisjms[][2] = { {0x2020, 0}, {0x2021, 0}, {0x2120, 0}, {0x2121, 0x8140},
1258  {0x7f7f, 0}, {0x7f7e, 0}, {0x7e7f, 0}, {0x7e7e, 0xeffc},
1259  {0x255f, 0x837e}, {0x2560, 0x8380}, {0x2561, 0x8381},
1260  {0x2121FFFF, 0}, {0x2223, 0x81a1}, {0x237e, 0x829e}, {0, 0}};
1261  int cp[] = { 932, 936, 939, 950, 1361, _MB_CP_SBCS };
1262  unsigned int i, j;
1263  int prev_cp = _getmbcp();
1264 
1265  for (i = 0; i <