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
ca3cb9e2
Commit
ca3cb9e2
authored
Apr 22, 2010
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 22, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt/tests: Added sscanf_s tests.
parent
f36671c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
scanf.c
dlls/msvcrt/tests/scanf.c
+42
-0
No files found.
dlls/msvcrt/tests/scanf.c
View file @
ca3cb9e2
...
...
@@ -198,7 +198,49 @@ static void test_sscanf( void )
ok
(
number_so_far
==
4
,
"%%n yielded wrong result: %d
\n
"
,
number_so_far
);
}
static
void
test_sscanf_s
(
void
)
{
int
(
__cdecl
*
psscanf_s
)(
const
char
*
,
const
char
*
,...);
HMODULE
hmod
=
GetModuleHandleA
(
"msvcrt.dll"
);
int
i
,
ret
;
char
buf
[
100
];
psscanf_s
=
(
void
*
)
GetProcAddress
(
hmod
,
"sscanf_s"
);
if
(
!
psscanf_s
)
{
win_skip
(
"sscanf_s not available
\n
"
);
return
;
}
ret
=
psscanf_s
(
"123"
,
"%d"
,
&
i
);
ok
(
ret
==
1
,
"Wrong number of arguments read: %d
\n
"
,
ret
);
ok
(
i
==
123
,
"i = %d
\n
"
,
i
);
ret
=
psscanf_s
(
"123"
,
"%s"
,
buf
,
100
);
ok
(
ret
==
1
,
"Wrong number of arguments read: %d
\n
"
,
ret
);
ok
(
!
strcmp
(
"123"
,
buf
),
"buf = %s
\n
"
,
buf
);
ret
=
psscanf_s
(
"123"
,
"%s"
,
buf
,
3
);
ok
(
ret
==
0
,
"Wrong number of arguments read: %d
\n
"
,
ret
);
ok
(
buf
[
0
]
==
'\0'
,
"buf = %s
\n
"
,
buf
);
buf
[
0
]
=
'a'
;
ret
=
psscanf_s
(
"123"
,
"%3c"
,
buf
,
2
);
ok
(
ret
==
0
,
"Wrong number of arguments read: %d
\n
"
,
ret
);
ok
(
buf
[
0
]
==
'\0'
,
"buf = %s
\n
"
,
buf
);
i
=
1
;
ret
=
psscanf_s
(
"123 123"
,
"%s %d"
,
buf
,
2
,
&
i
);
ok
(
ret
==
0
,
"Wrong number of arguments read: %d
\n
"
,
ret
);
ok
(
i
==
1
,
"i = %d
\n
"
,
i
);
i
=
1
;
ret
=
psscanf_s
(
"123 123"
,
"%d %s"
,
&
i
,
buf
,
2
);
ok
(
ret
==
1
,
"Wrong number of arguments read: %d
\n
"
,
ret
);
ok
(
i
==
123
,
"i = %d
\n
"
,
i
);
}
START_TEST
(
scanf
)
{
test_sscanf
();
test_sscanf_s
();
}
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