Skip to content

Commit 5975cad

Browse files
committed
Refactor: minor changes for consistency with rest of file
1 parent aa9a79e commit 5975cad

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

kotlinx.interval.testcases/src/commonMain/kotlin/IntervalTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,14 @@ abstract class IntervalTest<T : Comparable<T>, TSize : Comparable<TSize>>(
236236
val abWithA = createClosedInterval( a, b )
237237
val abWithoutA = createInterval( a, false, b, true )
238238
assertEquals(
239-
createInterval( a, true, a, true ),
239+
createClosedInterval( a, a ),
240240
(abWithA - abWithoutA).singleOrNull()
241241
)
242242

243243
val abWithB = createClosedInterval( a, b )
244244
val abWithoutB = createInterval ( a, true, b, false )
245245
assertEquals(
246-
createInterval( b, true, b, true ),
246+
createClosedInterval( b, b ),
247247
(abWithB - abWithoutB).singleOrNull()
248248
)
249249

kotlinx.interval/src/commonMain/kotlin/Interval.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ open class Interval<T : Comparable<T>, TSize : Comparable<TSize>>(
117117
if ( leftOfCompare > 0 || rightOfCompare < 0 ) return this
118118

119119
// If the interval to subtract starts after the start of this interval, add the remaining lower bound chunk.
120-
val startCompare: Int = lowerBound.compareTo( toSubtract.lowerBound )
121-
if ( startCompare < 0 || ( startCompare == 0 && isLowerBoundIncluded && !toSubtract.isLowerBoundIncluded ) )
120+
val lowerCompare: Int = lowerBound.compareTo( toSubtract.lowerBound )
121+
if ( lowerCompare < 0 || ( lowerCompare == 0 && isLowerBoundIncluded && !toSubtract.isLowerBoundIncluded ) )
122122
{
123123
val lowerBoundRemnant = Interval(
124124
lowerBound, isLowerBoundIncluded,

0 commit comments

Comments
 (0)