|
|
|
@ -15,13 +15,55 @@ class TimezoneDataEqualityTests: XCTestCase {
|
|
|
|
|
// Use XCTAssert and related functions to verify your tests produce the correct results. |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func testEqualityWhenTimezones() { |
|
|
|
|
func testEqualityWhenTimezoneIdentifiersDiffer() { |
|
|
|
|
let timezone1 = TimezoneData() |
|
|
|
|
timezone1.setLabel(CLEmptyString) |
|
|
|
|
timezone1.timezoneID = metaInfo.0.name |
|
|
|
|
timezone1.formattedAddress = TimeZone.system.identifer |
|
|
|
|
timezone1.selectionType = .timezone |
|
|
|
|
timezone1.timezoneID = TimeZone.autoupdatingCurrent.identifier |
|
|
|
|
timezone1.formattedAddress = "SameLabel" |
|
|
|
|
|
|
|
|
|
XCTAssert(timezone1 != nil) |
|
|
|
|
let timezone2 = TimezoneData() |
|
|
|
|
timezone2.timezoneID = "Africa/Banjul" |
|
|
|
|
timezone2.formattedAddress = "SameLabel" |
|
|
|
|
|
|
|
|
|
XCTAssertNotEqual(timezone1, timezone2) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func testEqualityWhenTimezonesLabelsDiffer() { |
|
|
|
|
let timezone1 = TimezoneData() |
|
|
|
|
timezone1.timezoneID = TimeZone.autoupdatingCurrent.identifier |
|
|
|
|
timezone1.formattedAddress = "SameLabel" |
|
|
|
|
|
|
|
|
|
let timezone2 = TimezoneData() |
|
|
|
|
timezone2.timezoneID = TimeZone.autoupdatingCurrent.identifier |
|
|
|
|
timezone2.formattedAddress = "DifferentLabel" |
|
|
|
|
|
|
|
|
|
XCTAssertNotEqual(timezone1, timezone2) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func testEqualityWhenTimezonesPlaceIDsAreSame() { |
|
|
|
|
let timezone1 = TimezoneData() |
|
|
|
|
timezone1.timezoneID = TimeZone.autoupdatingCurrent.identifier |
|
|
|
|
timezone1.placeID = "SamplePlaceID" |
|
|
|
|
timezone1.formattedAddress = "SameLabel" |
|
|
|
|
|
|
|
|
|
let timezone2 = TimezoneData() |
|
|
|
|
timezone2.placeID = "SamplePlaceID" |
|
|
|
|
timezone2.timezoneID = TimeZone.autoupdatingCurrent.identifier |
|
|
|
|
timezone2.formattedAddress = "DifferentLabel" |
|
|
|
|
|
|
|
|
|
XCTAssertEqual(timezone1, timezone2) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func testEqualityWhenTimezonesPlaceIDsDiffer() { |
|
|
|
|
let timezone1 = TimezoneData() |
|
|
|
|
timezone1.timezoneID = TimeZone.autoupdatingCurrent.identifier |
|
|
|
|
timezone1.placeID = "SamplePlaceID1" |
|
|
|
|
timezone1.formattedAddress = "SameLabel" |
|
|
|
|
|
|
|
|
|
let timezone2 = TimezoneData() |
|
|
|
|
timezone2.placeID = "SamplePlaceID2" |
|
|
|
|
timezone2.timezoneID = TimeZone.autoupdatingCurrent.identifier |
|
|
|
|
timezone2.formattedAddress = "DifferentLabel" |
|
|
|
|
|
|
|
|
|
XCTAssertNotEqual(timezone1, timezone2) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|