Skip to content
This repository has been archived by the owner on May 7, 2022. It is now read-only.

Commit

Permalink
fix segmentLength Kotlin-Polytech#3
Browse files Browse the repository at this point in the history
  • Loading branch information
vladdenisov committed Mar 3, 2022
1 parent 2bb9f17 commit 0d447b8
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 0d447b8

Please sign in to comment.