forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMapKit.swift
36 lines (31 loc) · 1.2 KB
/
MapKit.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
// RUN: %target-run-simple-swift
// REQUIRES: executable_test
// REQUIRES: objc_interop
import CoreLocation
import MapKit
import StdlibUnittest
import StdlibUnittestFoundationExtras
var mapKit = TestSuite("MapKit")
func coordinatesEqual(_ x: CLLocationCoordinate2D, _ y: CLLocationCoordinate2D)
-> Bool {
return x.latitude == y.latitude && x.longitude == y.longitude
}
func spansEqual(_ x: MKCoordinateSpan, _ y: MKCoordinateSpan)
-> Bool {
return x.latitudeDelta == y.latitudeDelta
&& x.longitudeDelta == y.longitudeDelta
}
if #available(tvOS 9.2, *) {
mapKit.test("NSValue bridging") {
expectBridgeToNSValue(CLLocationCoordinate2D(latitude: 17, longitude: 38),
nsValueInitializer: { NSValue(mkCoordinate: $0) },
nsValueGetter: { $0.mkCoordinateValue },
equal: coordinatesEqual)
expectBridgeToNSValue(MKCoordinateSpan(latitudeDelta: 6,
longitudeDelta: 79),
nsValueInitializer: { NSValue(mkCoordinateSpan: $0) },
nsValueGetter: { $0.mkCoordinateSpanValue },
equal: spansEqual)
}
}
runAllTests()