BC native tests port to Konan's TestRunner
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
fun main(args : Array<String>) {
|
||||
package runtime.basic.empty_substring
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val hello = "Hello world"
|
||||
println(hello.subSequence(1, 1).toString())
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package koko.lala
|
||||
package runtime.basic.entry0
|
||||
|
||||
fun fail() {
|
||||
println("Test failed, this is a wrong main() function.")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package runtime.basic.entry1
|
||||
|
||||
fun fail() {
|
||||
println("Test failed, this is a wrong main() function.")
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package runtime.basic.entry2
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fail()
|
||||
}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
fun main(args : Array<String>) {
|
||||
package runtime.basic.for0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val byteArray = ByteArray(3)
|
||||
byteArray[0] = 2
|
||||
byteArray[1] = 3
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
fun main(args : Array<String>) {
|
||||
package runtime.basic.hash0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
println(239.hashCode())
|
||||
println((-1L).hashCode())
|
||||
println('a'.hashCode())
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
fun main(args : Array<String>) {
|
||||
package runtime.basic.hello0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
println("Hello, world!")
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// TODO: TestRuner should be able to pass input to stdin
|
||||
// TODO: remove kotlin_native.io once overrides are in place.
|
||||
fun main(args : Array<String>) {
|
||||
print(readLine().toString())
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// TODO: TestRuner should be able to pass input to stdin
|
||||
// TODO: remove kotlin_native.io once overrides are in place.
|
||||
fun main(args : Array<String>) {
|
||||
print("you entered '" + readLine() + "'")
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
fun main(args : Array<String>) {
|
||||
package runtime.basic.hello3
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
println(239)
|
||||
// TODO: enable, once override by name is implemented.
|
||||
println(true)
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
fun main(args : Array<String>) {
|
||||
package runtime.basic.hello4
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val x = 2
|
||||
println(if (x == 2) "Hello" else "Привет")
|
||||
println(if (x == 3) "Bye" else "Пока")
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
package runtime.basic.initializers0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
class A {
|
||||
init{
|
||||
println ("A::init")
|
||||
@@ -25,7 +29,7 @@ class A {
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args:Array<String>) {
|
||||
@Test fun runTest() {
|
||||
println("main")
|
||||
A.foo()
|
||||
A.foo()
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
class Test {
|
||||
package runtime.basic.initializers1
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
class TestClass {
|
||||
companion object {
|
||||
init {
|
||||
println("Init Test")
|
||||
@@ -6,8 +10,8 @@ class Test {
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
val t1 = Test()
|
||||
val t2 = Test()
|
||||
@Test fun runTest() {
|
||||
val t1 = TestClass()
|
||||
val t2 = TestClass()
|
||||
println("Done")
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
package runtime.basic.initializers2
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
class A(val msg: String) {
|
||||
init {
|
||||
println("init $msg")
|
||||
@@ -9,7 +13,7 @@ val globalValue1 = 1
|
||||
val globalValue2 = A("globalValue2")
|
||||
val globalValue3 = A("globalValue3")
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
@Test fun runTest() {
|
||||
println(globalValue1.toString())
|
||||
println(globalValue2.toString())
|
||||
println(globalValue3.toString())
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package runtime.basic.initializers3
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
class Foo(val bar: Int)
|
||||
|
||||
var x = Foo(42)
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
@Test fun runTest() {
|
||||
println(x.bar)
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
package runtime.basic.initializers4
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
const val INT_MAX_POWER_OF_TWO: Int = Int.MAX_VALUE / 2 + 1
|
||||
val DOUBLE = Double.MAX_VALUE - 1.0
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
@Test fun runTest() {
|
||||
println(INT_MAX_POWER_OF_TWO)
|
||||
println(DOUBLE > 0.0)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package runtime.basic.initializers5
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
object A {
|
||||
val a = 42
|
||||
val b = A.a
|
||||
}
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
@Test fun runTest() {
|
||||
println(A.b)
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
package runtime.basic.interface0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
interface A {
|
||||
fun b() = c()
|
||||
@@ -10,7 +13,7 @@ class B(): A {
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
@Test fun runTest() {
|
||||
val a:A = B()
|
||||
a.b()
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package runtime.basic.entry2
|
||||
|
||||
fun fail() {
|
||||
println("Test failed, this is a wrong main() function.")
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package runtime.basic.standard
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
class Foo(val bar: Int)
|
||||
|
||||
fun <T> assertEquals(actual: T, expected: T) {
|
||||
if (actual != expected) throw AssertionError("Assertion failed. Expected value: $expected, actual value: $actual")
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
@Test fun runTest() {
|
||||
try {
|
||||
TODO()
|
||||
throw AssertionError("TODO() doesn't throw an exception")
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
package runtime.basic.statements0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun simple() {
|
||||
var a = 238
|
||||
a++
|
||||
@@ -27,7 +31,7 @@ fun fields() {
|
||||
println(foo.i)
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
@Test fun runTest() {
|
||||
simple()
|
||||
fields()
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
fun main(args : Array<String>) {
|
||||
package runtime.basic.throw0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val cond = 1
|
||||
if (cond == 2) throw RuntimeException()
|
||||
if (cond == 3) throw NoSuchElementException("no such element")
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
fun main(args : Array<String>) {
|
||||
package runtime.basic.tostring0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
println(127.toByte().toString())
|
||||
println(255.toByte().toString())
|
||||
println(239.toShort().toString())
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
fun main(args : Array<String>) {
|
||||
package runtime.basic.tostring1
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val hello = "Hello world"
|
||||
println(hello.subSequence(1, 5).toString())
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
fun main(args : Array<String>) {
|
||||
package runtime.basic.tostring2
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val hello = "Hello"
|
||||
val array = hello.toCharArray()
|
||||
for (ch in array) {
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
package runtime.basic.tostring3
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun testByte() {
|
||||
val values = ByteArray(2)
|
||||
values[0] = Byte.MIN_VALUE
|
||||
@@ -58,7 +62,7 @@ fun testDouble() {
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
@Test fun runTest() {
|
||||
testByte()
|
||||
testShort()
|
||||
testInt()
|
||||
|
||||
Reference in New Issue
Block a user