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
f3827dab
Commit
f3827dab
authored
Feb 10, 2016
by
Sebastian Lackner
Committed by
Alexandre Julliard
Feb 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
combase/tests: Add tests for WindowsCompareStringOrdinal.
Signed-off-by:
Sebastian Lackner
<
sebastian@fds-team.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e39405d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
string.c
dlls/combase/tests/string.c
+63
-0
No files found.
dlls/combase/tests/string.c
View file @
f3827dab
...
...
@@ -27,6 +27,7 @@
#include "wine/test.h"
static
HRESULT
(
WINAPI
*
pWindowsCompareStringOrdinal
)(
HSTRING
,
HSTRING
,
INT32
*
);
static
HRESULT
(
WINAPI
*
pWindowsConcatString
)(
HSTRING
,
HSTRING
,
HSTRING
*
);
static
HRESULT
(
WINAPI
*
pWindowsCreateString
)(
LPCWSTR
,
UINT32
,
HSTRING
*
);
static
HRESULT
(
WINAPI
*
pWindowsCreateStringReference
)(
LPCWSTR
,
UINT32
,
HSTRING_HEADER
*
,
HSTRING
*
);
...
...
@@ -52,6 +53,7 @@ static BOOL init_functions(void)
win_skip
(
"Failed to load combase.dll, skipping tests
\n
"
);
return
FALSE
;
}
SET
(
WindowsCompareStringOrdinal
);
SET
(
WindowsConcatString
);
SET
(
WindowsCreateString
);
SET
(
WindowsCreateStringReference
);
...
...
@@ -394,6 +396,66 @@ static void test_concat(void)
ok
(
concat
==
NULL
,
"Concatenate created new string
\n
"
);
}
static
void
test_compare
(
void
)
{
HSTRING
str1
,
str2
;
HSTRING_HEADER
header1
,
header2
;
INT32
res
;
/* Test comparison of string buffers */
ok
(
pWindowsCreateString
(
input_string1
,
3
,
&
str1
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
pWindowsCreateString
(
input_string2
,
3
,
&
str2
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
pWindowsCompareStringOrdinal
(
str1
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
ok
(
pWindowsCompareStringOrdinal
(
str1
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
pWindowsCompareStringOrdinal
(
str2
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
pWindowsCompareStringOrdinal
(
str2
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
ok
(
pWindowsCompareStringOrdinal
(
str1
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
pWindowsCompareStringOrdinal
(
NULL
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
pWindowsCompareStringOrdinal
(
str2
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
pWindowsCompareStringOrdinal
(
NULL
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
pWindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
pWindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test comparison of string references */
ok
(
pWindowsCreateStringReference
(
input_string1
,
3
,
&
header1
,
&
str1
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
pWindowsCreateStringReference
(
input_string2
,
3
,
&
header2
,
&
str2
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
pWindowsCompareStringOrdinal
(
str1
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
ok
(
pWindowsCompareStringOrdinal
(
str1
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
pWindowsCompareStringOrdinal
(
str2
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
pWindowsCompareStringOrdinal
(
str2
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
ok
(
pWindowsCompareStringOrdinal
(
str1
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
pWindowsCompareStringOrdinal
(
NULL
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
pWindowsCompareStringOrdinal
(
str2
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
pWindowsCompareStringOrdinal
(
NULL
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
pWindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
pWindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
/* Test comparison of two empty strings */
ok
(
pWindowsCompareStringOrdinal
(
NULL
,
NULL
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
pWindowsCompareStringOrdinal
(
NULL
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare NULL string
\n
"
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
}
START_TEST
(
string
)
{
if
(
!
init_functions
())
...
...
@@ -404,4 +466,5 @@ START_TEST(string)
test_string_buffer
();
test_substring
();
test_concat
();
test_compare
();
}
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