Files
kotlin-fork/testlib/test/StringTest.kt
T
Alex Tkachman 53bba59a4f dbl -> toDouble
2012-02-22 13:14:41 +02:00

29 lines
542 B
Kotlin

package testString
import std.io.*
import stdhack.test.*
import junit.framework.*
class StringTest() : TestCase() {
fun testStringIterator() {
var sum = 0
for(c in "239")
sum += (c.toInt() - '0'.toInt())
assertTrue(sum == 14)
}
fun testStringBuilderIterator() {
var sum = 0
val sb = StringBuilder()
for(c in "239")
sb.append(c)
println(sb)
for(c in sb)
sum += (c.toInt() - '0'.toInt())
assertTrue(sum == 14)
}
}