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
b12c46be
Commit
b12c46be
authored
Apr 22, 2009
by
Rein Klazes
Committed by
Alexandre Julliard
Apr 22, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt/tests: Add some tests for strtok().
parent
eac47917
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
1 deletion
+45
-1
string.c
dlls/msvcrt/tests/string.c
+45
-1
No files found.
dlls/msvcrt/tests/string.c
View file @
b12c46be
...
...
@@ -619,6 +619,50 @@ static void test_mbcjisjms(void)
}
while
(
jisjms
[
i
++
][
0
]
!=
0
);
}
static
const
struct
{
const
char
*
string
;
const
char
*
delimiter
;
int
exp_offsetret1
;
/* returned offset from string after first call to strtok()
-1 means NULL */
int
exp_offsetret2
;
/* returned offset from string after second call to strtok()
-1 means NULL */
int
exp_offsetret3
;
/* returned offset from string after third call to strtok()
-1 means NULL */
}
testcases_strtok
[]
=
{
{
"red cabernet"
,
" "
,
0
,
4
,
-
1
},
{
"sparkling white riesling"
,
" "
,
0
,
10
,
16
},
{
" pale cream sherry"
,
"e "
,
1
,
6
,
9
},
/* end mark */
{
0
}
};
static
void
test_strtok
(
void
)
{
int
i
;
char
*
strret
;
char
teststr
[
100
];
for
(
i
=
0
;
testcases_strtok
[
i
].
string
;
i
++
){
strcpy
(
teststr
,
testcases_strtok
[
i
].
string
);
strret
=
strtok
(
teststr
,
testcases_strtok
[
i
].
delimiter
);
ok
(
(
int
)(
strret
-
teststr
)
==
testcases_strtok
[
i
].
exp_offsetret1
||
(
!
strret
&&
testcases_strtok
[
i
].
exp_offsetret1
==
-
1
),
"string (%p)
\'
%s
\'
return %p
\n
"
,
teststr
,
testcases_strtok
[
i
].
string
,
strret
);
if
(
!
strret
)
continue
;
strret
=
strtok
(
NULL
,
testcases_strtok
[
i
].
delimiter
);
ok
(
(
int
)(
strret
-
teststr
)
==
testcases_strtok
[
i
].
exp_offsetret2
||
(
!
strret
&&
testcases_strtok
[
i
].
exp_offsetret2
==
-
1
),
"second call string (%p)
\'
%s
\'
return %p
\n
"
,
teststr
,
testcases_strtok
[
i
].
string
,
strret
);
if
(
!
strret
)
continue
;
strret
=
strtok
(
NULL
,
testcases_strtok
[
i
].
delimiter
);
ok
(
(
int
)(
strret
-
teststr
)
==
testcases_strtok
[
i
].
exp_offsetret3
||
(
!
strret
&&
testcases_strtok
[
i
].
exp_offsetret3
==
-
1
),
"third call string (%p)
\'
%s
\'
return %p
\n
"
,
teststr
,
testcases_strtok
[
i
].
string
,
strret
);
}
}
START_TEST
(
string
)
{
char
mem
[
100
];
...
...
@@ -660,6 +704,6 @@ START_TEST(string)
test_strcat_s
();
test__mbsnbcpy_s
();
test_mbcjisjms
();
test_strtok
();
test_wcscpy_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