Skip to content

Commit

Permalink
fix segmentLength Kotlin-Polytech#3
Browse files Browse the repository at this point in the history
  • Loading branch information
vladdenisov committed Sep 15, 2021
1 parent dbbd82f commit 14bb48e
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 @@ -171,7 +171,7 @@ fun segmentLength(a: Int, b: Int, c: Int, d: Int): Int {
if (d >= b) {
return b - a
}
if (d < b && d > a) {
if (d < b && d >= a) {
return d - 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 @@ -89,5 +89,6 @@ class Tests {
assertEquals(1, segmentLength(3, 6, 1, 4))
assertEquals(4, segmentLength(1, 15, 10, 14))
assertEquals(0, segmentLength(0, 1, 1, 1))
assertEquals(0, segmentLength(0, 1, 0, 0))
}
}

0 comments on commit 14bb48e

Please sign in to comment.