]>
git.saurik.com Git - apple/mdnsresponder.git/blob - unittests/DNSMessageTest.c
1 #include "mDNSEmbeddedAPI.h"
2 #include "DNSMessageTest.h"
3 #include "../mDNSCore/DNSCommon.h"
6 int InitializeTest(void);
7 int PutDomainNameAsLabels(void);
15 UNITTEST_HEADER(DNSMessageTest
)
16 UNITTEST_TEST(SizeTest
)
17 UNITTEST_TEST(InitializeTest
)
18 UNITTEST_TEST(Finalize
)
22 UNITTEST_HEADER(SizeTest
)
23 msg
= (DNSMessage
*)malloc (sizeof(DNSMessage
));
24 UNITTEST_ASSERT_RETURN(msg
!= NULL
);
26 // message header should be 12 bytes
27 UNITTEST_ASSERT(sizeof(msg
->h
) == 12);
31 UNITTEST_HEADER(InitializeTest
)
32 // Initialize the message
33 InitializeDNSMessage(&msg
->h
, onesID
, QueryFlags
);
35 // Check that the message is initialized properly
36 UNITTEST_ASSERT(msg
->h
.numAdditionals
== 0);
37 UNITTEST_ASSERT(msg
->h
.numAnswers
== 0);
38 UNITTEST_ASSERT(msg
->h
.numQuestions
== 0);
39 UNITTEST_ASSERT(msg
->h
.numAuthorities
== 0);
43 UNITTEST_HEADER(PutDomainNameAsLabels
)
47 UNITTEST_HEADER(Finalize
)
48 UNITTEST_ASSERT_RETURN(msg
!= NULL
)