You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
XCTAssert(secondsFromGMT1 == secondsFromGMT2 || secondsFromGMT2 == secondsFromGMT3,"\(secondsFromGMT1) should be equal to \(secondsFromGMT2), or in the rare circumstance where a daylight saving time transition has just occurred, \(secondsFromGMT2) should be equal to \(secondsFromGMT3)")
96
+
97
+
letabbreviation1= tz.abbreviation()
98
+
letabbreviation2= obj.abbreviation
99
+
XCTAssertEqual(abbreviation1, abbreviation2,"\(abbreviation1) should be equal to \(abbreviation2)")
XCTAssert(isDaylightSavingTime1 == isDaylightSavingTime2 || isDaylightSavingTime2 == isDaylightSavingTime3,"\(isDaylightSavingTime1) should be equal to \(isDaylightSavingTime2), or in the rare circumstance where a daylight saving time transition has just occurred, \(isDaylightSavingTime2) should be equal to \(isDaylightSavingTime3)")
XCTAssert(nextDaylightSavingTimeTransition1 == nextDaylightSavingTimeTransition2 || nextDaylightSavingTimeTransition2 == nextDaylightSavingTimeTransition3,"\(nextDaylightSavingTimeTransition1) should be equal to \(nextDaylightSavingTimeTransition2), or in the rare circumstance where a daylight saving time transition has just occurred, \(nextDaylightSavingTimeTransition2) should be equal to \(nextDaylightSavingTimeTransition3)")
114
+
}
115
+
116
+
func test_knownTimeZoneNames(){
117
+
letknown=NSTimeZone.knownTimeZoneNames
118
+
XCTAssertNotEqual([], known,"known time zone names not expected to be empty")
119
+
}
120
+
42
121
func test_initializingTimeZoneWithOffset(){
43
122
lettz=TimeZone(identifier:"GMT-0400")
44
123
XCTAssertNotNil(tz)
45
124
letseconds= tz?.secondsFromGMT(for:Date())
46
125
XCTAssertEqual(seconds,-14400,"GMT-0400 should be -14400 seconds but got \(seconds) instead")
126
+
127
+
lettz2=TimeZone(secondsFromGMT:-14400)
128
+
XCTAssertNotNil(tz2)
129
+
letexpectedName="GMT-0400"
130
+
letactualName= tz2?.identifier
131
+
XCTAssertEqual(actualName, expectedName,"expected name \"\(expectedName)\" is not equal to \"\(actualName)\"")
0 commit comments