ReactOS 0.4.15-dev-7897-g78dc504
record.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "windns.h"
#include "wine/test.h"
Include dependency graph for record.c:

Go to the source code of this file.

Functions

static void test_DnsRecordCompare (void)
 
static void test_DnsRecordSetCompare (void)
 
static void test_DnsRecordSetDetach (void)
 
 START_TEST (record)
 

Variables

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_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 } } }
 

Function Documentation

◆ START_TEST()

START_TEST ( record  )

Definition at line 144 of file record.c.

145{
149}
static void test_DnsRecordCompare(void)
Definition: record.c:41
static void test_DnsRecordSetCompare(void)
Definition: record.c:64
static void test_DnsRecordSetDetach(void)
Definition: record.c:123

◆ test_DnsRecordCompare()

static void test_DnsRecordCompare ( void  )
static

Definition at line 41 of file record.c.

42{
43 ok( DnsRecordCompare( &r1, &r1 ) == TRUE, "failed unexpectedly\n" );
44
45 r2.pName = name2;
46 ok( DnsRecordCompare( &r1, &r2 ) == TRUE, "failed unexpectedly\n" );
47
49 ok( DnsRecordCompare( &r1, &r2 ) == TRUE, "failed unexpectedly\n" );
50
52 ok( DnsRecordCompare( &r1, &r2 ) == TRUE, "failed unexpectedly\n" );
53
55 ok( DnsRecordCompare( &r1, &r2 ) == TRUE, "failed unexpectedly\n" );
56
57 r1.dwTtl = 0;
58 ok( DnsRecordCompare( &r1, &r2 ) == TRUE, "failed unexpectedly\n" );
59
60 r2.Data.A.IpAddress = 0;
61 ok( DnsRecordCompare( &r1, &r2 ) == FALSE, "succeeded unexpectedly\n" );
62}
#define ok(value,...)
Definition: atltest.h:57
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI DnsRecordCompare(PDNS_RECORD r1, PDNS_RECORD r2)
Definition: record.c:104
static DNS_RECORDW r1
Definition: record.c:37
static DNS_RECORDW r2
Definition: record.c:38
static WCHAR name2[]
Definition: record.c:35
IP4_ADDRESS IpAddress
Definition: windns.h:246
DWORD CharSet
Definition: windns.h:240
union _DnsRecordW::@3309 Flags
LPWSTR pName
Definition: windns.h:599
DNS_A_DATA A
Definition: windns.h:609
union _DnsRecordW::@3310 Data
DNS_RECORD_FLAGS S
Definition: windns.h:604
DWORD dwTtl
Definition: windns.h:606
@ DnsCharSetUnicode
Definition: windns.h:111
@ DnsCharSetAnsi
Definition: windns.h:113

Referenced by START_TEST().

◆ test_DnsRecordSetCompare()

static void test_DnsRecordSetCompare ( void  )
static

Definition at line 64 of file record.c.

65{
66 DNS_RECORDW *diff1;
67 DNS_RECORDW *diff2;
68 DNS_RRSET rr1, rr2;
69
70 r1.Flags.DW = 0x2019;
71 r2.Flags.DW = 0x2019;
72 r2.Data.A.IpAddress = 0xffffffff;
73
74 DNS_RRSET_INIT( rr1 );
75 DNS_RRSET_INIT( rr2 );
76
77 DNS_RRSET_ADD( rr1, &r1 );
78 DNS_RRSET_ADD( rr2, &r2 );
79
82
83 ok( DnsRecordSetCompare( NULL, NULL, NULL, NULL ) == FALSE, "succeeded unexpectedly\n" );
84 ok( DnsRecordSetCompare( rr1.pFirstRR, NULL, NULL, NULL ) == FALSE, "succeeded unexpectedly\n" );
85 ok( DnsRecordSetCompare( NULL, rr2.pFirstRR, NULL, NULL ) == FALSE, "succeeded unexpectedly\n" );
86
87 diff1 = NULL;
88 diff2 = NULL;
89
90 ok( DnsRecordSetCompare( NULL, NULL, &diff1, &diff2 ) == FALSE, "succeeded unexpectedly\n" );
91 ok( diff1 == NULL && diff2 == NULL, "unexpected result: %p, %p\n", diff1, diff2 );
92
93 ok( DnsRecordSetCompare( rr1.pFirstRR, NULL, &diff1, &diff2 ) == FALSE, "succeeded unexpectedly\n" );
94 ok( diff1 != NULL && diff2 == NULL, "unexpected result: %p, %p\n", diff1, diff2 );
96
97 ok( DnsRecordSetCompare( NULL, rr2.pFirstRR, &diff1, &diff2 ) == FALSE, "succeeded unexpectedly\n" );
98 ok( diff1 == NULL && diff2 != NULL, "unexpected result: %p, %p\n", diff1, diff2 );
100
101 ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, NULL, &diff2 ) == TRUE, "failed unexpectedly\n" );
102 ok( diff2 == NULL, "unexpected result: %p\n", diff2 );
103
104 ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, &diff1, NULL ) == TRUE, "failed unexpectedly\n" );
105 ok( diff1 == NULL, "unexpected result: %p\n", diff1 );
106
107 ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, &diff1, &diff2 ) == TRUE, "failed unexpectedly\n" );
108 ok( diff1 == NULL && diff2 == NULL, "unexpected result: %p, %p\n", diff1, diff2 );
109
110 r2.Data.A.IpAddress = 0;
111
112 ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, NULL, &diff2 ) == FALSE, "succeeded unexpectedly\n" );
114
115 ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, &diff1, NULL ) == FALSE, "succeeded unexpectedly\n" );
117
118 ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, &diff1, &diff2 ) == FALSE, "succeeded unexpectedly\n" );
121}
#define NULL
Definition: types.h:112
VOID WINAPI DnsRecordListFree(PDNS_RECORD list, DNS_FREE_TYPE type)
Definition: record.c:526
BOOL WINAPI DnsRecordSetCompare(PDNS_RECORD set1, PDNS_RECORD set2, PDNS_RECORD *diff1, PDNS_RECORD *diff2)
Definition: record.c:627
PDNS_RECORD pFirstRR
Definition: windns.h:640
DWORD DW
Definition: windns.h:603
#define DNS_RRSET_TERMINATE(rrset)
Definition: windns.h:659
@ DnsFreeRecordList
Definition: windns.h:139
#define DNS_RRSET_ADD(rrset, pnewRR)
Definition: windns.h:651
#define DNS_RRSET_INIT(rrset)
Definition: windns.h:644

Referenced by START_TEST().

◆ test_DnsRecordSetDetach()

static void test_DnsRecordSetDetach ( void  )
static

Definition at line 123 of file record.c.

124{
125 DNS_RRSET rr;
126 DNS_RECORDW *r, *s;
127
128 DNS_RRSET_INIT( rr );
129 DNS_RRSET_ADD( rr, &r1 );
130 DNS_RRSET_ADD( rr, &r2 );
131 DNS_RRSET_ADD( rr, &r3 );
133
134 ok( !DnsRecordSetDetach( NULL ), "succeeded unexpectedly\n" );
135
136 r = rr.pFirstRR;
138
139 ok( s == &r3, "failed unexpectedly: got %p, expected %p\n", s, &r3 );
140 ok( r == &r1, "failed unexpectedly: got %p, expected %p\n", r, &r1 );
141 ok( !r2.pNext, "failed unexpectedly\n" );
142}
PDNS_RECORD WINAPI DnsRecordSetDetach(PDNS_RECORD set)
Definition: record.c:741
GLdouble s
Definition: gl.h:2039
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static DNS_RECORDW r3
Definition: record.c:39
struct _DnsRecordW * pNext
Definition: windns.h:598

Referenced by START_TEST().

Variable Documentation

◆ name1

◆ name2

◆ r1

◆ r2

◆ r3

DNS_RECORDW r3 = { NULL, name1, DNS_TYPE_A, sizeof(DNS_A_DATA), { 0 }, 1200, 0, { { 0xffffffff } } }
static