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.
29 lines
580 B
Kotlin
Vendored
29 lines
580 B
Kotlin
Vendored
// IGNORE_BACKEND: JVM
|
|
// WITH_STDLIB
|
|
|
|
operator fun ClosedRange<Float>.iterator() =
|
|
object : Iterator<Float> {
|
|
private var current = this@iterator.start
|
|
private val end = this@iterator.endInclusive
|
|
|
|
override fun hasNext(): Boolean =
|
|
current <= end
|
|
|
|
override fun next(): Float {
|
|
val next = current
|
|
current += 0.125f
|
|
return next
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
var s = 0.0
|
|
for (x in 0.0f .. 1.0f) {
|
|
s += x
|
|
}
|
|
if (s != 4.5)
|
|
return "Failed: $s"
|
|
|
|
return "OK"
|
|
}
|