[PATCH 2/5] iphlpapi/tests: Add tests for GetBestRoute.

Jinoh Kang jinoh.kang.kr at gmail.com
Sat Jan 15 10:33:30 CST 2022


Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---
 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




More information about the wine-devel mailing list