Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
20c1d1e0
Commit
20c1d1e0
authored
Dec 15, 2003
by
Ferenc Wagner
Committed by
Alexandre Julliard
Dec 15, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added snprintf test.
parent
7803bb5e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
scanf.c
dlls/msvcrt/tests/scanf.c
+35
-0
No files found.
dlls/msvcrt/tests/scanf.c
View file @
20c1d1e0
...
@@ -92,8 +92,43 @@ static void test_sprintf( void )
...
@@ -92,8 +92,43 @@ static void test_sprintf( void )
}
}
}
}
static
void
test_snprintf
(
void
)
{
struct
snprintf_test
{
const
char
*
format
;
int
expected
;
struct
{
int
retval
;
int
render
;
}
todo
;
};
/* Pre-2.1 libc behaviour, not C99 compliant. */
const
struct
snprintf_test
tests
[]
=
{{
"short"
,
5
,
{
0
,
0
}},
{
"justfit"
,
7
,
{
0
,
0
}},
{
"justfits"
,
8
,
{
0
,
1
}},
{
"muchlonger"
,
-
1
,
{
1
,
1
}}};
char
buffer
[
8
];
const
int
bufsiz
=
sizeof
buffer
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
sizeof
tests
/
sizeof
tests
[
0
];
i
++
)
{
const
char
*
fmt
=
tests
[
i
].
format
;
const
int
expect
=
tests
[
i
].
expected
;
const
int
n
=
_snprintf
(
buffer
,
bufsiz
,
fmt
);
const
int
valid
=
n
<
0
?
bufsiz
:
(
n
==
bufsiz
?
n
:
n
+
1
);
todo
(
tests
[
i
].
todo
.
retval
?
"wine"
:
"none"
)
ok
(
n
==
expect
,
"
\"
%s
\"
: expected %d, returned %d"
,
fmt
,
expect
,
n
);
todo
(
tests
[
i
].
todo
.
render
?
"wine"
:
"none"
)
ok
(
!
memcmp
(
fmt
,
buffer
,
valid
),
"
\"
%s
\"
: rendered
\"
%.*s
\"
"
,
fmt
,
valid
,
buffer
);
};
}
START_TEST
(
scanf
)
START_TEST
(
scanf
)
{
{
test_sscanf
();
test_sscanf
();
test_sprintf
();
test_sprintf
();
test_snprintf
();
}
}
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