[K/N][Tests] Adjust moved codegen tests to new infra

^KT-61259
This commit is contained in:
Vladimir Sukharev
2023-12-12 17:06:31 +01:00
committed by Space Team
parent a5f3d5b737
commit e15068c62f
301 changed files with 2958 additions and 2382 deletions
@@ -3,8 +3,6 @@
* that can be found in the LICENSE file.
*/
package codegen.branching.advanced_when2
import kotlin.test.*
fun advanced_when2(i: Int): Int {
@@ -18,6 +16,9 @@ fun advanced_when2(i: Int): Int {
return value
}
@Test fun runTest() {
if (advanced_when2(10) != 42) throw Error()
fun box(): String {
val res = advanced_when2(10)
if (res != 42) return "FAIL $res"
return "OK"
}
@@ -3,8 +3,6 @@
* that can be found in the LICENSE file.
*/
package codegen.branching.advanced_when5
import kotlin.test.*
fun advanced_when5(i: Int): Int {
@@ -18,6 +16,9 @@ fun advanced_when5(i: Int): Int {
}
}
@Test fun runTest() {
if (advanced_when5(5) != 24) throw Error()
fun box(): String {
val res = advanced_when5(5)
if (res != 24) return "FAIL $res"
return "OK"
}
+5 -4
View File
@@ -3,8 +3,6 @@
* that can be found in the LICENSE file.
*/
package codegen.branching.if_else
import kotlin.test.*
fun if_else(b: Boolean): Int {
@@ -12,6 +10,9 @@ fun if_else(b: Boolean): Int {
else return 24
}
@Test fun runTest() {
if (if_else(false) != 24) throw Error()
fun box(): String {
val res = if_else(false)
if (res != 24) return "FAIL: $res"
return "OK"
}
+5 -4
View File
@@ -3,8 +3,6 @@
* that can be found in the LICENSE file.
*/
package codegen.branching.when2
import kotlin.test.*
fun when2(i: Int): Int {
@@ -14,6 +12,9 @@ fun when2(i: Int): Int {
}
}
@Test fun runTest() {
if (when2(0) != 42) throw Error()
fun box(): String {
val res = when2(0)
if (res != 42) return "FAIL $res"
return "OK"
}
+8 -3
View File
@@ -3,8 +3,6 @@
* that can be found in the LICENSE file.
*/
package codegen.branching.when4
import kotlin.test.*
fun when5(i: Int): Int {
@@ -16,4 +14,11 @@ fun when5(i: Int): Int {
4 -> return 1
}
return 24
}
}
fun box(): String {
val res = when5(5)
if (res != 24) return "FAIL $res"
return "OK"
}
+5 -4
View File
@@ -3,8 +3,6 @@
* that can be found in the LICENSE file.
*/
package codegen.branching.when5
import kotlin.test.*
fun when5(i: Int): Int {
@@ -18,6 +16,9 @@ fun when5(i: Int): Int {
}
}
@Test fun runTest() {
if (when5(2) != 3) throw Error()
fun box(): String {
val res = when5(2)
if (res != 3) return "FAIL $res"
return "OK"
}
+3 -3
View File
@@ -3,13 +3,13 @@
* that can be found in the LICENSE file.
*/
package codegen.branching.when6
import kotlin.test.*
fun foo() {
}
@Test fun runTest() {
fun box(): String {
if (true) foo() else foo()
return "OK"
}
+3 -3
View File
@@ -3,12 +3,12 @@
* that can be found in the LICENSE file.
*/
package codegen.branching.when7
import kotlin.test.*
@Test fun runTest() {
fun box(): String {
main(emptyArray())
return "OK"
}
fun main(args: Array<String>) {
+3 -5
View File
@@ -3,13 +3,11 @@
* that can be found in the LICENSE file.
*/
package codegen.branching.when8
import kotlin.test.*
@Test fun runTest() {
fun box(): String {
when (true) {
true -> println("true")
false -> println("false")
true -> return "OK"
false -> return "FAIL"
}
}
@@ -1 +0,0 @@
true
+2 -4
View File
@@ -3,13 +3,11 @@
* that can be found in the LICENSE file.
*/
package codegen.branching.when9
import kotlin.test.*
@Test fun runTest() {
fun box(): String {
foo(0)
println("Ok")
return "OK"
}
fun foo(x: Int) {
@@ -1 +0,0 @@
Ok
@@ -3,8 +3,6 @@
* that can be found in the LICENSE file.
*/
package codegen.branching.when_through
import kotlin.test.*
fun when_through(i: Int): Int {
@@ -18,6 +16,9 @@ fun when_through(i: Int): Int {
return value
}
@Test fun runTest() {
if (when_through(2) != 1) throw Error()
fun box(): String {
val res = when_through(2)
if (res != 1) return "FAIL $res"
return "OK"
}
@@ -3,14 +3,17 @@
* that can be found in the LICENSE file.
*/
package codegen.branching.when_with_try1
import kotlin.test.*
@Test fun runTest() {
println(foo(Any()))
println(foo("zzz"))
println(foo("42"))
fun box(): String {
val res1 = foo(Any())
if (res1 != null) return "FAIL 1: $res1"
val res2 = foo("zzz")
if (res2 != null) return "FAIL 2: $res2"
val res3 = foo("42")
if (res3 != 42) return "FAIL 3: $res3"
return "OK"
}
fun foo(value: Any): Int? {
@@ -1,3 +0,0 @@
null
null
42