- Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathTestHost.swift
54 lines (44 loc) · 1.8 KB
/
TestHost.swift
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
50
51
52
53
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
classTestHost:XCTestCase{
// SR-6391
func test_addressesDoNotGrow(){
letlocal=Host.current()
letlocalAddressesFirst= local.addresses
letlocalAddressesSecond= local.addresses
XCTAssertEqual(localAddressesSecond.count, localAddressesFirst.count)
letdns=Host(address:"8.8.8.8")
letdnsAddressesFirst= dns.addresses
letdnsAddressesSecond= dns.addresses
XCTAssertEqual(dnsAddressesSecond.count, dnsAddressesFirst.count)
letswift=Host(name:"localhost")
letswiftAddressesFirst= swift.addresses
letswiftAddressesSecond= swift.addresses
XCTAssertEqual(swiftAddressesSecond.count, swiftAddressesFirst.count)
}
func test_isEqual(){
lethost0=Host(address:"8.8.8.8")
lethost1=Host(address:"8.8.8.8")
XCTAssertTrue(host0.isEqual(to: host1))
lethost2=Host(address:"8.8.8.9")
XCTAssertFalse(host0.isEqual(to: host2))
letswift0=Host(name:"localhost")
letswift1=Host(name:"localhost")
XCTAssertTrue(swift0.isEqual(to: swift1))
letgoogle=Host(name:"google.com")
XCTAssertFalse(swift0.isEqual(to: google))
}
// SR-14197
func test_localNamesNonEmpty(){
letlocal=Host.current()
XCTAssertTrue(local.names.count >0)
letswift=Host(name:"localhost")
XCTAssertTrue(swift.names.count >0)
}
}