[K/N][Tests] Migrate test platform_zlib.kt
^KT-61259
This commit is contained in:
committed by
Space Team
parent
06a89a0061
commit
3b4ca56f74
@@ -1505,13 +1505,6 @@ standaloneTest("interop_libiconv") {
|
|||||||
UtilsKt.dependsOnPlatformLibs(it)
|
UtilsKt.dependsOnPlatformLibs(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("interop_zlib") {
|
|
||||||
enabled = (project.testTarget == null)
|
|
||||||
source = "interop/platform_zlib.kt"
|
|
||||||
useGoldenData = true
|
|
||||||
UtilsKt.dependsOnPlatformLibs(it)
|
|
||||||
}
|
|
||||||
|
|
||||||
standaloneTest("interop_objc_illegal_sharing") {
|
standaloneTest("interop_objc_illegal_sharing") {
|
||||||
disabled = !PlatformInfo.isAppleTarget(project)
|
disabled = !PlatformInfo.isAppleTarget(project)
|
||||||
source = "interop/objc/illegal_sharing.kt"
|
source = "interop/objc/illegal_sharing.kt"
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
Hello!
|
|
||||||
Hello!
|
|
||||||
+7
-4
@@ -2,15 +2,17 @@
|
|||||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* Copyright 2010-2018 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.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
// TARGET_BACKEND: NATIVE
|
||||||
|
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
|
||||||
import kotlinx.cinterop.*
|
import kotlinx.cinterop.*
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
import platform.zlib.*
|
import platform.zlib.*
|
||||||
|
|
||||||
val source = immutableBlobOf(0xF3, 0x48, 0xCD, 0xC9, 0xC9, 0x57, 0x04, 0x00).asCPointer().reinterpret<UByteVar>()
|
val source = immutableBlobOf(0xF3, 0x48, 0xCD, 0xC9, 0xC9, 0x57, 0x04, 0x00).asCPointer().reinterpret<UByteVar>()
|
||||||
val golden = immutableBlobOf(0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x21, 0x00).asCPointer()
|
val golden = immutableBlobOf(0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x21, 0x00).asCPointer()
|
||||||
|
|
||||||
fun main(args: Array<String>) = memScoped {
|
fun box() = memScoped {
|
||||||
val buffer = ByteArray(32)
|
val buffer = ByteArray(32)
|
||||||
buffer.usePinned { pinned ->
|
buffer.usePinned { pinned ->
|
||||||
val z = alloc<z_stream>().apply {
|
val z = alloc<z_stream>().apply {
|
||||||
@@ -21,7 +23,8 @@ fun main(args: Array<String>) = memScoped {
|
|||||||
}.ptr
|
}.ptr
|
||||||
|
|
||||||
if (inflateInit2(z, -15) == Z_OK && inflate(z, Z_FINISH) == Z_STREAM_END && inflateEnd(z) == Z_OK)
|
if (inflateInit2(z, -15) == Z_OK && inflate(z, Z_FINISH) == Z_STREAM_END && inflateEnd(z) == Z_OK)
|
||||||
println(buffer.toKString())
|
assertEquals("Hello!", buffer.toKString())
|
||||||
}
|
}
|
||||||
println(golden.toKString())
|
assertEquals("Hello!", golden.toKString())
|
||||||
|
"OK"
|
||||||
}
|
}
|
||||||
+19
@@ -2862,6 +2862,25 @@ public class FirNativeCodegenLocalTestGenerated extends AbstractNativeCodegenBox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("native/native.tests/testData/codegen/interop")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@Tag("frontend-fir")
|
||||||
|
@FirPipeline()
|
||||||
|
@UseExtTestCaseGroupProvider()
|
||||||
|
public class Interop {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInInterop() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/codegen/interop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("platform_zlib.kt")
|
||||||
|
public void testPlatform_zlib() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/codegen/interop/platform_zlib.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("native/native.tests/testData/codegen/intrinsics")
|
@TestMetadata("native/native.tests/testData/codegen/intrinsics")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+17
@@ -2800,6 +2800,23 @@ public class NativeCodegenLocalTestGenerated extends AbstractNativeCodegenBoxTes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("native/native.tests/testData/codegen/interop")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@UseExtTestCaseGroupProvider()
|
||||||
|
public class Interop {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInInterop() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/codegen/interop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("platform_zlib.kt")
|
||||||
|
public void testPlatform_zlib() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/codegen/interop/platform_zlib.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("native/native.tests/testData/codegen/intrinsics")
|
@TestMetadata("native/native.tests/testData/codegen/intrinsics")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
Reference in New Issue
Block a user