From: Jinoh Kang Subject: [PATCH 2/5] iphlpapi/tests: Add tests for GetBestRoute. Message-Id: Date: Sun, 16 Jan 2022 01:33:30 +0900 In-Reply-To: <0bb93cc2-7aa8-2c1a-c234-494f421f772c@gmail.com> References: <0bb93cc2-7aa8-2c1a-c234-494f421f772c@gmail.com> 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 f9044c685c5..6f93d751ac7 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -1480,9 +1480,32 @@ static void testGetBestInterface(void) bestIfIndex, apiReturn, NO_ERROR ); } +static void testGetBestRoute(void) +{ + DWORD apiReturn; + MIB_IPFORWARDROW bestRoute; + + apiReturn = GetBestRoute( INADDR_ANY, 0, &bestRoute ); + trace( "GetBestRoute([0.0.0.0], 0, [...]) = %u\n", apiReturn ); + if (apiReturn == ERROR_NOT_SUPPORTED) + { + skip( "GetBestRoute is not supported\n" ); + return; + } + + apiReturn = GetBestRoute( INADDR_ANY, 0, NULL ); + ok( apiReturn == ERROR_INVALID_PARAMETER, + "GetBestRoute([0.0.0.0], 0, NULL) returned %u, expected %u\n", + apiReturn, ERROR_INVALID_PARAMETER ); + + apiReturn = GetBestRoute( INADDR_LOOPBACK, 0, &bestRoute ); + ok( apiReturn == NO_ERROR, + "GetBestRoute([127.0.0.1], 0, NULL) returned %u, expected %u\n", + apiReturn, NO_ERROR ); +} + /* still-to-be-tested 98-onward functions: -GetBestRoute IpReleaseAddress IpRenewAddress */ @@ -1492,6 +1515,7 @@ static DWORD CALLBACK testWin98Functions(void *p) testGetAdaptersInfo(); testGetNetworkParams(); testGetBestInterface(); + testGetBestRoute(); return 0; } -- 2.31.1