KT-903 test. unreproducable
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
import java.util.ArrayList
|
||||||
|
import java.util.List
|
||||||
|
|
||||||
|
fun Int.plus(a: Int?) = this + a.sure()
|
||||||
|
|
||||||
|
public open class PerfectNumberFinder() {
|
||||||
|
open public fun isPerfect(number : Int) : Boolean {
|
||||||
|
var factors : List<Int?>? = ArrayList<Int?>()
|
||||||
|
factors?.add(1)
|
||||||
|
factors?.add(number)
|
||||||
|
for (i in 2..(Math.sqrt((number).dbl) - 1).int)
|
||||||
|
if (((number % i) == 0)) {
|
||||||
|
factors?.add(i)
|
||||||
|
if (((number / i) != i))
|
||||||
|
factors?.add((number / i))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var sum : Int = 0
|
||||||
|
for (i : Int? in factors)
|
||||||
|
sum += i
|
||||||
|
return ((sum - number) == number)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box () = if (PerfectNumberFinder().isPerfect(28)) "OK" else "fail"
|
||||||
@@ -237,4 +237,8 @@ public class ClassGenTest extends CodegenTestCase {
|
|||||||
public void testKt857 () throws Exception {
|
public void testKt857 () throws Exception {
|
||||||
// blackBoxFile("regressions/kt857.jet");
|
// blackBoxFile("regressions/kt857.jet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testKt903 () throws Exception {
|
||||||
|
blackBoxFile("regressions/kt903.jet");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user