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,10 @@
|
||||
fun aa(vararg a : String): String = a[0]
|
||||
|
||||
fun box(): String {
|
||||
var result: String = ""
|
||||
var i = 1
|
||||
while (3 > i++) {
|
||||
result = aa(if (true) "OK" else "fail")
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package whats.the.difference
|
||||
|
||||
import java.util.HashSet
|
||||
|
||||
fun iarray(vararg a : Int) = a // BUG
|
||||
|
||||
fun IntArray.lastIndex() = size - 1
|
||||
|
||||
fun box() : String {
|
||||
// Problematic code does not compile
|
||||
// val vals = iarray(789, 678, 567, 456, 345, 234, 123, 012)
|
||||
|
||||
val vals = iarray(789, 678, 567, 456, 345, 234, 123, 12)
|
||||
val diffs = HashSet<Int>()
|
||||
for (i in vals.indices)
|
||||
for (j in i..vals.lastIndex())
|
||||
diffs.add(vals[i] - vals[j])
|
||||
val size = diffs.size()
|
||||
|
||||
if (size != 8) return "Fail $size"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fun <T> Array<T>?.get(i : Int?) = this!!.get(i!!)
|
||||
fun <T> array(vararg t : T) : Array<T> = t
|
||||
|
||||
fun box() : String {
|
||||
val a : Array<String>? = array<String>("Str", "Str2")
|
||||
val i : Int? = 1
|
||||
return if(a[i] == "Str2") "OK" else "fail"
|
||||
}
|
||||
Reference in New Issue
Block a user