Add ir interpreter tests
This commit is contained in:
committed by
TeamCityServer
parent
cc2d7340dc
commit
e28ab45c51
@@ -0,0 +1,23 @@
|
||||
@CompileTimeCalculation
|
||||
class A(val value: Int)
|
||||
|
||||
@CompileTimeCalculation
|
||||
fun changeAndReturnSum(intArray: IntArray, index: Int, newValue: Int): Int {
|
||||
intArray[index] = newValue
|
||||
var sum = 0
|
||||
for (i in intArray) sum += i
|
||||
return sum
|
||||
}
|
||||
|
||||
@CompileTimeCalculation
|
||||
fun changeAndReturnSumForObject(array: Array<A>, index: Int, newValue: A): Int {
|
||||
array[index] = newValue
|
||||
var sum = 0
|
||||
for (aObject in array) sum += aObject.value
|
||||
return sum
|
||||
}
|
||||
|
||||
const val a = arrayOf(1, 2, 3).<!EVALUATED: `3`!>size<!>
|
||||
const val b = <!EVALUATED: `15`!>changeAndReturnSum(intArrayOf(1, 2, 3), 0, 10)<!>
|
||||
const val c = emptyArray<Int>().<!EVALUATED: `0`!>size<!>
|
||||
const val d = <!EVALUATED: `15`!>changeAndReturnSumForObject(arrayOf(A(1), A(2), A(3)), 0, A(10))<!>
|
||||
Reference in New Issue
Block a user