Skip to content

Commit 614c6ea

Browse files
committed
Reorganize exception and clamping tests to make them more specific
1 parent 65126f5 commit 614c6ea

File tree

3 files changed

+147
-134
lines changed

3 files changed

+147
-134
lines changed

core/commonTest/src/InstantTest.kt

Lines changed: 97 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class InstantTest {
5757
* Copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
5858
*/
5959
@Test
60-
fun instantParsing() {
60+
fun parseIsoString() {
6161
val instants = arrayOf(
6262
Triple("1970-01-01T00:00:00Z", 0, 0),
6363
Triple("1970-01-01t00:00:00Z", 0, 0),
@@ -78,8 +78,12 @@ class InstantTest {
7878
val instant = Instant.parse(str)
7979
assertEquals(seconds.toLong() * 1000 + nanos / 1000000, instant.toEpochMilliseconds())
8080
}
81-
}
8281

82+
assertInvalidFormat { Instant.parse("x") }
83+
assertInvalidFormat { Instant.parse("12020-12-31T23:59:59.000000000Z") }
84+
// this string represents an Instant that is currently larger than Instant.MAX any of the implementations:
85+
assertInvalidFormat { Instant.parse("+1000000001-12-31T23:59:59.000000000Z") }
86+
}
8387

8488
@OptIn(ExperimentalTime::class)
8589
@Test
@@ -296,29 +300,29 @@ class InstantTest {
296300
assertEquals("+19999-12-31T23:59:59.000000009Z", LocalDateTime(19999, 12, 31, 23, 59, 59, 9).toInstant(TimeZone.UTC).toString())
297301
}
298302

303+
}
304+
305+
@OptIn(ExperimentalTime::class)
306+
class InstantRangeTest {
307+
private val UTC = TimeZone.UTC
308+
private val maxValidInstant = LocalDateTime.MAX.toInstant(UTC)
309+
private val minValidInstant = LocalDateTime.MIN.toInstant(UTC)
310+
299311
private val largePositiveLongs = listOf(Long.MAX_VALUE, Long.MAX_VALUE - 1, Long.MAX_VALUE - 50)
300312
private val largeNegativeLongs = listOf(Long.MIN_VALUE, Long.MIN_VALUE + 1, Long.MIN_VALUE + 50)
301-
@OptIn(ExperimentalTime::class)
313+
302314
private val largePositiveInstants = listOf(Instant.MAX, Instant.MAX - 1.seconds, Instant.MAX - 50.seconds)
303-
@OptIn(ExperimentalTime::class)
304315
private val largeNegativeInstants = listOf(Instant.MIN, Instant.MIN + 1.seconds, Instant.MIN + 50.seconds)
316+
305317
private val smallInstants = listOf(
306318
Instant.fromEpochMilliseconds(0),
307319
Instant.fromEpochMilliseconds(1003),
308320
Instant.fromEpochMilliseconds(253112)
309321
)
310322

311-
@Test
312-
fun testParsingThrowing() {
313-
assertFailsWith<DateTimeFormatException> { Instant.parse("x") }
314-
assertFailsWith<DateTimeFormatException> { Instant.parse("12020-12-31T23:59:59.000000000Z") }
315-
// this string represents an Instant that is currently larger than Instant.MAX any of the implementations:
316-
assertFailsWith<DateTimeFormatException> { Instant.parse("+1000000001-12-31T23:59:59.000000000Z") }
317-
}
318323

319-
@ExperimentalTime
320324
@Test
321-
fun testConstructorAccessorClamping() {
325+
fun epochMillisecondsClamping() {
322326
// toEpochMilliseconds()/fromEpochMilliseconds()
323327
// assuming that ranges of Long (representing a number of milliseconds) and Instant are not just overlapping,
324328
// but one is included in the other.
@@ -332,7 +336,7 @@ class InstantTest {
332336
}
333337
for (milliseconds in largePositiveLongs + largeNegativeLongs) {
334338
assertEquals(milliseconds, Instant.fromEpochMilliseconds(milliseconds).toEpochMilliseconds(),
335-
"$milliseconds")
339+
"$milliseconds")
336340
}
337341
} else {
338342
/* Any Instant is representable as a number of milliseconds in Long */
@@ -344,9 +348,13 @@ class InstantTest {
344348
}
345349
for (instant in largePositiveInstants + smallInstants + largeNegativeInstants) {
346350
assertEquals(instant.epochSeconds,
347-
Instant.fromEpochMilliseconds(instant.toEpochMilliseconds()).epochSeconds, "$instant")
351+
Instant.fromEpochMilliseconds(instant.toEpochMilliseconds()).epochSeconds, "$instant")
348352
}
349353
}
354+
}
355+
356+
@Test
357+
fun epochSecondsClamping() {
350358
// fromEpochSeconds
351359
// On all platforms Long.MAX_VALUE of seconds is not a valid instant.
352360
for (seconds in largePositiveLongs) {
@@ -360,121 +368,106 @@ class InstantTest {
360368
}
361369
}
362370

363-
@OptIn(ExperimentalTime::class)
364371
@Test
365-
fun testArithmeticClamping() {
366-
for (instant in smallInstants + largeNegativeInstants + largePositiveInstants) {
367-
assertEquals(Instant.MAX, instant + Duration.INFINITE)
368-
}
369-
for (instant in smallInstants + largeNegativeInstants + largePositiveInstants) {
370-
assertEquals(Instant.MIN, instant - Duration.INFINITE)
372+
fun durationArithmeticClamping() {
373+
val longDurations = listOf(Duration.INFINITE, Double.MAX_VALUE.nanoseconds, Long.MAX_VALUE.seconds)
374+
375+
for (duration in longDurations) {
376+
for (instant in smallInstants + largeNegativeInstants + largePositiveInstants) {
377+
assertEquals(Instant.MAX, instant + duration)
378+
}
379+
for (instant in smallInstants + largeNegativeInstants + largePositiveInstants) {
380+
assertEquals(Instant.MIN, instant - duration)
381+
}
371382
}
372383
assertEquals(Instant.MAX, (Instant.MAX - 4.seconds) + 5.seconds)
373384
assertEquals(Instant.MIN, (Instant.MIN + 10.seconds) - 12.seconds)
374385
}
375386

376-
@OptIn(ExperimentalTime::class)
377387
@Test
378-
fun testCalendarArithmeticThrowing() {
379-
val maxValidInstant = LocalDateTime.MAX.toInstant(TimeZone.UTC)
380-
val minValidInstant = LocalDateTime.MIN.toInstant(TimeZone.UTC)
381-
388+
fun periodArithmeticOutOfRange() {
382389
// Instant.plus(DateTimePeriod(), TimeZone)
383390
// Arithmetic overflow
384391
for (instant in smallInstants + largeNegativeInstants + largePositiveInstants) {
385-
assertFailsWith<DateTimeArithmeticException>("$instant") {
386-
instant.plus(DateTimePeriod(seconds = Long.MAX_VALUE), TimeZone.UTC)
387-
}
388-
assertFailsWith<DateTimeArithmeticException>("$instant") {
389-
instant.plus(DateTimePeriod(seconds = Long.MIN_VALUE), TimeZone.UTC)
390-
}
392+
assertArithmeticFails("$instant") { instant.plus(DateTimePeriod(seconds = Long.MAX_VALUE), UTC) }
393+
assertArithmeticFails("$instant") { instant.plus(DateTimePeriod(seconds = Long.MIN_VALUE), UTC) }
391394
}
392395
// Overflowing a LocalDateTime in input
393-
maxValidInstant.plus(DateTimePeriod(nanoseconds = -1), TimeZone.UTC)
394-
minValidInstant.plus(DateTimePeriod(nanoseconds = 1), TimeZone.UTC)
395-
assertFailsWith<DateTimeArithmeticException> {
396-
(maxValidInstant + 1.nanoseconds).plus(DateTimePeriod(nanoseconds = -2), TimeZone.UTC)
397-
}
398-
assertFailsWith<DateTimeArithmeticException> {
399-
(minValidInstant - 1.nanoseconds).plus(DateTimePeriod(nanoseconds = 2), TimeZone.UTC)
400-
}
396+
maxValidInstant.plus(DateTimePeriod(nanoseconds = -1), UTC)
397+
minValidInstant.plus(DateTimePeriod(nanoseconds = 1), UTC)
398+
assertArithmeticFails { (maxValidInstant + 1.nanoseconds).plus(DateTimePeriod(nanoseconds = -2), UTC) }
399+
assertArithmeticFails { (minValidInstant - 1.nanoseconds).plus(DateTimePeriod(nanoseconds = 2), UTC) }
401400
// Overflowing a LocalDateTime in result
402-
assertFailsWith<DateTimeArithmeticException> {
403-
maxValidInstant.plus(DateTimePeriod(nanoseconds = 1), TimeZone.UTC)
404-
}
405-
assertFailsWith<DateTimeArithmeticException> {
406-
minValidInstant.plus(DateTimePeriod(nanoseconds = -1), TimeZone.UTC)
407-
}
401+
assertArithmeticFails { maxValidInstant.plus(DateTimePeriod(nanoseconds = 1), UTC) }
402+
assertArithmeticFails { minValidInstant.plus(DateTimePeriod(nanoseconds = -1), UTC) }
408403
// Overflowing a LocalDateTime in intermediate computations
409-
assertFailsWith<DateTimeArithmeticException> {
410-
maxValidInstant.plus(DateTimePeriod(seconds = 1, nanoseconds = -1_000_000_001), TimeZone.UTC)
411-
}
412-
assertFailsWith<DateTimeArithmeticException> {
413-
maxValidInstant.plus(DateTimePeriod(hours = 1, minutes = -61), TimeZone.UTC)
414-
}
415-
assertFailsWith<DateTimeArithmeticException> {
416-
maxValidInstant.plus(DateTimePeriod(days = 1, hours = -48), TimeZone.UTC)
417-
}
404+
assertArithmeticFails { maxValidInstant.plus(DateTimePeriod(seconds = 1, nanoseconds = -1_000_000_001), UTC) }
405+
assertArithmeticFails { maxValidInstant.plus(DateTimePeriod(hours = 1, minutes = -61), UTC) }
406+
assertArithmeticFails { maxValidInstant.plus(DateTimePeriod(days = 1, hours = -48), UTC) }
407+
}
418408

409+
@Test
410+
fun unitArithmeticOutOfRange() {
419411
// Instant.plus(Long, DateTimeUnit, TimeZone)
420412
// Arithmetic overflow
421413
for (instant in smallInstants + largeNegativeInstants + largePositiveInstants) {
422-
assertFailsWith<DateTimeArithmeticException>("$instant") {
423-
instant.plus(Long.MAX_VALUE, DateTimeUnit.SECOND, TimeZone.UTC)
424-
}
425-
assertFailsWith<DateTimeArithmeticException>("$instant") {
426-
instant.plus(Long.MIN_VALUE, DateTimeUnit.SECOND, TimeZone.UTC)
427-
}
428-
assertFailsWith<DateTimeArithmeticException>("$instant") {
429-
instant.plus(Long.MAX_VALUE, DateTimeUnit.YEAR, TimeZone.UTC)
430-
}
431-
assertFailsWith<DateTimeArithmeticException>("$instant") {
432-
instant.plus(Long.MIN_VALUE, DateTimeUnit.YEAR, TimeZone.UTC)
433-
}
414+
assertArithmeticFails("$instant") { instant.plus(Long.MAX_VALUE, DateTimeUnit.SECOND, UTC) }
415+
assertArithmeticFails("$instant") { instant.plus(Long.MIN_VALUE, DateTimeUnit.SECOND, UTC) }
416+
assertArithmeticFails("$instant") { instant.plus(Long.MAX_VALUE, DateTimeUnit.YEAR, UTC) }
417+
assertArithmeticFails("$instant") { instant.plus(Long.MIN_VALUE, DateTimeUnit.YEAR, UTC) }
434418
}
435419
// Overflowing a LocalDateTime in input
436-
maxValidInstant.plus(-1, DateTimeUnit.NANOSECOND, TimeZone.UTC)
437-
minValidInstant.plus(1, DateTimeUnit.NANOSECOND, TimeZone.UTC)
438-
assertFailsWith<DateTimeArithmeticException> {
439-
(maxValidInstant + 1.nanoseconds).plus(-2, DateTimeUnit.NANOSECOND, TimeZone.UTC)
440-
}
441-
assertFailsWith<DateTimeArithmeticException> {
442-
(minValidInstant - 1.nanoseconds).plus(2, DateTimeUnit.NANOSECOND, TimeZone.UTC)
443-
}
420+
maxValidInstant.plus(-1, DateTimeUnit.NANOSECOND, UTC)
421+
minValidInstant.plus(1, DateTimeUnit.NANOSECOND, UTC)
422+
assertArithmeticFails { (maxValidInstant + 1.nanoseconds).plus(-2, DateTimeUnit.NANOSECOND, UTC) }
423+
assertArithmeticFails { (minValidInstant - 1.nanoseconds).plus(2, DateTimeUnit.NANOSECOND, UTC) }
444424
// Overflowing a LocalDateTime in result
445-
assertFailsWith<DateTimeArithmeticException> {
446-
maxValidInstant.plus(1, DateTimeUnit.NANOSECOND, TimeZone.UTC)
447-
}
448-
assertFailsWith<DateTimeArithmeticException> {
449-
maxValidInstant.plus(1, DateTimeUnit.YEAR, TimeZone.UTC)
450-
}
451-
assertFailsWith<DateTimeArithmeticException> {
452-
minValidInstant.plus(-1, DateTimeUnit.NANOSECOND, TimeZone.UTC)
453-
}
454-
assertFailsWith<DateTimeArithmeticException> {
455-
minValidInstant.plus(-1, DateTimeUnit.YEAR, TimeZone.UTC)
456-
}
425+
assertArithmeticFails { maxValidInstant.plus(1, DateTimeUnit.NANOSECOND, UTC) }
426+
assertArithmeticFails { maxValidInstant.plus(1, DateTimeUnit.YEAR, UTC) }
427+
assertArithmeticFails { minValidInstant.plus(-1, DateTimeUnit.NANOSECOND, UTC) }
428+
assertArithmeticFails { minValidInstant.plus(-1, DateTimeUnit.YEAR, UTC) }
429+
}
457430

431+
@Test
432+
fun periodUntilOutOfRange() {
458433
// Instant.periodUntil
459-
maxValidInstant.periodUntil(minValidInstant, TimeZone.UTC)
460-
assertFailsWith<DateTimeArithmeticException> {
461-
(maxValidInstant + 1.nanoseconds).periodUntil(minValidInstant, TimeZone.UTC)
462-
}
463-
assertFailsWith<DateTimeArithmeticException> {
464-
maxValidInstant.periodUntil(minValidInstant - 1.nanoseconds, TimeZone.UTC)
465-
}
434+
maxValidInstant.periodUntil(minValidInstant, UTC)
435+
assertArithmeticFails { (maxValidInstant + 1.nanoseconds).periodUntil(minValidInstant, UTC) }
436+
assertArithmeticFails { maxValidInstant.periodUntil(minValidInstant - 1.nanoseconds, UTC) }
437+
}
438+
439+
@Test
440+
fun unitsUntilClamping() {
441+
// Arithmetic overflow of the resulting number
442+
assertEquals(Long.MAX_VALUE, minValidInstant.until(maxValidInstant, DateTimeUnit.NANOSECOND, UTC))
443+
assertEquals(Long.MIN_VALUE, maxValidInstant.until(minValidInstant, DateTimeUnit.NANOSECOND, UTC))
444+
}
466445

446+
@Test
447+
fun unitsUntilOutOfRange() {
467448
// Instant.until
468-
// Arithmetic overflow
469-
assertEquals(Long.MAX_VALUE, minValidInstant.until(maxValidInstant, DateTimeUnit.NANOSECOND, TimeZone.UTC))
470-
assertEquals(Long.MIN_VALUE, maxValidInstant.until(minValidInstant, DateTimeUnit.NANOSECOND, TimeZone.UTC))
471449
// Overflowing a LocalDateTime in input
472-
assertFailsWith<DateTimeArithmeticException> {
473-
(maxValidInstant + 1.nanoseconds).until(maxValidInstant, DateTimeUnit.NANOSECOND, TimeZone.UTC)
474-
}
475-
assertFailsWith<DateTimeArithmeticException> {
476-
maxValidInstant.until(maxValidInstant + 1.nanoseconds, DateTimeUnit.NANOSECOND, TimeZone.UTC)
477-
}
450+
assertArithmeticFails { (maxValidInstant + 1.nanoseconds).until(maxValidInstant, DateTimeUnit.NANOSECOND, UTC) }
451+
assertArithmeticFails { maxValidInstant.until(maxValidInstant + 1.nanoseconds, DateTimeUnit.NANOSECOND, UTC) }
452+
}
453+
}
454+
455+
456+
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
457+
@kotlin.internal.InlineOnly
458+
inline fun <T> assertArithmeticFails(message: String? = null, f: () -> T) {
459+
assertFailsWith<DateTimeArithmeticException>(message) {
460+
val result = f()
461+
fail(result.toString())
478462
}
463+
}
479464

465+
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
466+
@kotlin.internal.InlineOnly
467+
inline fun <T> assertInvalidFormat(message: String? = null, f: () -> T) {
468+
assertFailsWith<DateTimeFormatException>(message) {
469+
val result = f()
470+
fail(result.toString())
471+
}
480472
}
473+

core/commonTest/src/LocalDateTest.kt

Lines changed: 46 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ class LocalDateTest {
3535
}
3636

3737
@Test
38-
fun localDateParsing() {
38+
fun parseIsoString() {
3939
fun checkParsedComponents(value: String, year: Int, month: Int, day: Int, dayOfWeek: Int, dayOfYear: Int) {
4040
checkComponents(LocalDate.parse(value), year, month, day, dayOfWeek, dayOfYear)
4141
}
4242
checkParsedComponents("2019-10-01", 2019, 10, 1, 2, 274)
4343
checkParsedComponents("2016-02-29", 2016, 2, 29, 1, 60)
44-
checkParsedComponents("2017-10-01", 2017, 10, 1, 7, 274)
45-
assertFailsWith<DateTimeFormatException> { LocalDate.parse("102017-10-01") }
46-
assertFailsWith<DateTimeFormatException> { LocalDate.parse("2017--10-01") }
47-
assertFailsWith<DateTimeFormatException> { LocalDate.parse("2017-+10-01") }
48-
assertFailsWith<DateTimeFormatException> { LocalDate.parse("2017-10-+01") }
49-
assertFailsWith<DateTimeFormatException> { LocalDate.parse("2017-10--01") }
44+
checkParsedComponents("2017-10-01", 2017, 10, 1, 7, 274)
45+
assertInvalidFormat { LocalDate.parse("102017-10-01") }
46+
assertInvalidFormat { LocalDate.parse("2017--10-01") }
47+
assertInvalidFormat { LocalDate.parse("2017-+10-01") }
48+
assertInvalidFormat { LocalDate.parse("2017-10-+01") }
49+
assertInvalidFormat { LocalDate.parse("2017-10--01") }
5050
// this date is currently larger than the largest representable one any of the platforms:
51-
assertFailsWith<DateTimeFormatException> { LocalDate.parse("+1000000000-10-01") }
51+
assertInvalidFormat { LocalDate.parse("+1000000000-10-01") }
5252
}
5353

5454
@Test
@@ -137,43 +137,60 @@ class LocalDateTest {
137137
}
138138

139139
@Test
140-
fun invalidDate() {
141-
assertFailsWith<IllegalArgumentException> { LocalDate(2007, 2, 29) }
142-
LocalDate(2008, 2, 29)
143-
assertFailsWith<IllegalArgumentException> { LocalDate(2007, 4, 31) }
144-
assertFailsWith<IllegalArgumentException> { LocalDate(2007, 1, 0) }
145-
assertFailsWith<IllegalArgumentException> { LocalDate(2007,1, 32) }
146-
assertFailsWith<IllegalArgumentException> { LocalDate(Int.MIN_VALUE, 1, 1) }
147-
assertFailsWith<IllegalArgumentException> { LocalDate(2007, 1, 32) }
148-
assertFailsWith<IllegalArgumentException> { LocalDate(2007, 0, 1) }
149-
assertFailsWith<IllegalArgumentException> { LocalDate(2007, 13, 1) }
150-
}
140+
fun constructInvalidDate() = checkInvalidDate(::LocalDate)
151141

152142
@Test
153-
fun testArithmeticThrowing() {
143+
fun unitArithmeticOutOfRange() {
154144
// LocalDate.plus(Long, DateTimeUnit)
155145
LocalDate.MAX.plus(-1, DateTimeUnit.DAY)
156146
LocalDate.MIN.plus(1, DateTimeUnit.DAY)
157147
// Arithmetic overflow
158-
assertFailsWith<DateTimeArithmeticException> { LocalDate.MAX.plus(Long.MAX_VALUE, DateTimeUnit.YEAR) }
159-
assertFailsWith<DateTimeArithmeticException> { LocalDate.MAX.plus(Long.MAX_VALUE - 2, DateTimeUnit.YEAR) }
160-
assertFailsWith<DateTimeArithmeticException> { LocalDate.MIN.plus(Long.MIN_VALUE, DateTimeUnit.YEAR) }
161-
assertFailsWith<DateTimeArithmeticException> { LocalDate.MIN.plus(Long.MIN_VALUE + 2, DateTimeUnit.YEAR) }
162-
assertFailsWith<DateTimeArithmeticException> { LocalDate.MIN.plus(Long.MAX_VALUE, DateTimeUnit.DAY) }
148+
assertArithmeticFails { LocalDate.MAX.plus(Long.MAX_VALUE, DateTimeUnit.YEAR) }
149+
assertArithmeticFails { LocalDate.MAX.plus(Long.MAX_VALUE - 2, DateTimeUnit.YEAR) }
150+
assertArithmeticFails { LocalDate.MIN.plus(Long.MIN_VALUE, DateTimeUnit.YEAR) }
151+
assertArithmeticFails { LocalDate.MIN.plus(Long.MIN_VALUE + 2, DateTimeUnit.YEAR) }
152+
assertArithmeticFails { LocalDate.MIN.plus(Long.MAX_VALUE, DateTimeUnit.DAY) }
163153
// Exceeding the boundaries of LocalDate
164-
assertFailsWith<DateTimeArithmeticException> { LocalDate.MAX.plus(1, DateTimeUnit.YEAR) }
165-
assertFailsWith<DateTimeArithmeticException> { LocalDate.MIN.plus(-1, DateTimeUnit.YEAR) }
154+
assertArithmeticFails { LocalDate.MAX.plus(1, DateTimeUnit.YEAR) }
155+
assertArithmeticFails { LocalDate.MIN.plus(-1, DateTimeUnit.YEAR) }
156+
}
166157

158+
@Test
159+
fun periodArithmeticOutOfRange() {
167160
// LocalDate.plus(DatePeriod)
168161
LocalDate.MAX.plus(DatePeriod(years = -2, months = 12, days = 31))
169162
// Exceeding the boundaries in result
170-
assertFailsWith<DateTimeArithmeticException> {
163+
assertArithmeticFails {
171164
LocalDate.MAX.plus(DatePeriod(years = -2, months = 24, days = 1))
172165
}
173166
// Exceeding the boundaries in intermediate computations
174-
assertFailsWith<DateTimeArithmeticException> {
167+
assertArithmeticFails {
175168
LocalDate.MAX.plus(DatePeriod(years = -2, months = 25, days = -1000))
176169
}
177170
}
178171

172+
@Test
173+
fun unitsUntilClamping() {
174+
val diffInYears = LocalDate.MIN.until(LocalDate.MAX, DateTimeUnit.YEAR)
175+
if (diffInYears > Int.MAX_VALUE / 365) {
176+
assertEquals(Int.MAX_VALUE, LocalDate.MIN.until(LocalDate.MAX, DateTimeUnit.DAY))
177+
assertEquals(Int.MIN_VALUE, LocalDate.MAX.until(LocalDate.MIN, DateTimeUnit.DAY))
178+
}
179+
}
179180
}
181+
182+
183+
184+
fun checkInvalidDate(constructor: (year: Int, month: Int, day: Int) -> LocalDate) {
185+
assertFailsWith<IllegalArgumentException> { constructor(2007, 2, 29) }
186+
constructor(2008, 2, 29).let { date ->
187+
assertEquals(29, date.dayOfMonth)
188+
}
189+
assertFailsWith<IllegalArgumentException> { constructor(2007, 4, 31) }
190+
assertFailsWith<IllegalArgumentException> { constructor(2007, 1, 0) }
191+
assertFailsWith<IllegalArgumentException> { constructor(2007,1, 32) }
192+
assertFailsWith<IllegalArgumentException> { constructor(Int.MIN_VALUE, 1, 1) }
193+
assertFailsWith<IllegalArgumentException> { constructor(2007, 1, 32) }
194+
assertFailsWith<IllegalArgumentException> { constructor(2007, 0, 1) }
195+
assertFailsWith<IllegalArgumentException> { constructor(2007, 13, 1) }
196+
}

0 commit comments

Comments
 (0)