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
127d9932
Commit
127d9932
authored
Sep 30, 2019
by
Piotr Caban
Committed by
Alexandre Julliard
Sep 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Add wcrtomb_s tests.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a57d67b9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
string.c
dlls/msvcrt/tests/string.c
+40
-0
No files found.
dlls/msvcrt/tests/string.c
View file @
127d9932
...
...
@@ -88,6 +88,7 @@ static errno_t (__cdecl *p_mbsupr_s)(unsigned char *str, size_t numberOfElements
static
errno_t
(
__cdecl
*
p_mbslwr_s
)(
unsigned
char
*
str
,
size_t
numberOfElements
);
static
int
(
__cdecl
*
p_wctob
)(
wint_t
);
static
size_t
(
__cdecl
*
p_wcrtomb
)(
char
*
,
wchar_t
,
mbstate_t
*
);
static
int
(
__cdecl
*
p_wcrtomb_s
)(
size_t
*
,
char
*
,
size_t
,
wchar_t
,
mbstate_t
*
);
static
int
(
__cdecl
*
p_tolower
)(
int
);
static
int
(
__cdecl
*
p_towlower
)(
wint_t
);
static
int
(
__cdecl
*
p__towlower_l
)(
wint_t
,
_locale_t
);
...
...
@@ -2784,6 +2785,7 @@ static void test_wctomb(void)
mbstate_t
state
;
unsigned
char
dst
[
10
];
size_t
ret
;
int
err
;
if
(
!
p_wcrtomb
||
!
setlocale
(
LC_ALL
,
"Japanese_Japan.932"
))
{
win_skip
(
"wcrtomb tests
\n
"
);
...
...
@@ -2815,6 +2817,43 @@ static void test_wctomb(void)
ok
(
ret
==
-
1
,
"wcrtomb did not return -1
\n
"
);
ok
(
dst
[
0
]
==
0x3f
,
"dst[0] = %x, expected 0x3f
\n
"
,
dst
[
0
]);
if
(
!
p_wcrtomb_s
)
{
win_skip
(
"wcrtomb_s tests
\n
"
);
setlocale
(
LC_ALL
,
"C"
);
return
;
}
state
=
1
;
dst
[
2
]
=
'a'
;
err
=
p_wcrtomb_s
(
&
ret
,
(
char
*
)
dst
,
sizeof
(
dst
),
0x3042
,
&
state
);
ok
(
!
err
,
"err = %d
\n
"
,
err
);
ok
(
ret
==
2
,
"ret != 2
\n
"
);
ok
(
!
state
,
"state != 0
\n
"
);
ok
(
dst
[
0
]
==
0x82
,
"dst[0] = %x, expected 0x82
\n
"
,
dst
[
0
]);
ok
(
dst
[
1
]
==
0xa0
,
"dst[1] = %x, expected 0xa0
\n
"
,
dst
[
1
]);
ok
(
dst
[
2
]
==
'a'
,
"dst[2] != 'a'
\n
"
);
err
=
p_wcrtomb_s
(
&
ret
,
(
char
*
)
dst
,
sizeof
(
dst
),
0x3042
,
NULL
);
ok
(
!
err
,
"err = %d
\n
"
,
err
);
ok
(
ret
==
2
,
"ret != 2
\n
"
);
ok
(
!
state
,
"state != 0
\n
"
);
ok
(
dst
[
0
]
==
0x82
,
"dst[0] = %x, expected 0x82
\n
"
,
dst
[
0
]);
ok
(
dst
[
1
]
==
0xa0
,
"dst[1] = %x, expected 0xa0
\n
"
,
dst
[
1
]);
err
=
p_wcrtomb_s
(
&
ret
,
(
char
*
)
dst
,
sizeof
(
dst
),
0x20
,
NULL
);
ok
(
!
err
,
"err = %d
\n
"
,
err
);
ok
(
ret
==
1
,
"ret != 1
\n
"
);
ok
(
dst
[
0
]
==
0x20
,
"dst[0] = %x, expected 0x20
\n
"
,
dst
[
0
]);
err
=
p_wcrtomb_s
(
&
ret
,
NULL
,
0
,
0x20
,
NULL
);
ok
(
!
err
,
"err = %d
\n
"
,
err
);
ok
(
ret
==
1
,
"ret != 1
\n
"
);
err
=
p_wcrtomb_s
(
&
ret
,
(
char
*
)
dst
,
sizeof
(
dst
),
0xffff
,
NULL
);
ok
(
err
==
EILSEQ
,
"err = %d
\n
"
,
err
);
ok
(
ret
==
-
1
,
"wcrtomb did not return -1
\n
"
);
ok
(
dst
[
0
]
==
0x3f
,
"dst[0] = %x, expected 0x3f
\n
"
,
dst
[
0
]);
setlocale
(
LC_ALL
,
"C"
);
}
...
...
@@ -3861,6 +3900,7 @@ START_TEST(string)
p_mbslwr_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_mbslwr_s"
);
p_wctob
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"wctob"
);
p_wcrtomb
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"wcrtomb"
);
p_wcrtomb_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"wcrtomb_s"
);
p_tolower
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"tolower"
);
p_towlower
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"towlower"
);
p__towlower_l
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_towlower_l"
);
...
...
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