[K/N] Tests for volatile

^KT-54944
This commit is contained in:
Pavel Kunyavskiy
2022-11-30 18:28:47 +01:00
committed by Space Team
parent a11f6fd9cb
commit fc95b88eef
22 changed files with 1029 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
// WITH_STDLIB
// IGNORE_BACKEND: WASM, JS
// IGNORE_BACKEND_K1: JS_IR
// !API_VERSION: 1.9
import kotlin.concurrent.*
@OptIn(kotlin.ExperimentalStdlibApi::class)
class ByteWrapper(@Volatile var x: Byte)
val global = ByteWrapper(1)
fun box() : String {
val local = ByteWrapper(2)
if (global.x + local.x != 3) return "FAIL"
global.x = 5
local.x = 6
return if (global.x + local.x != 11) return "FAIL" else "OK"
}