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
d313c0b9
Commit
d313c0b9
authored
Jun 07, 2010
by
Alexander Scott-Johns
Committed by
Alexandre Julliard
Jun 07, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt/test: Add some simple _vsnwprintf_s tests.
parent
d3c00aab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
printf.c
dlls/msvcrt/tests/printf.c
+61
-0
No files found.
dlls/msvcrt/tests/printf.c
View file @
d313c0b9
...
...
@@ -812,6 +812,9 @@ static void test_vsnwprintf(void)
static
int
(
__cdecl
*
p__vscprintf
)(
const
char
*
format
,
__ms_va_list
valist
);
static
int
(
__cdecl
*
p__vscwprintf
)(
const
wchar_t
*
format
,
__ms_va_list
valist
);
static
int
(
__cdecl
*
p__vsnwprintf_s
)(
wchar_t
*
str
,
size_t
sizeOfBuffer
,
size_t
count
,
const
wchar_t
*
format
,
__ms_va_list
valist
);
static
int
__cdecl
_vscprintf_wrapper
(
const
char
*
format
,
...)
{
...
...
@@ -852,6 +855,58 @@ static void test_vscwprintf(void)
ok
(
ret
==
8
,
"got %d expected 8
\n
"
,
ret
);
}
static
int
__cdecl
_vsnwprintf_s_wrapper
(
wchar_t
*
str
,
size_t
sizeOfBuffer
,
size_t
count
,
const
wchar_t
*
format
,
...)
{
int
ret
;
__ms_va_list
valist
;
__ms_va_start
(
valist
,
format
);
ret
=
p__vsnwprintf_s
(
str
,
sizeOfBuffer
,
count
,
format
,
valist
);
__ms_va_end
(
valist
);
return
ret
;
}
static
void
test_vsnwprintf_s
(
void
)
{
const
wchar_t
format
[]
=
{
'A'
,
'B'
,
'%'
,
'u'
,
'C'
,
0
};
const
wchar_t
out7
[]
=
{
'A'
,
'B'
,
'1'
,
'2'
,
'3'
,
'C'
,
0
};
const
wchar_t
out6
[]
=
{
'A'
,
'B'
,
'1'
,
'2'
,
'3'
,
0
};
const
wchar_t
out2
[]
=
{
'A'
,
0
};
const
wchar_t
out1
[]
=
{
0
};
wchar_t
buffer
[
14
]
=
{
0
};
int
exp
,
got
;
/* Enough room. */
exp
=
wcslen
(
out7
);
got
=
_vsnwprintf_s_wrapper
(
buffer
,
14
,
_TRUNCATE
,
format
,
123
);
ok
(
exp
==
got
,
"length wrong, expect=%d, got=%d
\n
"
,
exp
,
got
);
ok
(
!
wcscmp
(
out7
,
buffer
),
"buffer wrong, got=%s
\n
"
,
wine_dbgstr_w
(
buffer
));
got
=
_vsnwprintf_s_wrapper
(
buffer
,
12
,
_TRUNCATE
,
format
,
123
);
ok
(
exp
==
got
,
"length wrong, expect=%d, got=%d
\n
"
,
exp
,
got
);
ok
(
!
wcscmp
(
out7
,
buffer
),
"buffer wrong, got=%s
\n
"
,
wine_dbgstr_w
(
buffer
));
got
=
_vsnwprintf_s_wrapper
(
buffer
,
7
,
_TRUNCATE
,
format
,
123
);
ok
(
exp
==
got
,
"length wrong, expect=%d, got=%d
\n
"
,
exp
,
got
);
ok
(
!
wcscmp
(
out7
,
buffer
),
"buffer wrong, got=%s
\n
"
,
wine_dbgstr_w
(
buffer
));
/* Not enough room. */
exp
=
-
1
;
got
=
_vsnwprintf_s_wrapper
(
buffer
,
6
,
_TRUNCATE
,
format
,
123
);
ok
(
exp
==
got
,
"length wrong, expect=%d, got=%d
\n
"
,
exp
,
got
);
ok
(
!
wcscmp
(
out6
,
buffer
),
"buffer wrong, got=%s
\n
"
,
wine_dbgstr_w
(
buffer
));
got
=
_vsnwprintf_s_wrapper
(
buffer
,
2
,
_TRUNCATE
,
format
,
123
);
ok
(
exp
==
got
,
"length wrong, expect=%d, got=%d
\n
"
,
exp
,
got
);
ok
(
!
wcscmp
(
out2
,
buffer
),
"buffer wrong, got=%s
\n
"
,
wine_dbgstr_w
(
buffer
));
got
=
_vsnwprintf_s_wrapper
(
buffer
,
1
,
_TRUNCATE
,
format
,
123
);
ok
(
exp
==
got
,
"length wrong, expect=%d, got=%d
\n
"
,
exp
,
got
);
ok
(
!
wcscmp
(
out1
,
buffer
),
"buffer wrong, got=%s
\n
"
,
wine_dbgstr_w
(
buffer
));
}
START_TEST
(
printf
)
{
test_sprintf
();
...
...
@@ -863,6 +918,7 @@ START_TEST(printf)
p__vscprintf
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"msvcrt.dll"
),
"_vscprintf"
);
p__vscwprintf
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"msvcrt.dll"
),
"_vscwprintf"
);
p__vsnwprintf_s
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"msvcrt.dll"
),
"_vsnwprintf_s"
);
if
(
p__vscprintf
)
test_vscprintf
();
...
...
@@ -873,4 +929,9 @@ START_TEST(printf)
test_vscwprintf
();
else
win_skip
(
"_vscwprintf not available
\n
"
);
if
(
p__vsnwprintf_s
)
test_vsnwprintf_s
();
else
win_skip
(
"_vsnwprintf_s not available
\n
"
);
}
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