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
59d281ee
Commit
59d281ee
authored
Jan 16, 2022
by
Jinoh Kang
Committed by
Alexandre Julliard
Jun 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi/tests: Add tests for GetBestInterfaceEx.
Signed-off-by:
Jinoh Kang
<
jinoh.kang.kr@gmail.com
>
parent
ac9842bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
iphlpapi.c
dlls/iphlpapi/tests/iphlpapi.c
+57
-0
No files found.
dlls/iphlpapi/tests/iphlpapi.c
View file @
59d281ee
...
...
@@ -1481,6 +1481,62 @@ static void testGetBestInterface(void)
bestIfIndex
,
apiReturn
,
NO_ERROR
);
}
static
void
testGetBestInterfaceEx
(
void
)
{
DWORD
apiReturn
;
DWORD
bestIfIndex
=
0
;
struct
sockaddr_in
destAddr
;
memset
(
&
destAddr
,
0
,
sizeof
(
struct
sockaddr_in
));
destAddr
.
sin_family
=
AF_INET
;
destAddr
.
sin_addr
.
S_un
.
S_addr
=
INADDR_ANY
;
apiReturn
=
GetBestInterfaceEx
(
(
struct
sockaddr
*
)
&
destAddr
,
&
bestIfIndex
);
trace
(
"GetBestInterfaceEx([0.0.0.0], {%lu}) = %lu
\n
"
,
bestIfIndex
,
apiReturn
);
if
(
apiReturn
==
ERROR_NOT_SUPPORTED
)
{
skip
(
"GetBestInterfaceEx not supported
\n
"
);
return
;
}
apiReturn
=
GetBestInterfaceEx
(
NULL
,
NULL
);
ok
(
apiReturn
==
ERROR_INVALID_PARAMETER
,
"GetBestInterfaceEx(NULL, NULL) returned %lu, expected %d
\n
"
,
apiReturn
,
ERROR_INVALID_PARAMETER
);
apiReturn
=
GetBestInterfaceEx
(
NULL
,
&
bestIfIndex
);
ok
(
apiReturn
==
ERROR_INVALID_PARAMETER
,
"GetBestInterfaceEx(NULL, {%lu}) returned %lu, expected %d
\n
"
,
bestIfIndex
,
apiReturn
,
ERROR_INVALID_PARAMETER
);
memset
(
&
destAddr
,
0
,
sizeof
(
struct
sockaddr_in
));
apiReturn
=
GetBestInterfaceEx
(
(
struct
sockaddr
*
)
&
destAddr
,
NULL
);
ok
(
apiReturn
==
ERROR_INVALID_PARAMETER
,
"GetBestInterfaceEx(<AF_UNSPEC>, NULL) returned %lu, expected %d
\n
"
,
apiReturn
,
ERROR_INVALID_PARAMETER
);
memset
(
&
destAddr
,
-
1
,
sizeof
(
struct
sockaddr_in
));
apiReturn
=
GetBestInterfaceEx
(
(
struct
sockaddr
*
)
&
destAddr
,
NULL
);
ok
(
apiReturn
==
ERROR_INVALID_PARAMETER
,
"GetBestInterfaceEx(<INVALID>, NULL) returned %lu, expected %d
\n
"
,
apiReturn
,
ERROR_INVALID_PARAMETER
);
memset
(
&
destAddr
,
0
,
sizeof
(
struct
sockaddr_in
));
destAddr
.
sin_family
=
AF_INET
;
destAddr
.
sin_addr
.
S_un
.
S_addr
=
INADDR_LOOPBACK
;
apiReturn
=
GetBestInterfaceEx
(
(
struct
sockaddr
*
)
&
destAddr
,
NULL
);
ok
(
apiReturn
==
ERROR_INVALID_PARAMETER
,
"GetBestInterfaceEx([127.0.0.1], NULL) returned %lu, expected %d
\n
"
,
apiReturn
,
ERROR_INVALID_PARAMETER
);
memset
(
&
destAddr
,
0
,
sizeof
(
struct
sockaddr_in
));
destAddr
.
sin_family
=
AF_INET
;
destAddr
.
sin_addr
.
S_un
.
S_addr
=
INADDR_LOOPBACK
;
apiReturn
=
GetBestInterfaceEx
(
(
struct
sockaddr
*
)
&
destAddr
,
&
bestIfIndex
);
ok
(
apiReturn
==
NO_ERROR
,
"GetBestInterfaceEx([127.0.0.1], {%lu}) returned %lu, expected %d
\n
"
,
bestIfIndex
,
apiReturn
,
ERROR_INVALID_PARAMETER
);
}
static
void
testGetBestRoute
(
void
)
{
DWORD
apiReturn
;
...
...
@@ -1516,6 +1572,7 @@ static DWORD CALLBACK testWin98Functions(void *p)
testGetAdaptersInfo
();
testGetNetworkParams
();
testGetBestInterface
();
testGetBestInterfaceEx
();
testGetBestRoute
();
return
0
;
}
...
...
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