2 * Copyright (c) 2017-2018 Apple Inc. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "mDNSEmbeddedAPI.h"
18 #include "DNSCommon.h"
19 #import <XCTest/XCTest.h>
21 @interface DNSMessageTest : XCTestCase
27 @implementation DNSMessageTest
31 msg = (DNSMessage *)malloc (sizeof(DNSMessage));
32 XCTAssert(msg != NULL);
34 // message header should be 12 bytes
35 XCTAssertEqual(sizeof(msg->h), 12);
40 XCTAssert(msg != NULL);
44 - (void)testMessageInitialization
46 // Initialize the message
47 InitializeDNSMessage(&msg->h, onesID, QueryFlags);
49 // Check that the message is initialized properly
50 XCTAssertEqual(msg->h.numAdditionals, 0);
51 XCTAssertEqual(msg->h.numAnswers, 0);
52 XCTAssertEqual(msg->h.numQuestions, 0);
53 XCTAssertEqual(msg->h.numAuthorities, 0);
57 - (void)testPerformanceExample {
58 // This is an example of a performance test case.
60 // Put the code you want to measure the time of here.