[DNSAPI_WINETEST] Sync with Wine Staging 1.9.4. CORE-10912
authorAmine Khaldi <amine.khaldi@reactos.org>
Sun, 6 Mar 2016 16:50:59 +0000 (16:50 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 6 Mar 2016 16:50:59 +0000 (16:50 +0000)
svn path=/trunk/; revision=70963

rostests/winetests/dnsapi/name.c
rostests/winetests/dnsapi/record.c

index b52adcc..bdbfa73 100644 (file)
@@ -27,6 +27,8 @@
 //#include "winnls.h"
 #include <windns.h>
 
+BOOL WINAPI DnsFlushResolverCacheEntry_A(PCSTR);
+
 static const struct
 {
     LPCSTR name;
@@ -154,22 +156,22 @@ static void test_DnsValidateName_A( void )
 
 static void test_DnsNameCompare_A( void )
 {
-    static CHAR empty[]          = "",
-                dot[]            = ".",
-                dotdot[]         = "..",
-                A[]              = "A",
-                a[]              = "a",
-                B[]              = "B",
-                b[]              = "b",
-                A_dot_B[]        = "A.B",
-                a_dot_a[]        = "a.a",
-                a_dot_b[]        = "a.b",
-                a_dot_b_dot[]    = "a.b.",
-                a_dot_b_dotdot[] = "a.b..",
-                B_dot_A[]        = "B.A",
-                b_dot_a[]        = "b.a",
-                b_dot_a_dot[]    = "b.a.",
-                b_dot_a_dotdot[] = "b.a..";
+    static const CHAR empty[]          = "",
+                      dot[]            = ".",
+                      dotdot[]         = "..",
+                      A[]              = "A",
+                      a[]              = "a",
+                      B[]              = "B",
+                      b[]              = "b",
+                      A_dot_B[]        = "A.B",
+                      a_dot_a[]        = "a.a",
+                      a_dot_b[]        = "a.b",
+                      a_dot_b_dot[]    = "a.b.",
+                      a_dot_b_dotdot[] = "a.b..",
+                      B_dot_A[]        = "B.A",
+                      b_dot_a[]        = "b.a",
+                      b_dot_a_dot[]    = "b.a.",
+                      b_dot_a_dotdot[] = "b.a..";
 
     ok( DnsNameCompare_A( NULL, NULL ) == TRUE, "failed unexpectedly\n" );
 
@@ -202,8 +204,27 @@ static void test_DnsNameCompare_A( void )
     ok( DnsNameCompare_A( a_dot_b, b_dot_a_dot ) == FALSE, "succeeded unexpectedly\n" );
 }
 
+static void test_DnsFlushResolverCacheEntry_A(void)
+{
+    BOOL ret;
+    DWORD err;
+
+    SetLastError( 0xdeadbeef );
+    ret = DnsFlushResolverCacheEntry_A( NULL );
+    err = GetLastError();
+    ok( !ret, "got %d\n", ret );
+    ok( err == 0xdeadbeef, "got %u\n", err );
+
+    ret = DnsFlushResolverCacheEntry_A( "localhost" );
+    ok( ret, "got %d\n", ret );
+
+    ret = DnsFlushResolverCacheEntry_A( "nxdomain.test.winehq.org" );
+    ok( ret, "got %d\n", ret );
+}
+
 START_TEST(name)
 {
     test_DnsValidateName_A();
     test_DnsNameCompare_A();
+    test_DnsFlushResolverCacheEntry_A();
 }
index 7588660..440ba5c 100644 (file)
@@ -18,6 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#define UNICODE
+
 #include <wine/test.h>
 
 //#include <stdarg.h>
 //#include "winnls.h"
 #include <windns.h>
 
-static char name1[] = "localhost";
-static char name2[] = "LOCALHOST";
+static WCHAR name1[] = {'l','o','c','a','l','h','o','s','t',0};
+static WCHAR name2[] = {'L','O','C','A','L','H','O','S','T',0};
 
-static DNS_RECORDA r1 = { NULL, name1, DNS_TYPE_A, sizeof(DNS_A_DATA), { 0 }, 1200, 0, { { 0xffffffff } } };
-static DNS_RECORDA r2 = { NULL, name1, DNS_TYPE_A, sizeof(DNS_A_DATA), { 0 }, 1200, 0, { { 0xffffffff } } };
-static DNS_RECORDA r3 = { NULL, name1, DNS_TYPE_A, sizeof(DNS_A_DATA), { 0 }, 1200, 0, { { 0xffffffff } } };
+static DNS_RECORDW r1 = { NULL, name1, DNS_TYPE_A, sizeof(DNS_A_DATA), { 0 }, 1200, 0, { { 0xffffffff } } };
+static DNS_RECORDW r2 = { NULL, name1, DNS_TYPE_A, sizeof(DNS_A_DATA), { 0 }, 1200, 0, { { 0xffffffff } } };
+static DNS_RECORDW r3 = { NULL, name1, DNS_TYPE_A, sizeof(DNS_A_DATA), { 0 }, 1200, 0, { { 0xffffffff } } };
 
 static void test_DnsRecordCompare( void )
 {
@@ -43,10 +45,10 @@ static void test_DnsRecordCompare( void )
     ok( DnsRecordCompare( &r1, &r2 ) == TRUE, "failed unexpectedly\n" );
 
     r2.Flags.S.CharSet = DnsCharSetUnicode;
-    ok( DnsRecordCompare( &r1, &r2 ) == FALSE, "succeeded unexpectedly\n" );
+    ok( DnsRecordCompare( &r1, &r2 ) == TRUE, "failed unexpectedly\n" );
 
     r2.Flags.S.CharSet = DnsCharSetAnsi;
-    ok( DnsRecordCompare( &r1, &r2 ) == FALSE, "succeeded unexpectedly\n" );
+    ok( DnsRecordCompare( &r1, &r2 ) == TRUE, "failed unexpectedly\n" );
 
     r1.Flags.S.CharSet = DnsCharSetAnsi;
     ok( DnsRecordCompare( &r1, &r2 ) == TRUE, "failed unexpectedly\n" );
@@ -60,8 +62,8 @@ static void test_DnsRecordCompare( void )
 
 static void test_DnsRecordSetCompare( void )
 {
-    DNS_RECORD *diff1;
-    DNS_RECORD *diff2;
+    DNS_RECORDW *diff1;
+    DNS_RECORDW *diff2;
     DNS_RRSET rr1, rr2;
 
     r1.Flags.DW = 0x2019;
@@ -120,7 +122,7 @@ static void test_DnsRecordSetCompare( void )
 static void test_DnsRecordSetDetach( void )
 {
     DNS_RRSET rr;
-    DNS_RECORDA *r, *s;
+    DNS_RECORDW *r, *s;
 
     DNS_RRSET_INIT( rr );
     DNS_RRSET_ADD( rr, &r1 );