Training courses
Kernel and Embedded Linux
Bootlin training courses
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
#include "mDNSEmbeddedAPI.h" #include "DNSMessageTest.h" #include "../mDNSCore/DNSCommon.h" int SizeTest(void); int InitializeTest(void); int PutDomainNameAsLabels(void); int PutRData(void); int Finalize(void); DNSMessage *msg; UNITTEST_HEADER(DNSMessageTest) UNITTEST_TEST(SizeTest) UNITTEST_TEST(InitializeTest) UNITTEST_TEST(Finalize) UNITTEST_FOOTER UNITTEST_HEADER(SizeTest) msg = (DNSMessage *)malloc (sizeof(DNSMessage)); UNITTEST_ASSERT_RETURN(msg != NULL); // message header should be 12 bytes UNITTEST_ASSERT(sizeof(msg->h) == 12); UNITTEST_FOOTER UNITTEST_HEADER(InitializeTest) // Initialize the message InitializeDNSMessage(&msg->h, onesID, QueryFlags); // Check that the message is initialized properly UNITTEST_ASSERT(msg->h.numAdditionals == 0); UNITTEST_ASSERT(msg->h.numAnswers == 0); UNITTEST_ASSERT(msg->h.numQuestions == 0); UNITTEST_ASSERT(msg->h.numAuthorities == 0); UNITTEST_FOOTER UNITTEST_HEADER(PutDomainNameAsLabels) UNITTEST_FOOTER UNITTEST_HEADER(Finalize) UNITTEST_ASSERT_RETURN(msg != NULL) free(msg);