ntdll/tests: Enable compilation with long types in string.c.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3c19c54aa0
commit
4eded62d2a
|
@ -20,6 +20,7 @@
|
||||||
* We use function pointers here as there is no import library for NTDLL on
|
* We use function pointers here as there is no import library for NTDLL on
|
||||||
* windows.
|
* windows.
|
||||||
*/
|
*/
|
||||||
|
#undef WINE_NO_LONG_TYPES /* temporary for migration */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -308,10 +309,10 @@ static void one_ltoa_test(int test_num, const ulong2str_t *ulong2str)
|
||||||
value = ulong2str->value;
|
value = ulong2str->value;
|
||||||
result = p_ltoa(ulong2str->value, dest_str, ulong2str->base);
|
result = p_ltoa(ulong2str->value, dest_str, ulong2str->base);
|
||||||
ok(result == dest_str,
|
ok(result == dest_str,
|
||||||
"(test %d): _ltoa(%d, [out], %d) has result %p, expected: %p\n",
|
"(test %d): _ltoa(%ld, [out], %d) has result %p, expected: %p\n",
|
||||||
test_num, value, ulong2str->base, result, dest_str);
|
test_num, value, ulong2str->base, result, dest_str);
|
||||||
ok(memcmp(dest_str, ulong2str->Buffer, LARGE_STRI_BUFFER_LENGTH) == 0,
|
ok(memcmp(dest_str, ulong2str->Buffer, LARGE_STRI_BUFFER_LENGTH) == 0,
|
||||||
"(test %d): _ltoa(%d, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
|
"(test %d): _ltoa(%ld, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
|
||||||
test_num, value, ulong2str->base, dest_str, ulong2str->Buffer);
|
test_num, value, ulong2str->base, dest_str, ulong2str->Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,10 +328,10 @@ static void one_ultoa_test(int test_num, const ulong2str_t *ulong2str)
|
||||||
value = ulong2str->value;
|
value = ulong2str->value;
|
||||||
result = p_ultoa(ulong2str->value, dest_str, ulong2str->base);
|
result = p_ultoa(ulong2str->value, dest_str, ulong2str->base);
|
||||||
ok(result == dest_str,
|
ok(result == dest_str,
|
||||||
"(test %d): _ultoa(%u, [out], %d) has result %p, expected: %p\n",
|
"(test %d): _ultoa(%lu, [out], %d) has result %p, expected: %p\n",
|
||||||
test_num, value, ulong2str->base, result, dest_str);
|
test_num, value, ulong2str->base, result, dest_str);
|
||||||
ok(memcmp(dest_str, ulong2str->Buffer, LARGE_STRI_BUFFER_LENGTH) == 0,
|
ok(memcmp(dest_str, ulong2str->Buffer, LARGE_STRI_BUFFER_LENGTH) == 0,
|
||||||
"(test %d): _ultoa(%u, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
|
"(test %d): _ultoa(%lu, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
|
||||||
test_num, value, ulong2str->base, dest_str, ulong2str->Buffer);
|
test_num, value, ulong2str->base, dest_str, ulong2str->Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,10 +416,10 @@ static void one_ltow_test(int test_num, const ulong2str_t *ulong2str)
|
||||||
result = p_ltow(value, dest_wstr, ulong2str->base);
|
result = p_ltow(value, dest_wstr, ulong2str->base);
|
||||||
pRtlUnicodeStringToAnsiString(&ansi_str, &unicode_string, 1);
|
pRtlUnicodeStringToAnsiString(&ansi_str, &unicode_string, 1);
|
||||||
ok(result == dest_wstr,
|
ok(result == dest_wstr,
|
||||||
"(test %d): _ltow(%d, [out], %d) has result %p, expected: %p\n",
|
"(test %d): _ltow(%ld, [out], %d) has result %p, expected: %p\n",
|
||||||
test_num, value, ulong2str->base, result, dest_wstr);
|
test_num, value, ulong2str->base, result, dest_wstr);
|
||||||
ok(memcmp(dest_wstr, expected_wstr, LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR)) == 0,
|
ok(memcmp(dest_wstr, expected_wstr, LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR)) == 0,
|
||||||
"(test %d): _ltow(%d, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
|
"(test %d): _ltow(%ld, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
|
||||||
test_num, value, ulong2str->base, ansi_str.Buffer, ulong2str->Buffer);
|
test_num, value, ulong2str->base, ansi_str.Buffer, ulong2str->Buffer);
|
||||||
pRtlFreeAnsiString(&ansi_str);
|
pRtlFreeAnsiString(&ansi_str);
|
||||||
}
|
}
|
||||||
|
@ -451,10 +452,10 @@ static void one_ultow_test(int test_num, const ulong2str_t *ulong2str)
|
||||||
result = p_ultow(value, dest_wstr, ulong2str->base);
|
result = p_ultow(value, dest_wstr, ulong2str->base);
|
||||||
pRtlUnicodeStringToAnsiString(&ansi_str, &unicode_string, 1);
|
pRtlUnicodeStringToAnsiString(&ansi_str, &unicode_string, 1);
|
||||||
ok(result == dest_wstr,
|
ok(result == dest_wstr,
|
||||||
"(test %d): _ultow(%u, [out], %d) has result %p, expected: %p\n",
|
"(test %d): _ultow(%lu, [out], %d) has result %p, expected: %p\n",
|
||||||
test_num, value, ulong2str->base, result, dest_wstr);
|
test_num, value, ulong2str->base, result, dest_wstr);
|
||||||
ok(memcmp(dest_wstr, expected_wstr, LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR)) == 0,
|
ok(memcmp(dest_wstr, expected_wstr, LARGE_STRI_BUFFER_LENGTH * sizeof(WCHAR)) == 0,
|
||||||
"(test %d): _ultow(%u, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
|
"(test %d): _ultow(%lu, [out], %d) assigns string \"%s\", expected: \"%s\"\n",
|
||||||
test_num, value, ulong2str->base, ansi_str.Buffer, ulong2str->Buffer);
|
test_num, value, ulong2str->base, ansi_str.Buffer, ulong2str->Buffer);
|
||||||
pRtlFreeAnsiString(&ansi_str);
|
pRtlFreeAnsiString(&ansi_str);
|
||||||
}
|
}
|
||||||
|
@ -481,7 +482,7 @@ static void test_ulongtow(void)
|
||||||
/* Crashes on XP and W2K3 */
|
/* Crashes on XP and W2K3 */
|
||||||
result = p_itow(ulong2str[0].value, NULL, 10);
|
result = p_itow(ulong2str[0].value, NULL, 10);
|
||||||
ok(result == NULL,
|
ok(result == NULL,
|
||||||
"(test a): _itow(%d, NULL, 10) has result %p, expected: NULL\n",
|
"(test a): _itow(%ld, NULL, 10) has result %p, expected: NULL\n",
|
||||||
ulong2str[0].value, result);
|
ulong2str[0].value, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,7 +490,7 @@ static void test_ulongtow(void)
|
||||||
/* Crashes on XP and W2K3 */
|
/* Crashes on XP and W2K3 */
|
||||||
result = p_ltow(ulong2str[0].value, NULL, 10);
|
result = p_ltow(ulong2str[0].value, NULL, 10);
|
||||||
ok(result == NULL,
|
ok(result == NULL,
|
||||||
"(test b): _ltow(%d, NULL, 10) has result %p, expected: NULL\n",
|
"(test b): _ltow(%ld, NULL, 10) has result %p, expected: NULL\n",
|
||||||
ulong2str[0].value, result);
|
ulong2str[0].value, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,7 +498,7 @@ static void test_ulongtow(void)
|
||||||
/* Crashes on XP and W2K3 */
|
/* Crashes on XP and W2K3 */
|
||||||
result = p_ultow(ulong2str[0].value, NULL, 10);
|
result = p_ultow(ulong2str[0].value, NULL, 10);
|
||||||
ok(result == NULL,
|
ok(result == NULL,
|
||||||
"(test c): _ultow(%d, NULL, 10) has result %p, expected: NULL\n",
|
"(test c): _ultow(%ld, NULL, 10) has result %p, expected: NULL\n",
|
||||||
ulong2str[0].value, result);
|
ulong2str[0].value, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -959,7 +960,7 @@ static void test_wtoi(void)
|
||||||
pRtlCreateUnicodeStringFromAsciiz(&uni, str2long[test_num].str);
|
pRtlCreateUnicodeStringFromAsciiz(&uni, str2long[test_num].str);
|
||||||
result = p_wtoi(uni.Buffer);
|
result = p_wtoi(uni.Buffer);
|
||||||
ok(result == str2long[test_num].value,
|
ok(result == str2long[test_num].value,
|
||||||
"(test %d): call failed: _wtoi(\"%s\") has result %d, expected: %d\n",
|
"(test %d): call failed: _wtoi(\"%s\") has result %d, expected: %ld\n",
|
||||||
test_num, str2long[test_num].str, result, str2long[test_num].value);
|
test_num, str2long[test_num].str, result, str2long[test_num].value);
|
||||||
pRtlFreeUnicodeString(&uni);
|
pRtlFreeUnicodeString(&uni);
|
||||||
} /* for */
|
} /* for */
|
||||||
|
@ -973,7 +974,7 @@ static void test_atoi(void)
|
||||||
for (test_num = 0; test_num < ARRAY_SIZE(str2long); test_num++) {
|
for (test_num = 0; test_num < ARRAY_SIZE(str2long); test_num++) {
|
||||||
result = patoi(str2long[test_num].str);
|
result = patoi(str2long[test_num].str);
|
||||||
ok(result == str2long[test_num].value,
|
ok(result == str2long[test_num].value,
|
||||||
"(test %d): call failed: _atoi(\"%s\") has result %d, expected: %d\n",
|
"(test %d): call failed: _atoi(\"%s\") has result %d, expected: %ld\n",
|
||||||
test_num, str2long[test_num].str, result, str2long[test_num].value);
|
test_num, str2long[test_num].str, result, str2long[test_num].value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -986,7 +987,7 @@ static void test_atol(void)
|
||||||
for (test_num = 0; test_num < ARRAY_SIZE(str2long); test_num++) {
|
for (test_num = 0; test_num < ARRAY_SIZE(str2long); test_num++) {
|
||||||
result = patol(str2long[test_num].str);
|
result = patol(str2long[test_num].str);
|
||||||
ok(result == str2long[test_num].value,
|
ok(result == str2long[test_num].value,
|
||||||
"(test %d): call failed: _atol(\"%s\") has result %d, expected: %d\n",
|
"(test %d): call failed: _atol(\"%s\") has result %d, expected: %ld\n",
|
||||||
test_num, str2long[test_num].str, result, str2long[test_num].value);
|
test_num, str2long[test_num].str, result, str2long[test_num].value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1001,14 +1002,14 @@ static void test_wtol(void)
|
||||||
pRtlCreateUnicodeStringFromAsciiz(&uni, str2long[test_num].str);
|
pRtlCreateUnicodeStringFromAsciiz(&uni, str2long[test_num].str);
|
||||||
result = p_wtol(uni.Buffer);
|
result = p_wtol(uni.Buffer);
|
||||||
ok(result == str2long[test_num].value,
|
ok(result == str2long[test_num].value,
|
||||||
"(test %d): call failed: _wtol(\"%s\") has result %d, expected: %d\n",
|
"(test %d): call failed: _wtol(\"%s\") has result %ld, expected: %ld\n",
|
||||||
test_num, str2long[test_num].str, result, str2long[test_num].value);
|
test_num, str2long[test_num].str, result, str2long[test_num].value);
|
||||||
pRtlFreeUnicodeString(&uni);
|
pRtlFreeUnicodeString(&uni);
|
||||||
}
|
}
|
||||||
result = p_wtol( L"\t\xa0\n 12" );
|
result = p_wtol( L"\t\xa0\n 12" );
|
||||||
ok( result == 12, "got %d\n", result );
|
ok( result == 12, "got %ld\n", result );
|
||||||
result = p_wtol( L"\x3000 12" );
|
result = p_wtol( L"\x3000 12" );
|
||||||
ok( result == 0, "got %d\n", result );
|
ok( result == 0, "got %ld\n", result );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1231,10 +1232,10 @@ static void test_wcstol(void)
|
||||||
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
||||||
{
|
{
|
||||||
res = pwcstol( tests[i].str, &endpos, tests[i].base );
|
res = pwcstol( tests[i].str, &endpos, tests[i].base );
|
||||||
ok( res == tests[i].res, "%u: %s res %08x\n", i, wine_dbgstr_w(tests[i].str), res );
|
ok( res == tests[i].res, "%u: %s res %08lx\n", i, wine_dbgstr_w(tests[i].str), res );
|
||||||
if (!res) ok( endpos == tests[i].str, "%u: wrong endpos %p/%p\n", i, endpos, tests[i].str );
|
if (!res) ok( endpos == tests[i].str, "%u: wrong endpos %p/%p\n", i, endpos, tests[i].str );
|
||||||
ures = pwcstoul( tests[i].str, &endpos, tests[i].base );
|
ures = pwcstoul( tests[i].str, &endpos, tests[i].base );
|
||||||
ok( ures == tests[i].ures, "%u: %s res %08x\n", i, wine_dbgstr_w(tests[i].str), ures );
|
ok( ures == tests[i].ures, "%u: %s res %08lx\n", i, wine_dbgstr_w(tests[i].str), ures );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test various unicode digits */
|
/* Test various unicode digits */
|
||||||
|
@ -1242,14 +1243,14 @@ static void test_wcstol(void)
|
||||||
{
|
{
|
||||||
WCHAR tmp[] = { zeros[i] + 4, zeros[i], zeros[i] + 5, 0 };
|
WCHAR tmp[] = { zeros[i] + 4, zeros[i], zeros[i] + 5, 0 };
|
||||||
res = pwcstol(tmp, NULL, 0);
|
res = pwcstol(tmp, NULL, 0);
|
||||||
ok(res == 405, "with zero = U+%04X: got %d, expected 405\n", zeros[i], res);
|
ok(res == 405, "with zero = U+%04X: got %ld, expected 405\n", zeros[i], res);
|
||||||
ures = pwcstoul(tmp, NULL, 0);
|
ures = pwcstoul(tmp, NULL, 0);
|
||||||
ok(ures == 405, "with zero = U+%04X: got %u, expected 405\n", zeros[i], ures);
|
ok(ures == 405, "with zero = U+%04X: got %lu, expected 405\n", zeros[i], ures);
|
||||||
tmp[1] = zeros[i] + 10;
|
tmp[1] = zeros[i] + 10;
|
||||||
res = pwcstol(tmp, NULL, 16);
|
res = pwcstol(tmp, NULL, 16);
|
||||||
ok(res == 4, "with zero = U+%04X: got %d, expected 4\n", zeros[i], res);
|
ok(res == 4, "with zero = U+%04X: got %ld, expected 4\n", zeros[i], res);
|
||||||
ures = pwcstoul(tmp, NULL, 16);
|
ures = pwcstoul(tmp, NULL, 16);
|
||||||
ok(ures == 4, "with zero = U+%04X: got %u, expected 4\n", zeros[i], ures);
|
ok(ures == 4, "with zero = U+%04X: got %lu, expected 4\n", zeros[i], ures);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue