Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4eded62d
Commit
4eded62d
authored
Mar 23, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Mar 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
>
parent
3c19c54a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
23 deletions
+24
-23
string.c
dlls/ntdll/tests/string.c
+24
-23
No files found.
dlls/ntdll/tests/string.c
View file @
4eded62d
...
...
@@ -20,6 +20,7 @@
* We use function pointers here as there is no import library for NTDLL on
* windows.
*/
#undef WINE_NO_LONG_TYPES
/* temporary for migration */
#include <stdlib.h>
#include <limits.h>
...
...
@@ -308,10 +309,10 @@ static void one_ltoa_test(int test_num, const ulong2str_t *ulong2str)
value
=
ulong2str
->
value
;
result
=
p_ltoa
(
ulong2str
->
value
,
dest_str
,
ulong2str
->
base
);
ok
(
result
==
dest_str
,
"(test %d): _ltoa(%d, [out], %d) has result %p, expected: %p
\n
"
,
"(test %d): _ltoa(%
l
d, [out], %d) has result %p, expected: %p
\n
"
,
test_num
,
value
,
ulong2str
->
base
,
result
,
dest_str
);
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(%
l
d, [out], %d) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
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
;
result
=
p_ultoa
(
ulong2str
->
value
,
dest_str
,
ulong2str
->
base
);
ok
(
result
==
dest_str
,
"(test %d): _ultoa(%u, [out], %d) has result %p, expected: %p
\n
"
,
"(test %d): _ultoa(%
l
u, [out], %d) has result %p, expected: %p
\n
"
,
test_num
,
value
,
ulong2str
->
base
,
result
,
dest_str
);
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(%
l
u, [out], %d) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
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
);
pRtlUnicodeStringToAnsiString
(
&
ansi_str
,
&
unicode_string
,
1
);
ok
(
result
==
dest_wstr
,
"(test %d): _ltow(%d, [out], %d) has result %p, expected: %p
\n
"
,
"(test %d): _ltow(%
l
d, [out], %d) has result %p, expected: %p
\n
"
,
test_num
,
value
,
ulong2str
->
base
,
result
,
dest_wstr
);
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(%
l
d, [out], %d) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
test_num
,
value
,
ulong2str
->
base
,
ansi_str
.
Buffer
,
ulong2str
->
Buffer
);
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
);
pRtlUnicodeStringToAnsiString
(
&
ansi_str
,
&
unicode_string
,
1
);
ok
(
result
==
dest_wstr
,
"(test %d): _ultow(%u, [out], %d) has result %p, expected: %p
\n
"
,
"(test %d): _ultow(%
l
u, [out], %d) has result %p, expected: %p
\n
"
,
test_num
,
value
,
ulong2str
->
base
,
result
,
dest_wstr
);
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(%
l
u, [out], %d) assigns string
\"
%s
\"
, expected:
\"
%s
\"\n
"
,
test_num
,
value
,
ulong2str
->
base
,
ansi_str
.
Buffer
,
ulong2str
->
Buffer
);
pRtlFreeAnsiString
(
&
ansi_str
);
}
...
...
@@ -481,7 +482,7 @@ static void test_ulongtow(void)
/* Crashes on XP and W2K3 */
result
=
p_itow
(
ulong2str
[
0
].
value
,
NULL
,
10
);
ok
(
result
==
NULL
,
"(test a): _itow(%d, NULL, 10) has result %p, expected: NULL
\n
"
,
"(test a): _itow(%
l
d, NULL, 10) has result %p, expected: NULL
\n
"
,
ulong2str
[
0
].
value
,
result
);
}
...
...
@@ -489,7 +490,7 @@ static void test_ulongtow(void)
/* Crashes on XP and W2K3 */
result
=
p_ltow
(
ulong2str
[
0
].
value
,
NULL
,
10
);
ok
(
result
==
NULL
,
"(test b): _ltow(%d, NULL, 10) has result %p, expected: NULL
\n
"
,
"(test b): _ltow(%
l
d, NULL, 10) has result %p, expected: NULL
\n
"
,
ulong2str
[
0
].
value
,
result
);
}
...
...
@@ -497,7 +498,7 @@ static void test_ulongtow(void)
/* Crashes on XP and W2K3 */
result
=
p_ultow
(
ulong2str
[
0
].
value
,
NULL
,
10
);
ok
(
result
==
NULL
,
"(test c): _ultow(%d, NULL, 10) has result %p, expected: NULL
\n
"
,
"(test c): _ultow(%
l
d, NULL, 10) has result %p, expected: NULL
\n
"
,
ulong2str
[
0
].
value
,
result
);
}
}
...
...
@@ -959,7 +960,7 @@ static void test_wtoi(void)
pRtlCreateUnicodeStringFromAsciiz
(
&
uni
,
str2long
[
test_num
].
str
);
result
=
p_wtoi
(
uni
.
Buffer
);
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: %
l
d
\n
"
,
test_num
,
str2long
[
test_num
].
str
,
result
,
str2long
[
test_num
].
value
);
pRtlFreeUnicodeString
(
&
uni
);
}
/* for */
...
...
@@ -973,7 +974,7 @@ static void test_atoi(void)
for
(
test_num
=
0
;
test_num
<
ARRAY_SIZE
(
str2long
);
test_num
++
)
{
result
=
patoi
(
str2long
[
test_num
].
str
);
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: %
l
d
\n
"
,
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
++
)
{
result
=
patol
(
str2long
[
test_num
].
str
);
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: %
l
d
\n
"
,
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
);
result
=
p_wtol
(
uni
.
Buffer
);
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: %l
d
\n
"
,
test_num
,
str2long
[
test_num
].
str
,
result
,
str2long
[
test_num
].
value
);
pRtlFreeUnicodeString
(
&
uni
);
}
result
=
p_wtol
(
L"
\t\xa0\n
12"
);
ok
(
result
==
12
,
"got %d
\n
"
,
result
);
ok
(
result
==
12
,
"got %
l
d
\n
"
,
result
);
result
=
p_wtol
(
L"
\x3000
12"
);
ok
(
result
==
0
,
"got %d
\n
"
,
result
);
ok
(
result
==
0
,
"got %
l
d
\n
"
,
result
);
}
...
...
@@ -1231,10 +1232,10 @@ static void test_wcstol(void)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
tests
);
i
++
)
{
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 %08
l
x
\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
);
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 %08
l
x
\n
"
,
i
,
wine_dbgstr_w
(
tests
[
i
].
str
),
ures
);
}
/* Test various unicode digits */
...
...
@@ -1242,14 +1243,14 @@ static void test_wcstol(void)
{
WCHAR
tmp
[]
=
{
zeros
[
i
]
+
4
,
zeros
[
i
],
zeros
[
i
]
+
5
,
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 %
l
d, expected 405
\n
"
,
zeros
[
i
],
res
);
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 %
l
u, expected 405
\n
"
,
zeros
[
i
],
ures
);
tmp
[
1
]
=
zeros
[
i
]
+
10
;
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 %
l
d, expected 4
\n
"
,
zeros
[
i
],
res
);
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 %
l
u, expected 4
\n
"
,
zeros
[
i
],
ures
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment