Move blackBoxFile() testData to box/ directory
Delete all test methods (and empty test classes), since they'll be auto-generated
This commit is contained in:
committed by
Alexander Udalov
parent
ecbb2f10ef
commit
41a416da60
@@ -0,0 +1,6 @@
|
||||
val Int.test = "test"
|
||||
|
||||
fun box(): String {
|
||||
val x = "a ${1.test}"
|
||||
return if (x == "a test") "OK" else "Fail $x"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
fun box() : String {
|
||||
val b = 1+1
|
||||
if ("$b" != "2") return "fail"
|
||||
if ("${1+1}" != "2") return "fail"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fun Int.plus(s: String) : String {
|
||||
System.out?.println("Int.plus(s: String) called")
|
||||
return s
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
val s = "${1 + "a"}"
|
||||
return if(s == "a") "OK" else "fail"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fun stringConcat(n : Int) : String? {
|
||||
var string : String? = ""
|
||||
for (i in 0..(n - 1))
|
||||
string += "LOL "
|
||||
return string
|
||||
}
|
||||
|
||||
fun box() = if(stringConcat(3) == "LOL LOL LOL ") "OK" else "fail"
|
||||
@@ -0,0 +1,31 @@
|
||||
fun box() : String {
|
||||
val s = "abc"
|
||||
val test1 = """$s"""
|
||||
if (test1 != "abc") return "Fail 1: $test1"
|
||||
|
||||
val test2 = """${s}"""
|
||||
if (test2 != "abc") return "Fail 2: $test2"
|
||||
|
||||
val test3 = """ "$s" """
|
||||
if (test3 != " \"abc\" ") return "Fail 3: $test3"
|
||||
|
||||
val test4 = """ "${s}" """
|
||||
if (test4 != " \"abc\" ") return "Fail 4: $test4"
|
||||
|
||||
val test5 =
|
||||
"""
|
||||
${s.length}
|
||||
"""
|
||||
if (test5 != "\n 3\n") return "Fail 5: $test5"
|
||||
|
||||
val test6 = """\n"""
|
||||
if (test6 != "\\n") return "Fail 6: $test6"
|
||||
|
||||
val test7 = """\${'$'}foo"""
|
||||
if (test7 != "\\\$foo") return "Fail 7: $test7"
|
||||
|
||||
val test8 = """$ foo"""
|
||||
if (test8 != "$ foo") return "Fail 8: $test8"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
fun box() : String {
|
||||
val s = """ foo \n bar """
|
||||
if (s != " foo \\n bar ") return "Fail: '$s'"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user