Files
kotlin-fork/backend.native/tests/codegen/cycles/cycle_do.kt
T
2017-10-20 18:25:05 +03:00

16 lines
262 B
Kotlin

package codegen.cycles.cycle_do
import kotlin.test.*
fun cycle_do(cnt: Int): Int {
var sum = 1
do {
sum = sum + 2
} while (sum == cnt)
return sum
}
@Test fun runTest() {
if (cycle_do(3) != 5) throw Error()
if (cycle_do(0) != 3) throw Error()
}