Skip to content

Commit 1662d5c

Browse files
#485: Add test for consistent UTC offset production between regular and foundation time zones
1 parent 81d27a1 commit 1662d5c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

core/darwin/test/TimeZoneNativeTest.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,19 @@ class TimeZoneNativeTest {
144144
}
145145
}
146146

147+
@Test
148+
fun shouldProduceConsistentUtcOffsetBetweenRegularAndFoundationTimeZones() {
149+
for ((zoneId, localDateTimes) in timeZoneRulesTestCases) {
150+
for (ldt in localDateTimes) {
151+
val regularTz = timeZoneById(zoneId)
152+
val foundationTz = timeZoneByIdFoundation(zoneId)
153+
val expected = regularTz.offsetAt(ldt.toInstant(regularTz))
154+
val actual = foundationTz.offsetAt(ldt.toInstant(foundationTz))
155+
assertEquals(expected, actual)
156+
}
157+
}
158+
}
159+
147160
// TimeZoneRules.infoAtDatetime(LocalDateTime) tests
148161

149162
private data class TimeZoneRulesTestData(val zoneId: String, val localDateTimes: List<LocalDateTime>)

0 commit comments

Comments
 (0)