Files
kotlin-fork/compiler/testData/codegen/box/ranges/contains/inDoubleRangeLiteralVsComparableRangeLiteral.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
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.
2021-11-17 15:26:38 +03:00

21 lines
700 B
Kotlin
Vendored

// WITH_STDLIB
val DOUBLE_RANGE = 0.0 .. -0.0
val PZERO = 0.0 as Comparable<Any>
val NZERO = -0.0 as Comparable<Any>
val COMPARABLE_RANGE = PZERO .. NZERO
fun box(): String {
if (!(0.0 in DOUBLE_RANGE)) return "fail 1 in Double"
if (0.0 !in DOUBLE_RANGE) return "fail 1 !in Double"
if (!(-0.0 in DOUBLE_RANGE)) return "fail 2 in Double"
if (-0.0 !in DOUBLE_RANGE) return "fail 2 !in Double"
if (PZERO in COMPARABLE_RANGE) return "fail 3 in Comparable"
if (!(PZERO !in COMPARABLE_RANGE)) return "fail 3 !in Comparable"
if (NZERO in COMPARABLE_RANGE) return "fail 4 in Comparable"
if (!(NZERO !in COMPARABLE_RANGE)) return "fail 4a !in Comparable"
return "OK"
}