Skip to content

Commit

Permalink
try to fix segmentLength Kotlin-Polytech#2
Browse files Browse the repository at this point in the history
  • Loading branch information
vladdenisov committed Sep 15, 2021
1 parent 56f3f37 commit cd49017
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lesson2/task1/IfElse.kt
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ fun segmentLength(a: Int, b: Int, c: Int, d: Int): Int {
return 0
}
}
if (c < a) {
if (c <= a) {
if (d >= b) {
return b - a
}
Expand Down
1 change: 1 addition & 0 deletions test/lesson2/task1/Tests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class Tests {
@Test
@Tag("3")
fun segmentLength() {
assertEquals(0, segmentLength(0, 0, 0, 0))
assertEquals(-1, segmentLength(1, 2, 3, 4))
assertEquals(-1, segmentLength(5, 7, 1, 3))
assertEquals(0, segmentLength(1, 2, 2, 4))
Expand Down

0 comments on commit cd49017

Please sign in to comment.