2 * Tests for record handling functions
4 * Copyright 2006 Hans Leidekker
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "wine/test.h"
30 static HMODULE dnsapi;
32 static BOOL (WINAPI *pDnsRecordCompare)(PDNS_RECORD,PDNS_RECORD);
34 #define GETFUNCPTR(func) p##func = (void *)GetProcAddress( dnsapi, #func ); \
35 if (!p##func) return FALSE;
37 static BOOL init_function_ptrs( void )
39 GETFUNCPTR( DnsRecordCompare )
43 static void test_DnsRecordCompare( void )
45 char name1[] = "localhost";
46 char name2[] = "LOCALHOST";
47 static DNS_RECORDA r1, r2;
50 r1.wType = DNS_TYPE_A;
51 r1.wDataLength = sizeof(DNS_A_DATA);
52 r1.Data.A.IpAddress = 0xffffffff;
55 r2.wType = DNS_TYPE_A;
56 r2.wDataLength = sizeof(DNS_A_DATA);
57 r2.Data.A.IpAddress = 0xffffffff;
59 ok( pDnsRecordCompare( (PDNS_RECORD)&r1, (PDNS_RECORD)&r1 ) == TRUE, "failed unexpectedly\n" );
62 ok( pDnsRecordCompare( (PDNS_RECORD)&r1, (PDNS_RECORD)&r2 ) == TRUE, "failed unexpectedly\n" );
64 r2.Flags.S.CharSet = DnsCharSetUnicode;
65 ok( pDnsRecordCompare( (PDNS_RECORD)&r1, (PDNS_RECORD)&r2 ) == FALSE, "succeeded unexpectedly\n" );
67 r2.Flags.S.CharSet = DnsCharSetAnsi;
68 ok( pDnsRecordCompare( (PDNS_RECORD)&r1, (PDNS_RECORD)&r2 ) == FALSE, "succeeded unexpectedly\n" );
70 r1.Flags.S.CharSet = DnsCharSetAnsi;
71 ok( pDnsRecordCompare( (PDNS_RECORD)&r1, (PDNS_RECORD)&r2 ) == TRUE, "failed unexpectedly\n" );
73 r2.Data.A.IpAddress = 0;
74 ok( pDnsRecordCompare( (PDNS_RECORD)&r1, (PDNS_RECORD)&r2 ) == FALSE, "succeeded unexpectedly\n" );
79 dnsapi = LoadLibraryA( "dnsapi.dll" );
82 if (!init_function_ptrs())
84 FreeLibrary( dnsapi );
88 test_DnsRecordCompare();
90 FreeLibrary( dnsapi );