[K/N][Tests] Move codegen test sources interfaceCallsNCasts..vector

^KT-61259
This commit is contained in:
Vladimir Sukharev
2023-12-15 00:13:04 +01:00
committed by Space Team
parent 56e1c5cbc6
commit 93642020ff
182 changed files with 2023 additions and 686 deletions
@@ -0,0 +1,17 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import kotlin.test.*
import kotlin.native.internal.*
object ClassWithComputedField {
val x : Int
get() = 4
}
fun box(): String {
assertTrue(ClassWithComputedField.isPermanent())
return "OK"
}
@@ -0,0 +1,31 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import kotlin.test.*
import kotlin.native.internal.*
var ClassWithConstructorInitialized = 0
object ClassWithConstructor {
init {
ClassWithConstructorInitialized += 1
}
const val A = 1;
}
fun box(): String {
assertEquals(0, ClassWithConstructorInitialized)
assertEquals(1, ClassWithConstructor.A)
assertEquals(0, ClassWithConstructorInitialized)
val unused1 = ClassWithConstructor
assertEquals(1, unused1.A)
assertEquals(1, ClassWithConstructorInitialized)
val unused2 = ClassWithConstructor
assertEquals(1, unused2.A)
assertEquals(1, ClassWithConstructorInitialized)
assertFalse(ClassWithConstructor.isPermanent())
return "OK"
}
@@ -0,0 +1,15 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import kotlin.test.*
import kotlin.native.internal.*
object EmptyClass {}
fun box(): String {
assertTrue(EmptyClass.isPermanent())
return "OK"
}
@@ -0,0 +1,17 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import kotlin.test.*
import kotlin.native.internal.*
object ClassWithField {
val x = 4
}
fun box(): String {
assertFalse(ClassWithField.isPermanent())
return "OK"
}
@@ -0,0 +1,38 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import kotlin.test.*
import kotlin.native.internal.*
object ClassWithConstants {
const val A = 1
const val B = 2L
const val C = 3.0
const val D = 4.0f
const val E = 5.toShort()
const val F = 6.toByte()
const val G = "8"
}
fun box(): String {
assertTrue(ClassWithConstants.isPermanent())
assertEquals(1, ClassWithConstants.A)
assertEquals(2, ClassWithConstants.B)
assertEquals(3.0, ClassWithConstants.C)
assertEquals(4.0f, ClassWithConstants.D)
assertEquals(5, ClassWithConstants.E)
assertEquals(6, ClassWithConstants.F)
assertEquals("8", ClassWithConstants.G)
assertEquals(1, (ClassWithConstants::A)())
assertEquals(2, (ClassWithConstants::B)())
assertEquals(3.0, (ClassWithConstants::C)())
assertEquals(4.0f, (ClassWithConstants::D)())
assertEquals(5, (ClassWithConstants::E)())
assertEquals(6, (ClassWithConstants::F)())
assertEquals("8", (ClassWithConstants::G)())
return "OK"
}
@@ -0,0 +1,28 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
@file:OptIn(FreezingIsDeprecated::class, kotlin.experimental.ExperimentalNativeApi::class)
package codegen.objectDeclaration.isFrozen
import kotlin.test.*
import kotlin.native.concurrent.*
object X {
var value: Int = 0
}
@Test fun runTest() {
if (Platform.memoryModel == MemoryModel.STRICT) {
assertTrue(X.isFrozen)
assertFailsWith<InvalidMutabilityException> {
X.value = 42
}
assertEquals(0, X.value)
} else {
assertFalse(X.isFrozen)
X.value = 42
assertEquals(42, X.value)
}
}