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
bc7809c2
Commit
bc7809c2
authored
Oct 25, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
Oct 26, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
combase/tests: Add tests for WindowsSubstringWithSpecifiedLength.
Signed-off-by:
Sebastian Lackner
<
sebastian@fds-team.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7d0dccd2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
string.c
dlls/combase/tests/string.c
+26
-2
No files found.
dlls/combase/tests/string.c
View file @
bc7809c2
...
...
@@ -39,6 +39,7 @@ static HRESULT (WINAPI *pWindowsPreallocateStringBuffer)(UINT32, WCHAR **, HSTRI
static
HRESULT
(
WINAPI
*
pWindowsPromoteStringBuffer
)(
HSTRING_BUFFER
,
HSTRING
*
);
static
HRESULT
(
WINAPI
*
pWindowsStringHasEmbeddedNull
)(
HSTRING
,
BOOL
*
);
static
HRESULT
(
WINAPI
*
pWindowsSubstring
)(
HSTRING
,
UINT32
,
HSTRING
*
);
static
HRESULT
(
WINAPI
*
pWindowsSubstringWithSpecifiedLength
)(
HSTRING
,
UINT32
,
UINT32
,
HSTRING
*
);
#define SET(x) p##x = (void*)GetProcAddress(hmod, #x)
...
...
@@ -62,6 +63,7 @@ static BOOL init_functions(void)
SET
(
WindowsPromoteStringBuffer
);
SET
(
WindowsStringHasEmbeddedNull
);
SET
(
WindowsSubstring
);
SET
(
WindowsSubstringWithSpecifiedLength
);
return
TRUE
;
}
...
...
@@ -249,6 +251,9 @@ static void test_substring(void)
ok
(
pWindowsSubstring
(
str
,
2
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
check_string
(
substr
,
output_substring
,
4
,
FALSE
);
ok
(
pWindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
pWindowsSubstringWithSpecifiedLength
(
str
,
2
,
3
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
check_string
(
substr
,
output_substring
,
3
,
FALSE
);
ok
(
pWindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
pWindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test duplication of string using substring */
...
...
@@ -257,6 +262,10 @@ static void test_substring(void)
ok
(
str
!=
substr
,
"Duplicated string didn't create new string
\n
"
);
check_string
(
substr
,
input_string
,
6
,
FALSE
);
ok
(
pWindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
pWindowsSubstringWithSpecifiedLength
(
str
,
0
,
6
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
ok
(
str
!=
substr
,
"Duplicated string didn't create new string
\n
"
);
check_string
(
substr
,
input_string
,
6
,
FALSE
);
ok
(
pWindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
pWindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test substring of string reference */
...
...
@@ -264,6 +273,9 @@ static void test_substring(void)
ok
(
pWindowsSubstring
(
str
,
2
,
&
substr
)
==
S_OK
,
"Failed to create substring of string ref
\n
"
);
check_string
(
substr
,
output_substring
,
4
,
FALSE
);
ok
(
pWindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
pWindowsSubstringWithSpecifiedLength
(
str
,
2
,
3
,
&
substr
)
==
S_OK
,
"Failed to create substring of string ref
\n
"
);
check_string
(
substr
,
output_substring
,
3
,
FALSE
);
ok
(
pWindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
pWindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
/* Test duplication of string reference using substring */
...
...
@@ -272,26 +284,38 @@ static void test_substring(void)
ok
(
str
!=
substr
,
"Duplicated string ref didn't create new string
\n
"
);
check_string
(
substr
,
input_string
,
6
,
FALSE
);
ok
(
pWindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
pWindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
pWindowsSubstringWithSpecifiedLength
(
str
,
0
,
6
,
&
substr
)
==
S_OK
,
"Failed to create substring of string ref
\n
"
);
ok
(
str
!=
substr
,
"Duplicated string ref didn't create new string
\n
"
);
check_string
(
substr
,
input_string
,
6
,
FALSE
);
ok
(
pWindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
pWindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
/* Test get substring of empty string */
ok
(
pWindowsSubstring
(
NULL
,
0
,
&
substr
)
==
S_OK
,
"Failed to duplicate NULL string
\n
"
);
ok
(
substr
==
NULL
,
"Substring created new string
\n
"
);
ok
(
pWindowsSubstringWithSpecifiedLength
(
NULL
,
0
,
0
,
&
substr
)
==
S_OK
,
"Failed to duplicate NULL string
\n
"
);
ok
(
substr
==
NULL
,
"Substring created new string
\n
"
);
/* Test get empty substring of string */
ok
(
pWindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
pWindowsSubstring
(
str
,
6
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
ok
(
substr
==
NULL
,
"Substring created new string
\n
"
);
ok
(
pWindowsSubstringWithSpecifiedLength
(
str
,
6
,
0
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
ok
(
substr
==
NULL
,
"Substring created new string
\n
"
);
ok
(
pWindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test handling of using too high start index */
/* Test handling of using too high start index
or length
*/
ok
(
pWindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
pWindowsSubstring
(
str
,
7
,
&
substr
)
==
E_BOUNDS
,
"Incorrect error handling
\n
"
);
ok
(
pWindowsSubstringWithSpecifiedLength
(
str
,
7
,
0
,
&
substr
)
==
E_BOUNDS
,
"Incorrect error handling
\n
"
);
ok
(
pWindowsSubstringWithSpecifiedLength
(
str
,
6
,
1
,
&
substr
)
==
E_BOUNDS
,
"Incorrect error handling
\n
"
);
ok
(
pWindowsSubstringWithSpecifiedLength
(
str
,
7
,
~
0U
,
&
substr
)
==
E_BOUNDS
,
"Incorrect error handling
\n
"
);
ok
(
pWindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test handling of a NULL string */
ok
(
pWindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
pWindowsSubstring
(
str
,
7
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
pWindowsSubstringWithSpecifiedLength
(
str
,
7
,
0
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
pWindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\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