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

Jinoh Kang wine at gitlab.winehq.org
Tue Jun 21 15:45:28 CDT 2022


From: Jinoh Kang <jinoh.kang.kr at gmail.com>

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 af5450f3ab7..9890df70e0e 100644
--- a/dlls/iphlpapi/tests/iphlpapi.c
+++ b/dlls/iphlpapi/tests/iphlpapi.c
@@ -1481,9 +1481,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, [...]) = %lu\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 %lu, expected %d\n",
+        apiReturn, ERROR_INVALID_PARAMETER );
+
+    apiReturn = GetBestRoute( INADDR_LOOPBACK, 0, &bestRoute );
+    ok( apiReturn == NO_ERROR,
+        "GetBestRoute([127.0.0.1], 0, NULL) returned %lu, expected %d\n",
+        apiReturn, NO_ERROR );
+}
+
 /*
 still-to-be-tested 98-onward functions:
-GetBestRoute
 IpReleaseAddress
 IpRenewAddress
 */
@@ -1493,6 +1516,7 @@ static DWORD CALLBACK testWin98Functions(void *p)
   testGetAdaptersInfo();
   testGetNetworkParams();
   testGetBestInterface();
+  testGetBestRoute();
   return 0;
 }
 
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/266



More information about the wine-devel mailing list