Minor: add tests for KT-45893

This commit is contained in:
Dmitry Petrov
2021-04-05 15:47:35 +03:00
parent e10df86037
commit 120eba8d3d
10 changed files with 144 additions and 0 deletions
@@ -0,0 +1,29 @@
// IGNORE_BACKEND: JVM
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
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"
}