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
d677bda9
Commit
d677bda9
authored
Nov 29, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Nov 30, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Added wcrtomb tests.
parent
c0ce611e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
string.c
dlls/msvcrt/tests/string.c
+41
-0
No files found.
dlls/msvcrt/tests/string.c
View file @
d677bda9
...
...
@@ -85,6 +85,7 @@ static int (__cdecl *p_wcslwr_s)(wchar_t*,size_t);
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_tolower
)(
int
);
static
size_t
(
__cdecl
*
p_mbrlen
)(
const
char
*
,
size_t
,
mbstate_t
*
);
static
size_t
(
__cdecl
*
p_mbrtowc
)(
wchar_t
*
,
const
char
*
,
size_t
,
mbstate_t
*
);
...
...
@@ -2301,6 +2302,44 @@ static void test_wctob(void)
ret
=
p_wctob
(
0xe0
);
ok
(
ret
==
(
int
)(
char
)
0xe0
,
"ret = %x
\n
"
,
ret
);
}
static
void
test_wctomb
(
void
)
{
mbstate_t
state
;
unsigned
char
dst
[
10
];
size_t
ret
;
if
(
!
p_wcrtomb
||
!
setlocale
(
LC_ALL
,
"Japanese_Japan.932"
))
{
win_skip
(
"wcrtomb tests
\n
"
);
return
;
}
ret
=
p_wcrtomb
(
NULL
,
0x3042
,
NULL
);
ok
(
ret
==
2
,
"wcrtomb did not return 2
\n
"
);
state
=
1
;
dst
[
2
]
=
'a'
;
ret
=
p_wcrtomb
((
char
*
)
dst
,
0x3042
,
&
state
);
ok
(
ret
==
2
,
"wcrtomb did not return 2
\n
"
);
ok
(
state
==
0
,
"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
"
);
ret
=
p_wcrtomb
((
char
*
)
dst
,
0x3043
,
NULL
);
ok
(
ret
==
2
,
"wcrtomb did not return 2
\n
"
);
ok
(
dst
[
0
]
==
0x82
,
"dst[0] = %x, expected 0x82
\n
"
,
dst
[
0
]);
ok
(
dst
[
1
]
==
0xa1
,
"dst[1] = %x, expected 0xa1
\n
"
,
dst
[
1
]);
ret
=
p_wcrtomb
((
char
*
)
dst
,
0x20
,
NULL
);
ok
(
ret
==
1
,
"wcrtomb did not return 1
\n
"
);
ok
(
dst
[
0
]
==
0x20
,
"dst[0] = %x, expected 0x20
\n
"
,
dst
[
0
]);
ret
=
p_wcrtomb
((
char
*
)
dst
,
0xffff
,
NULL
);
ok
(
ret
==
-
1
,
"wcrtomb did not return -1
\n
"
);
ok
(
dst
[
0
]
==
0x3f
,
"dst[0] = %x, expected 0x20
\n
"
,
dst
[
0
]);
setlocale
(
LC_ALL
,
"C"
);
}
static
void
test_tolower
(
void
)
{
...
...
@@ -2376,6 +2415,7 @@ START_TEST(string)
p_mbsupr_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_mbsupr_s"
);
p_mbslwr_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_mbslwr_s"
);
p_wctob
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"wctob"
);
p_wcrtomb
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"wcrtomb"
);
p_tolower
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"tolower"
);
p_mbrlen
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"mbrlen"
);
p_mbrtowc
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"mbrtowc"
);
...
...
@@ -2427,5 +2467,6 @@ START_TEST(string)
test__mbsupr_s
();
test__mbslwr_s
();
test_wctob
();
test_wctomb
();
test_tolower
();
}
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