ntdll/tests: Remove some workarounds for older Windows versions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
bf48e86add
commit
a1659db87f
|
@ -34,86 +34,79 @@ static VOID (WINAPI *pRtlFreeAnsiString)(PSTRING);
|
|||
static BOOLEAN (WINAPI *pRtlCreateUnicodeStringFromAsciiz)(PUNICODE_STRING,LPCSTR);
|
||||
static VOID (WINAPI *pRtlFreeUnicodeString)(PUNICODE_STRING);
|
||||
|
||||
static int (WINAPIV *patoi)(const char *);
|
||||
static long (WINAPIV *patol)(const char *);
|
||||
static LONGLONG (WINAPIV *p_atoi64)(const char *);
|
||||
static LPSTR (WINAPIV *p_itoa)(int, LPSTR, INT);
|
||||
static LPSTR (WINAPIV *p_ltoa)(LONG, LPSTR, INT);
|
||||
static LPSTR (WINAPIV *p_ultoa)(ULONG, LPSTR, INT);
|
||||
static LPSTR (WINAPIV *p_i64toa)(LONGLONG, LPSTR, INT);
|
||||
static LPSTR (WINAPIV *p_ui64toa)(ULONGLONG, LPSTR, INT);
|
||||
static int (__cdecl *patoi)(const char *);
|
||||
static LONG (__cdecl *patol)(const char *);
|
||||
static LONGLONG (__cdecl *p_atoi64)(const char *);
|
||||
static LPSTR (__cdecl *p_itoa)(int, LPSTR, INT);
|
||||
static LPSTR (__cdecl *p_ltoa)(LONG, LPSTR, INT);
|
||||
static LPSTR (__cdecl *p_ultoa)(ULONG, LPSTR, INT);
|
||||
static LPSTR (__cdecl *p_i64toa)(LONGLONG, LPSTR, INT);
|
||||
static LPSTR (__cdecl *p_ui64toa)(ULONGLONG, LPSTR, INT);
|
||||
|
||||
static int (WINAPIV *p_wtoi)(LPWSTR);
|
||||
static long (WINAPIV *p_wtol)(LPWSTR);
|
||||
static LONGLONG (WINAPIV *p_wtoi64)(LPWSTR);
|
||||
static LPWSTR (WINAPIV *p_itow)(int, LPWSTR, int);
|
||||
static LPWSTR (WINAPIV *p_ltow)(LONG, LPWSTR, INT);
|
||||
static LPWSTR (WINAPIV *p_ultow)(ULONG, LPWSTR, INT);
|
||||
static LPWSTR (WINAPIV *p_i64tow)(LONGLONG, LPWSTR, INT);
|
||||
static LPWSTR (WINAPIV *p_ui64tow)(ULONGLONG, LPWSTR, INT);
|
||||
static int (__cdecl *p_wtoi)(LPCWSTR);
|
||||
static LONG (__cdecl *p_wtol)(LPCWSTR);
|
||||
static LONGLONG (__cdecl *p_wtoi64)(LPCWSTR);
|
||||
static LPWSTR (__cdecl *p_itow)(int, LPWSTR, int);
|
||||
static LPWSTR (__cdecl *p_ltow)(LONG, LPWSTR, INT);
|
||||
static LPWSTR (__cdecl *p_ultow)(ULONG, LPWSTR, INT);
|
||||
static LPWSTR (__cdecl *p_i64tow)(LONGLONG, LPWSTR, INT);
|
||||
static LPWSTR (__cdecl *p_ui64tow)(ULONGLONG, LPWSTR, INT);
|
||||
|
||||
static LPWSTR (__cdecl *p_wcslwr)(LPWSTR);
|
||||
static LPWSTR (__cdecl *p_wcsupr)(LPWSTR);
|
||||
|
||||
static LPWSTR (WINAPIV *p_wcschr)(LPCWSTR, WCHAR);
|
||||
static LPWSTR (WINAPIV *p_wcsrchr)(LPCWSTR, WCHAR);
|
||||
static LPWSTR (__cdecl *pwcschr)(LPCWSTR, WCHAR);
|
||||
static LPWSTR (__cdecl *pwcsrchr)(LPCWSTR, WCHAR);
|
||||
|
||||
static void (__cdecl *p_qsort)(void *,size_t,size_t, int(__cdecl *compar)(const void *, const void *) );
|
||||
static void* (__cdecl *p_bsearch)(void *,void*,size_t,size_t, int(__cdecl *compar)(const void *, const void *) );
|
||||
static int (WINAPIV *p__snprintf)(char *, size_t, const char *, ...);
|
||||
static int (WINAPIV *p__snprintf_s)(char *, size_t, size_t, const char *, ...);
|
||||
static void (__cdecl *pqsort)(void *,size_t,size_t, int(__cdecl *compar)(const void *, const void *) );
|
||||
static void* (__cdecl *pbsearch)(void *,void*,size_t,size_t, int(__cdecl *compar)(const void *, const void *) );
|
||||
static int (WINAPIV *p_snprintf)(char *, size_t, const char *, ...);
|
||||
static int (WINAPIV *p_snprintf_s)(char *, size_t, size_t, const char *, ...);
|
||||
|
||||
static int (__cdecl *p_tolower)(int);
|
||||
static int (__cdecl *p_toupper)(int);
|
||||
static int (__cdecl *p__strnicmp)(LPCSTR,LPCSTR,size_t);
|
||||
static int (__cdecl *ptolower)(int);
|
||||
static int (__cdecl *ptoupper)(int);
|
||||
static int (__cdecl *p_strnicmp)(LPCSTR,LPCSTR,size_t);
|
||||
|
||||
static int (WINAPIV *p_sscanf)(const char *, const char *, ...);
|
||||
static int (WINAPIV *psscanf)(const char *, const char *, ...);
|
||||
|
||||
static void InitFunctionPtrs(void)
|
||||
{
|
||||
hntdll = LoadLibraryA("ntdll.dll");
|
||||
ok(hntdll != 0, "LoadLibrary failed\n");
|
||||
if (hntdll) {
|
||||
pRtlUnicodeStringToAnsiString = (void *)GetProcAddress(hntdll, "RtlUnicodeStringToAnsiString");
|
||||
pRtlFreeAnsiString = (void *)GetProcAddress(hntdll, "RtlFreeAnsiString");
|
||||
pRtlCreateUnicodeStringFromAsciiz = (void *)GetProcAddress(hntdll, "RtlCreateUnicodeStringFromAsciiz");
|
||||
pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString");
|
||||
|
||||
patoi = (void *)GetProcAddress(hntdll, "atoi");
|
||||
patol = (void *)GetProcAddress(hntdll, "atol");
|
||||
p_atoi64 = (void *)GetProcAddress(hntdll, "_atoi64");
|
||||
p_itoa = (void *)GetProcAddress(hntdll, "_itoa");
|
||||
p_ltoa = (void *)GetProcAddress(hntdll, "_ltoa");
|
||||
p_ultoa = (void *)GetProcAddress(hntdll, "_ultoa");
|
||||
p_i64toa = (void *)GetProcAddress(hntdll, "_i64toa");
|
||||
p_ui64toa = (void *)GetProcAddress(hntdll, "_ui64toa");
|
||||
|
||||
p_wtoi = (void *)GetProcAddress(hntdll, "_wtoi");
|
||||
p_wtol = (void *)GetProcAddress(hntdll, "_wtol");
|
||||
p_wtoi64 = (void *)GetProcAddress(hntdll, "_wtoi64");
|
||||
p_itow = (void *)GetProcAddress(hntdll, "_itow");
|
||||
p_ltow = (void *)GetProcAddress(hntdll, "_ltow");
|
||||
p_ultow = (void *)GetProcAddress(hntdll, "_ultow");
|
||||
p_i64tow = (void *)GetProcAddress(hntdll, "_i64tow");
|
||||
p_ui64tow = (void *)GetProcAddress(hntdll, "_ui64tow");
|
||||
|
||||
p_wcslwr = (void *)GetProcAddress(hntdll, "_wcslwr");
|
||||
p_wcsupr = (void *)GetProcAddress(hntdll, "_wcsupr");
|
||||
|
||||
p_wcschr= (void *)GetProcAddress(hntdll, "wcschr");
|
||||
p_wcsrchr= (void *)GetProcAddress(hntdll, "wcsrchr");
|
||||
p_qsort= (void *)GetProcAddress(hntdll, "qsort");
|
||||
p_bsearch= (void *)GetProcAddress(hntdll, "bsearch");
|
||||
|
||||
p__snprintf = (void *)GetProcAddress(hntdll, "_snprintf");
|
||||
p__snprintf_s = (void *)GetProcAddress(hntdll, "_snprintf_s");
|
||||
|
||||
p_tolower = (void *)GetProcAddress(hntdll, "tolower");
|
||||
p_toupper = (void *)GetProcAddress(hntdll, "toupper");
|
||||
p__strnicmp = (void *)GetProcAddress(hntdll, "_strnicmp");
|
||||
|
||||
p_sscanf = (void *)GetProcAddress(hntdll, "sscanf");
|
||||
} /* if */
|
||||
#define X(name) p##name = (void *)GetProcAddress( hntdll, #name );
|
||||
X(RtlUnicodeStringToAnsiString);
|
||||
X(RtlFreeAnsiString);
|
||||
X(RtlCreateUnicodeStringFromAsciiz);
|
||||
X(RtlFreeUnicodeString);
|
||||
X(atoi);
|
||||
X(atol);
|
||||
X(_atoi64);
|
||||
X(_itoa);
|
||||
X(_ltoa);
|
||||
X(_ultoa);
|
||||
X(_i64toa);
|
||||
X(_ui64toa);
|
||||
X(_wtoi);
|
||||
X(_wtol);
|
||||
X(_wtoi64);
|
||||
X(_itow);
|
||||
X(_ltow);
|
||||
X(_ultow);
|
||||
X(_i64tow);
|
||||
X(_ui64tow);
|
||||
X(_wcslwr);
|
||||
X(_wcsupr);
|
||||
X(wcschr);
|
||||
X(wcsrchr);
|
||||
X(qsort);
|
||||
X(bsearch);
|
||||
X(_snprintf);
|
||||
X(_snprintf_s);
|
||||
X(tolower);
|
||||
X(toupper);
|
||||
X(_strnicmp);
|
||||
X(sscanf);
|
||||
#undef X
|
||||
}
|
||||
|
||||
|
||||
|
@ -1133,11 +1126,11 @@ static void test_wcschr(void)
|
|||
{
|
||||
static const WCHAR teststringW[] = {'a','b','r','a','c','a','d','a','b','r','a',0};
|
||||
|
||||
ok(p_wcschr(teststringW, 'a') == teststringW + 0,
|
||||
ok(pwcschr(teststringW, 'a') == teststringW + 0,
|
||||
"wcschr should have returned a pointer to the first 'a' character\n");
|
||||
ok(p_wcschr(teststringW, 0) == teststringW + 11,
|
||||
ok(pwcschr(teststringW, 0) == teststringW + 11,
|
||||
"wcschr should have returned a pointer to the null terminator\n");
|
||||
ok(p_wcschr(teststringW, 'x') == NULL,
|
||||
ok(pwcschr(teststringW, 'x') == NULL,
|
||||
"wcschr should have returned NULL\n");
|
||||
}
|
||||
|
||||
|
@ -1145,11 +1138,11 @@ static void test_wcsrchr(void)
|
|||
{
|
||||
static const WCHAR teststringW[] = {'a','b','r','a','c','a','d','a','b','r','a',0};
|
||||
|
||||
ok(p_wcsrchr(teststringW, 'a') == teststringW + 10,
|
||||
ok(pwcsrchr(teststringW, 'a') == teststringW + 10,
|
||||
"wcsrchr should have returned a pointer to the last 'a' character\n");
|
||||
ok(p_wcsrchr(teststringW, 0) == teststringW + 11,
|
||||
ok(pwcsrchr(teststringW, 0) == teststringW + 11,
|
||||
"wcsrchr should have returned a pointer to the null terminator\n");
|
||||
ok(p_wcsrchr(teststringW, 'x') == NULL,
|
||||
ok(pwcsrchr(teststringW, 'x') == NULL,
|
||||
"wcsrchr should have returned NULL\n");
|
||||
}
|
||||
|
||||
|
@ -1236,42 +1229,42 @@ static void test_qsort(void)
|
|||
"WINE"
|
||||
};
|
||||
|
||||
p_qsort ((void*)arr, 0, sizeof(int), intcomparefunc);
|
||||
pqsort ((void*)arr, 0, sizeof(int), intcomparefunc);
|
||||
ok(arr[0] == 23, "badly sorted, nmemb=0, arr[0] is %d\n", arr[0]);
|
||||
ok(arr[1] == 42, "badly sorted, nmemb=0, arr[1] is %d\n", arr[1]);
|
||||
ok(arr[2] == 8, "badly sorted, nmemb=0, arr[2] is %d\n", arr[2]);
|
||||
ok(arr[3] == 4, "badly sorted, nmemb=0, arr[3] is %d\n", arr[3]);
|
||||
ok(arr[4] == 16, "badly sorted, nmemb=0, arr[4] is %d\n", arr[4]);
|
||||
|
||||
p_qsort ((void*)arr, 1, sizeof(int), intcomparefunc);
|
||||
pqsort ((void*)arr, 1, sizeof(int), intcomparefunc);
|
||||
ok(arr[0] == 23, "badly sorted, nmemb=1, arr[0] is %d\n", arr[0]);
|
||||
ok(arr[1] == 42, "badly sorted, nmemb=1, arr[1] is %d\n", arr[1]);
|
||||
ok(arr[2] == 8, "badly sorted, nmemb=1, arr[2] is %d\n", arr[2]);
|
||||
ok(arr[3] == 4, "badly sorted, nmemb=1, arr[3] is %d\n", arr[3]);
|
||||
ok(arr[4] == 16, "badly sorted, nmemb=1, arr[4] is %d\n", arr[4]);
|
||||
|
||||
p_qsort ((void*)arr, 5, 0, intcomparefunc);
|
||||
pqsort ((void*)arr, 5, 0, intcomparefunc);
|
||||
ok(arr[0] == 23, "badly sorted, size=0, arr[0] is %d\n", arr[0]);
|
||||
ok(arr[1] == 42, "badly sorted, size=0, arr[1] is %d\n", arr[1]);
|
||||
ok(arr[2] == 8, "badly sorted, size=0, arr[2] is %d\n", arr[2]);
|
||||
ok(arr[3] == 4, "badly sorted, size=0, arr[3] is %d\n", arr[3]);
|
||||
ok(arr[4] == 16, "badly sorted, size=0, arr[4] is %d\n", arr[4]);
|
||||
|
||||
p_qsort ((void*)arr, 5, sizeof(int), intcomparefunc);
|
||||
pqsort ((void*)arr, 5, sizeof(int), intcomparefunc);
|
||||
ok(arr[0] == 4, "badly sorted, arr[0] is %d\n", arr[0]);
|
||||
ok(arr[1] == 8, "badly sorted, arr[1] is %d\n", arr[1]);
|
||||
ok(arr[2] == 16, "badly sorted, arr[2] is %d\n", arr[2]);
|
||||
ok(arr[3] == 23, "badly sorted, arr[3] is %d\n", arr[3]);
|
||||
ok(arr[4] == 42, "badly sorted, arr[4] is %d\n", arr[4]);
|
||||
|
||||
p_qsort ((void*)carr, 5, sizeof(char), charcomparefunc);
|
||||
pqsort ((void*)carr, 5, sizeof(char), charcomparefunc);
|
||||
ok(carr[0] == 4, "badly sorted, carr[0] is %d\n", carr[0]);
|
||||
ok(carr[1] == 8, "badly sorted, carr[1] is %d\n", carr[1]);
|
||||
ok(carr[2] == 16, "badly sorted, carr[2] is %d\n", carr[2]);
|
||||
ok(carr[3] == 23, "badly sorted, carr[3] is %d\n", carr[3]);
|
||||
ok(carr[4] == 42, "badly sorted, carr[4] is %d\n", carr[4]);
|
||||
|
||||
p_qsort ((void*)strarr, 7, sizeof(char*), strcomparefunc);
|
||||
pqsort ((void*)strarr, 7, sizeof(char*), strcomparefunc);
|
||||
ok(!strcmp(strarr[0],"!"), "badly sorted, strarr[0] is %s\n", strarr[0]);
|
||||
ok(!strcmp(strarr[1],"."), "badly sorted, strarr[1] is %s\n", strarr[1]);
|
||||
ok(!strcmp(strarr[2],"Hello"), "badly sorted, strarr[2] is %s\n", strarr[2]);
|
||||
|
@ -1280,7 +1273,7 @@ static void test_qsort(void)
|
|||
ok(!strcmp(strarr[5],"Wine"), "badly sorted, strarr[5] is %s\n", strarr[5]);
|
||||
ok(!strcmp(strarr[6],"World"), "badly sorted, strarr[6] is %s\n", strarr[6]);
|
||||
|
||||
p_qsort ((void*)strarr2, 7, sizeof(char*), istrcomparefunc);
|
||||
pqsort ((void*)strarr2, 7, sizeof(char*), istrcomparefunc);
|
||||
ok(!strcmp(strarr2[0], "!"), "badly sorted, strar2r[0] is %s\n", strarr2[0]);
|
||||
ok(!strcmp(strarr2[1], "Hello"), "badly sorted, strarr2[1] is %s\n", strarr2[1]);
|
||||
ok(!strcmp(strarr2[2], "Sorted"), "badly sorted, strarr2[2] is %s\n", strarr2[2]);
|
||||
|
@ -1301,11 +1294,11 @@ static void test_bsearch(void)
|
|||
for (j=1;j<ARRAY_SIZE(arr);j++) {
|
||||
for (i=0;i<j;i++) {
|
||||
l = arr[i];
|
||||
x = p_bsearch (&l, arr, j, sizeof(arr[0]), intcomparefunc);
|
||||
x = pbsearch (&l, arr, j, sizeof(arr[0]), intcomparefunc);
|
||||
ok (x == &arr[i], "bsearch did not find %d entry in loopsize %d.\n", i, j);
|
||||
}
|
||||
l = 4242;
|
||||
x = p_bsearch (&l, arr, j, sizeof(arr[0]), intcomparefunc);
|
||||
x = pbsearch (&l, arr, j, sizeof(arr[0]), intcomparefunc);
|
||||
ok (x == NULL, "bsearch did find 4242 entry in loopsize %d.\n", j);
|
||||
}
|
||||
}
|
||||
|
@ -1317,56 +1310,56 @@ static void test__snprintf(void)
|
|||
char buffer[32];
|
||||
int res;
|
||||
|
||||
res = p__snprintf(NULL, 0, teststring);
|
||||
res = p_snprintf(NULL, 0, teststring);
|
||||
ok(res == lstrlenA(teststring) || broken(res == -1) /* <= w2k */,
|
||||
"_snprintf returned %d, expected %d.\n", res, lstrlenA(teststring));
|
||||
|
||||
if (res != -1)
|
||||
{
|
||||
res = p__snprintf(NULL, 1, teststring);
|
||||
res = p_snprintf(NULL, 1, teststring);
|
||||
ok(res == lstrlenA(teststring) /* WinXP */ || res < 0 /* Vista and greater */,
|
||||
"_snprintf returned %d, expected %d or < 0.\n", res, lstrlenA(teststring));
|
||||
}
|
||||
res = p__snprintf(buffer, strlen(teststring) - 1, teststring);
|
||||
res = p_snprintf(buffer, strlen(teststring) - 1, teststring);
|
||||
ok(res < 0, "_snprintf returned %d, expected < 0.\n", res);
|
||||
|
||||
strcpy(buffer, origstring);
|
||||
res = p__snprintf(buffer, strlen(teststring), teststring);
|
||||
res = p_snprintf(buffer, strlen(teststring), teststring);
|
||||
ok(res == lstrlenA(teststring), "_snprintf returned %d, expected %d.\n", res, lstrlenA(teststring));
|
||||
ok(!strcmp(buffer, "hello worldX"), "_snprintf returned buffer '%s', expected 'hello worldX'.\n", buffer);
|
||||
|
||||
strcpy(buffer, origstring);
|
||||
res = p__snprintf(buffer, strlen(teststring) + 1, teststring);
|
||||
res = p_snprintf(buffer, strlen(teststring) + 1, teststring);
|
||||
ok(res == lstrlenA(teststring), "_snprintf returned %d, expected %d.\n", res, lstrlenA(teststring));
|
||||
ok(!strcmp(buffer, teststring), "_snprintf returned buffer '%s', expected '%s'.\n", buffer, teststring);
|
||||
|
||||
memset(buffer, 0x7c, sizeof(buffer));
|
||||
res = p__snprintf(buffer, 4, "test");
|
||||
res = p_snprintf(buffer, 4, "test");
|
||||
ok(res == 4, "res = %d\n", res);
|
||||
ok(!memcmp(buffer, "test", 4), "buf = %s\n", buffer);
|
||||
ok(buffer[4] == 0x7c, "buffer[4] = %x\n", buffer[4]);
|
||||
|
||||
memset(buffer, 0x7c, sizeof(buffer));
|
||||
res = p__snprintf(buffer, 3, "test");
|
||||
res = p_snprintf(buffer, 3, "test");
|
||||
ok(res == -1, "res = %d\n", res);
|
||||
|
||||
res = p__snprintf(buffer, sizeof(buffer), "%I64x %d", (ULONGLONG)0x1234567890, 1);
|
||||
res = p_snprintf(buffer, sizeof(buffer), "%I64x %d", (ULONGLONG)0x1234567890, 1);
|
||||
ok(res == strlen(buffer), "wrong size %d\n", res);
|
||||
ok(!strcmp(buffer, "1234567890 1"), "got %s\n", debugstr_a(buffer));
|
||||
|
||||
res = p__snprintf(buffer, sizeof(buffer), "%I32x %d", 0x123456, 1);
|
||||
res = p_snprintf(buffer, sizeof(buffer), "%I32x %d", 0x123456, 1);
|
||||
ok(res == strlen(buffer), "wrong size %d\n", res);
|
||||
ok(!strcmp(buffer, "123456 1"), "got %s\n", debugstr_a(buffer));
|
||||
|
||||
if (sizeof(void *) == 8)
|
||||
{
|
||||
res = p__snprintf(buffer, sizeof(buffer), "%Ix %d", (ULONG_PTR)0x1234567890, 1);
|
||||
res = p_snprintf(buffer, sizeof(buffer), "%Ix %d", (ULONG_PTR)0x1234567890, 1);
|
||||
ok(res == strlen(buffer), "wrong size %d\n", res);
|
||||
ok(!strcmp(buffer, "1234567890 1"), "got %s\n", debugstr_a(buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = p__snprintf(buffer, sizeof(buffer), "%Ix %d", (ULONG_PTR)0x123456, 1);
|
||||
res = p_snprintf(buffer, sizeof(buffer), "%Ix %d", (ULONG_PTR)0x123456, 1);
|
||||
ok(res == strlen(buffer), "wrong size %d\n", res);
|
||||
ok(!strcmp(buffer, "123456 1"), "got %s\n", debugstr_a(buffer));
|
||||
}
|
||||
|
@ -1377,33 +1370,39 @@ static void test__snprintf_s(void)
|
|||
char buf[32];
|
||||
int res;
|
||||
|
||||
if (!p_snprintf_s)
|
||||
{
|
||||
win_skip("_snprintf_s not available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
memset(buf, 0xcc, sizeof(buf));
|
||||
res = p__snprintf_s(buf, sizeof(buf), sizeof(buf), "test");
|
||||
res = p_snprintf_s(buf, sizeof(buf), sizeof(buf), "test");
|
||||
ok(res == 4, "res = %d\n", res);
|
||||
ok(!strcmp(buf, "test"), "buf = %s\n", buf);
|
||||
|
||||
memset(buf, 0xcc, sizeof(buf));
|
||||
res = p__snprintf_s(buf, 4, 4, "test");
|
||||
res = p_snprintf_s(buf, 4, 4, "test");
|
||||
ok(res == -1, "res = %d\n", res);
|
||||
ok(!buf[0], "buf = %s\n", buf);
|
||||
|
||||
memset(buf, 0xcc, sizeof(buf));
|
||||
res = p__snprintf_s(buf, 5, 4, "test");
|
||||
res = p_snprintf_s(buf, 5, 4, "test");
|
||||
ok(res == 4, "res = %d\n", res);
|
||||
ok(!strcmp(buf, "test"), "buf = %s\n", buf);
|
||||
|
||||
memset(buf, 0xcc, sizeof(buf));
|
||||
res = p__snprintf_s(buf, 5, 3, "test");
|
||||
res = p_snprintf_s(buf, 5, 3, "test");
|
||||
ok(res == -1, "res = %d\n", res);
|
||||
ok(!strcmp(buf, "tes"), "buf = %s\n", buf);
|
||||
|
||||
memset(buf, 0xcc, sizeof(buf));
|
||||
res = p__snprintf_s(buf, 4, 10, "test");
|
||||
res = p_snprintf_s(buf, 4, 10, "test");
|
||||
ok(res == -1, "res = %d\n", res);
|
||||
ok(!buf[0], "buf = %s\n", buf);
|
||||
|
||||
memset(buf, 0xcc, sizeof(buf));
|
||||
res = p__snprintf_s(buf, 6, 5, "test%c", 0);
|
||||
res = p_snprintf_s(buf, 6, 5, "test%c", 0);
|
||||
ok(res == 5, "res = %d\n", res);
|
||||
ok(!memcmp(buf, "test\0", 6), "buf = %s\n", buf);
|
||||
|
||||
|
@ -1419,12 +1418,12 @@ static void test_tolower(void)
|
|||
return;
|
||||
}
|
||||
|
||||
ok(p_tolower != NULL, "tolower is not available\n");
|
||||
ok(ptolower != NULL, "tolower is not available\n");
|
||||
|
||||
for (i = -512; i < 512; i++)
|
||||
{
|
||||
exp_ret = (char)i >= 'A' && (char)i <= 'Z' ? i - 'A' + 'a' : i;
|
||||
ret = p_tolower(i);
|
||||
ret = ptolower(i);
|
||||
ok(ret == exp_ret, "tolower(%d) = %d\n", i, ret);
|
||||
}
|
||||
}
|
||||
|
@ -1436,7 +1435,7 @@ static void test_toupper(void)
|
|||
char str[2], *p;
|
||||
WCHAR wc;
|
||||
|
||||
ok(p_toupper != NULL, "toupper is not available\n");
|
||||
ok(ptoupper != NULL, "toupper is not available\n");
|
||||
|
||||
for (i = -512; i < 0xffff; i++)
|
||||
{
|
||||
|
@ -1452,7 +1451,7 @@ static void test_toupper(void)
|
|||
else
|
||||
exp_ret = (unsigned char)str[0];
|
||||
|
||||
ret = p_toupper(i);
|
||||
ret = ptoupper(i);
|
||||
ok(ret == exp_ret, "toupper(%x) = %x, expected %x\n", i, ret, exp_ret);
|
||||
}
|
||||
}
|
||||
|
@ -1462,21 +1461,21 @@ static void test__strnicmp(void)
|
|||
BOOL is_win64 = (sizeof(void *) > sizeof(int));
|
||||
int ret;
|
||||
|
||||
ok(p__strnicmp != NULL, "_strnicmp is not available\n");
|
||||
ok(p_strnicmp != NULL, "_strnicmp is not available\n");
|
||||
|
||||
ret = p__strnicmp("a", "C", 1);
|
||||
ret = p_strnicmp("a", "C", 1);
|
||||
ok(ret == (is_win64 ? -2 : -1), "_strnicmp returned %d\n", ret);
|
||||
ret = p__strnicmp("a", "c", 1);
|
||||
ret = p_strnicmp("a", "c", 1);
|
||||
ok(ret == (is_win64 ? -2 : -1), "_strnicmp returned %d\n", ret);
|
||||
ret = p__strnicmp("C", "a", 1);
|
||||
ret = p_strnicmp("C", "a", 1);
|
||||
ok(ret == (is_win64 ? 2 : 1), "_strnicmp returned %d\n", ret);
|
||||
ret = p__strnicmp("c", "a", 1);
|
||||
ret = p_strnicmp("c", "a", 1);
|
||||
ok(ret == (is_win64 ? 2 : 1), "_strnicmp returned %d\n", ret);
|
||||
ret = p__strnicmp("ijk0", "IJK1", 3);
|
||||
ret = p_strnicmp("ijk0", "IJK1", 3);
|
||||
ok(!ret, "_strnicmp returned %d\n", ret);
|
||||
ret = p__strnicmp("ijk0", "IJK1", 4);
|
||||
ret = p_strnicmp("ijk0", "IJK1", 4);
|
||||
ok(ret == -1, "_strnicmp returned %d\n", ret);
|
||||
ret = p__strnicmp("ijk\0X", "IJK\0Y", 5);
|
||||
ret = p_strnicmp("ijk\0X", "IJK\0Y", 5);
|
||||
ok(!ret, "_strnicmp returned %d\n", ret);
|
||||
}
|
||||
|
||||
|
@ -1487,37 +1486,31 @@ static void test_sscanf(void)
|
|||
int i = 0;
|
||||
int ret;
|
||||
|
||||
if (!p_sscanf)
|
||||
{
|
||||
win_skip("sscanf tests\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = p_sscanf("10", "%d", &i);
|
||||
ret = psscanf("10", "%d", &i);
|
||||
ok(ret == 1, "ret = %d\n", ret);
|
||||
ok(i == 10, "i = %d\n", i);
|
||||
|
||||
ret = p_sscanf("10", "%f", &f);
|
||||
ret = psscanf("10", "%f", &f);
|
||||
ok(ret == 0 || broken(ret == 1) /* xp/2003 */, "ret = %d\n", ret);
|
||||
ok(f == 0.0f, "f = %f\n", f);
|
||||
|
||||
ret = p_sscanf("10", "%g", &f);
|
||||
ret = psscanf("10", "%g", &f);
|
||||
ok(ret == 0 || broken(ret == 1) /* xp/2003 */, "ret = %d\n", ret);
|
||||
ok(f == 0.0f, "f = %f\n", f);
|
||||
|
||||
ret = p_sscanf("10", "%e", &f);
|
||||
ret = psscanf("10", "%e", &f);
|
||||
ok(ret == 0 || broken(ret == 1) /* xp/2003 */, "ret = %d\n", ret);
|
||||
ok(f == 0.0f, "f = %f\n", f);
|
||||
|
||||
ret = p_sscanf("10", "%lf", &d);
|
||||
ret = psscanf("10", "%lf", &d);
|
||||
ok(ret == 0 || broken(ret == 1) /* xp/2003 */, "ret = %d\n", ret);
|
||||
ok(d == 0.0, "d = %lf\n", f);
|
||||
|
||||
ret = p_sscanf("10", "%lg", &d);
|
||||
ret = psscanf("10", "%lg", &d);
|
||||
ok(ret == 0 || broken(ret == 1) /* xp/2003 */, "ret = %d\n", ret);
|
||||
ok(d == 0.0, "d = %lf\n", f);
|
||||
|
||||
ret = p_sscanf("10", "%le", &d);
|
||||
ret = psscanf("10", "%le", &d);
|
||||
ok(ret == 0 || broken(ret == 1) /* xp/2003 */, "ret = %d\n", ret);
|
||||
ok(d == 0.0, "d = %lf\n", f);
|
||||
}
|
||||
|
@ -1526,42 +1519,23 @@ START_TEST(string)
|
|||
{
|
||||
InitFunctionPtrs();
|
||||
|
||||
if (p_ultoa)
|
||||
test_ulongtoa();
|
||||
if (p_ui64toa)
|
||||
test_ulonglongtoa();
|
||||
if (p_atoi64)
|
||||
test_atoi64();
|
||||
if (p_ultow)
|
||||
test_ulongtow();
|
||||
if (p_ui64tow)
|
||||
test_ulonglongtow();
|
||||
if (p_wtoi)
|
||||
test_wtoi();
|
||||
if (p_wtol)
|
||||
test_wtol();
|
||||
if (p_wtoi64)
|
||||
test_wtoi64();
|
||||
if (p_wcschr)
|
||||
test_wcschr();
|
||||
if (p_wcsrchr)
|
||||
test_wcsrchr();
|
||||
if (p_wcslwr && p_wcsupr)
|
||||
test_wcslwrupr();
|
||||
if (patoi)
|
||||
test_atoi();
|
||||
if (patol)
|
||||
test_atol();
|
||||
if (p_qsort)
|
||||
test_qsort();
|
||||
if (p_bsearch)
|
||||
test_bsearch();
|
||||
if (p__snprintf)
|
||||
test__snprintf();
|
||||
if (p__snprintf_s)
|
||||
test__snprintf_s();
|
||||
else
|
||||
win_skip("_snprintf_s not available\n");
|
||||
test_ulongtoa();
|
||||
test_ulonglongtoa();
|
||||
test_atoi64();
|
||||
test_ulongtow();
|
||||
test_ulonglongtow();
|
||||
test_wtoi();
|
||||
test_wtol();
|
||||
test_wtoi64();
|
||||
test_wcschr();
|
||||
test_wcsrchr();
|
||||
test_wcslwrupr();
|
||||
test_atoi();
|
||||
test_atol();
|
||||
test_qsort();
|
||||
test_bsearch();
|
||||
test__snprintf();
|
||||
test__snprintf_s();
|
||||
test_tolower();
|
||||
test_toupper();
|
||||
test__strnicmp();
|
||||
|
|
Loading…
Reference in New Issue