From: Jinoh Kang Subject: [PATCH 1/5] iphlpapi/tests: Add tests for GetBestInterface. Message-Id: <0bb93cc2-7aa8-2c1a-c234-494f421f772c@gmail.com> Date: Sun, 16 Jan 2022 01:32:31 +0900 Signed-off-by: Jinoh Kang --- dlls/iphlpapi/tests/iphlpapi.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index 12da629c30c..f9044c685c5 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -1456,9 +1456,32 @@ static void testGetNetworkParams(void) } } +static void testGetBestInterface(void) +{ + DWORD apiReturn; + DWORD bestIfIndex; + + apiReturn = GetBestInterface( INADDR_ANY, &bestIfIndex ); + trace( "GetBestInterface([0.0.0.0], {%u}) = %u\n", bestIfIndex, apiReturn ); + if (apiReturn == ERROR_NOT_SUPPORTED) + { + skip( "GetBestInterface is not supported\n" ); + return; + } + + apiReturn = GetBestInterface( INADDR_LOOPBACK, NULL ); + ok( apiReturn == ERROR_INVALID_PARAMETER, + "GetBestInterface([127.0.0.1], NULL) returned %u, expected %u\n", + apiReturn, ERROR_INVALID_PARAMETER ); + + apiReturn = GetBestInterface( INADDR_LOOPBACK, &bestIfIndex ); + ok( apiReturn == NO_ERROR, + "GetBestInterface([127.0.0.1], {%u}) returned %u, expected %u\n", + bestIfIndex, apiReturn, NO_ERROR ); +} + /* still-to-be-tested 98-onward functions: -GetBestInterface GetBestRoute IpReleaseAddress IpRenewAddress @@ -1468,6 +1491,7 @@ static DWORD CALLBACK testWin98Functions(void *p) testGetInterfaceInfo(); testGetAdaptersInfo(); testGetNetworkParams(); + testGetBestInterface(); return 0; } -- 2.31.1