c7435ba760
We are going to deprecate `WITH_RUNTIME` directive. The main reason behind this change is that `WITH_STDLIB` directive better describes its meaning, specifically it will add kotlin stdlib to test's classpath.
26 lines
627 B
Kotlin
Vendored
26 lines
627 B
Kotlin
Vendored
// WITH_STDLIB
|
|
import kotlin.test.*
|
|
|
|
class Value(val x: Int) : Comparable<Value> {
|
|
override fun compareTo(other: Value): Int {
|
|
throw AssertionError("Should not be called")
|
|
}
|
|
}
|
|
|
|
class ValueRange(override val start: Value,
|
|
override val endInclusive: Value) : ClosedRange<Value> {
|
|
|
|
override fun contains(value: Value): Boolean {
|
|
return value.x == 42
|
|
}
|
|
}
|
|
|
|
operator fun Value.rangeTo(other: Value): ClosedRange<Value> = ValueRange(this, other)
|
|
|
|
fun box(): String {
|
|
assertTrue(Value(42) in Value(1)..Value(2))
|
|
assertTrue(Value(41) !in Value(40)..Value(42))
|
|
|
|
return "OK"
|
|
}
|