[PATCH 1/5] iphlpapi/tests: Add tests for GetBestInterface.

Jinoh Kang jinoh.kang.kr at gmail.com
Sat Jan 15 10:32:31 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 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




More information about the wine-devel mailing list