[IR] Add id method in interpreter's tests to avoid optimizations

This commit is contained in:
Ivan Kylchik
2023-04-11 17:23:11 +02:00
committed by Space Team
parent 621f5a0fb7
commit 3f60c83921
20 changed files with 552 additions and 532 deletions
@@ -2,6 +2,7 @@
// TARGET_BACKEND: NATIVE
// TARGET_BACKEND: JS_IR
// WITH_STDLIB
fun <T> T.id() = this
const val byteVal: UByte = <!EVALUATED("1")!>1u<!>
const val shortVal: UShort = <!EVALUATED("2")!>2u<!>
@@ -9,9 +10,9 @@ const val intVal: UInt = <!EVALUATED("3")!>3u<!>
const val longVal: ULong = <!EVALUATED("4")!>4uL<!>
fun box(): String {
if (<!EVALUATED("1")!>byteVal<!> != 1u.toUByte()) return "Fail 1"
if (<!EVALUATED("2")!>shortVal<!> != 2u.toUShort()) return "Fail 2"
if (<!EVALUATED("3")!>intVal<!> != 3u.toUInt()) return "Fail 3"
if (<!EVALUATED("4")!>longVal<!> != 4u.toULong()) return "Fail 4"
if (<!EVALUATED("1")!>byteVal<!>.id() != 1u.toUByte()) return "Fail 1"
if (<!EVALUATED("2")!>shortVal<!>.id() != 2u.toUShort()) return "Fail 2"
if (<!EVALUATED("3")!>intVal<!>.id() != 3u.toUInt()) return "Fail 3"
if (<!EVALUATED("4")!>longVal<!>.id() != 4u.toULong()) return "Fail 4"
return "OK"
}