-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add context to the DayOfWeek constructor precondition (#371)
- Loading branch information
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright 2019-2024 JetBrains s.r.o. and contributors. | ||
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file. | ||
*/ | ||
|
||
package kotlinx.datetime.test | ||
|
||
import kotlinx.datetime.* | ||
import kotlin.test.* | ||
|
||
class DayOfWeekTest { | ||
|
||
@Test | ||
fun testDayOfWeek() { | ||
for (i in 1..7) { | ||
assertEquals(i, DayOfWeek(i).isoDayNumber) | ||
} | ||
assertFailsWith<IllegalArgumentException> { DayOfWeek(-1) } | ||
assertFailsWith<IllegalArgumentException> { DayOfWeek(8) } | ||
assertFailsWith<IllegalArgumentException> { DayOfWeek(Int.MIN_VALUE) } | ||
} | ||
} |