[WASM] Initial infrastructure
- New module ":compiler:backend.wasm"
- Initial compiler infra (driver, phaser, context)
- Subset of Wasm AST
- Skeleton of IR -> Wasm AST
- Wasm AST -> WAT transformer
- Testing infra
- SpiderMonkey jsshell tool
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
import com.moowork.gradle.node.NodeExtension
|
||||
import com.moowork.gradle.node.npm.NpmTask
|
||||
import de.undercouch.gradle.tasks.download.Download
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
id("com.moowork.node").version("1.2.0")
|
||||
id("de.undercouch.download")
|
||||
}
|
||||
|
||||
node {
|
||||
download = true
|
||||
version = "10.16.2"
|
||||
}
|
||||
|
||||
val antLauncherJar by configurations.creating
|
||||
@@ -27,6 +30,7 @@ dependencies {
|
||||
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "idea_rt", "util") }
|
||||
testCompile(project(":compiler:backend.js"))
|
||||
testCompile(project(":compiler:backend.wasm"))
|
||||
testCompile(projectTests(":compiler:ir.serialization.js"))
|
||||
testCompile(project(":js:js.translator"))
|
||||
testCompile(project(":js:js.serializer"))
|
||||
@@ -65,7 +69,7 @@ sourceSets {
|
||||
}
|
||||
|
||||
|
||||
fun Test.setUpBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) {
|
||||
fun Test.setUpJsBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) {
|
||||
dependsOn(":dist")
|
||||
if (jsEnabled) dependsOn(testJsRuntime)
|
||||
if (jsIrEnabled) {
|
||||
@@ -74,14 +78,20 @@ fun Test.setUpBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) {
|
||||
dependsOn(":compiler:ir.serialization.js:generateKotlinTestKLib")
|
||||
}
|
||||
|
||||
exclude("org/jetbrains/kotlin/js/test/wasm/semantics/*")
|
||||
|
||||
if (jsEnabled && !jsIrEnabled) exclude("org/jetbrains/kotlin/js/test/ir/semantics/*")
|
||||
if (!jsEnabled && jsIrEnabled) include("org/jetbrains/kotlin/js/test/ir/semantics/*")
|
||||
|
||||
jvmArgs("-da:jdk.nashorn.internal.runtime.RecompilableScriptFunctionData") // Disable assertion which fails due to a bug in nashorn (KT-23637)
|
||||
workingDir = rootDir
|
||||
if (findProperty("kotlin.compiler.js.ir.tests.skip")?.toString()?.toBoolean() == true) {
|
||||
exclude("org/jetbrains/kotlin/js/test/ir/semantics/*")
|
||||
}
|
||||
setUpBoxTests()
|
||||
}
|
||||
|
||||
fun Test.setUpBoxTests() {
|
||||
workingDir = rootDir
|
||||
doFirst {
|
||||
systemProperty("kotlin.ant.classpath", antLauncherJar.asPath)
|
||||
systemProperty("kotlin.ant.launcher.class", "org.apache.tools.ant.Main")
|
||||
@@ -96,19 +106,19 @@ fun Test.setUpBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) {
|
||||
}
|
||||
|
||||
projectTest(parallel = true) {
|
||||
setUpBoxTests(jsEnabled = true, jsIrEnabled = true)
|
||||
setUpJsBoxTests(jsEnabled = true, jsIrEnabled = true)
|
||||
}
|
||||
|
||||
projectTest("jsTest", true) {
|
||||
setUpBoxTests(jsEnabled = true, jsIrEnabled = false)
|
||||
setUpJsBoxTests(jsEnabled = true, jsIrEnabled = false)
|
||||
}
|
||||
|
||||
projectTest("jsIrTest", true) {
|
||||
setUpBoxTests(jsEnabled = false, jsIrEnabled = true)
|
||||
setUpJsBoxTests(jsEnabled = false, jsIrEnabled = true)
|
||||
}
|
||||
|
||||
projectTest("quickTest", true) {
|
||||
setUpBoxTests(jsEnabled = true, jsIrEnabled = false)
|
||||
setUpJsBoxTests(jsEnabled = true, jsIrEnabled = false)
|
||||
systemProperty("kotlin.js.skipMinificationTest", "true")
|
||||
}
|
||||
|
||||
@@ -136,3 +146,58 @@ val runMocha by task<NpmTask> {
|
||||
val check by tasks
|
||||
check.dependsOn(this)
|
||||
}
|
||||
|
||||
enum class OsName { WINDOWS, MAC, LINUX, UNKNOWN }
|
||||
enum class OsArch { X86_32, X86_64, UNKNOWN }
|
||||
data class OsType(val name: OsName, val arch: OsArch)
|
||||
val currentOsType = run {
|
||||
val gradleOs = OperatingSystem.current()
|
||||
val osName = when {
|
||||
gradleOs.isMacOsX -> OsName.MAC
|
||||
gradleOs.isWindows -> OsName.WINDOWS
|
||||
gradleOs.isLinux -> OsName.LINUX
|
||||
else -> OsName.UNKNOWN
|
||||
}
|
||||
|
||||
val osArch = when (System.getProperty("sun.arch.data.model")) {
|
||||
"32" -> OsArch.X86_32
|
||||
"64" -> OsArch.X86_64
|
||||
else -> OsArch.UNKNOWN
|
||||
}
|
||||
|
||||
OsType(osName, osArch)
|
||||
}
|
||||
|
||||
val jsShellDirectory = "https://archive.mozilla.org/pub/firefox/nightly/2019/08/2019-08-11-09-56-40-mozilla-central"
|
||||
val jsShellSuffix = when (currentOsType) {
|
||||
OsType(OsName.LINUX, OsArch.X86_32) -> "linux-i686"
|
||||
OsType(OsName.LINUX, OsArch.X86_64) -> "linux-x86_64"
|
||||
OsType(OsName.MAC, OsArch.X86_64) -> "mac"
|
||||
OsType(OsName.WINDOWS, OsArch.X86_32) -> "win32"
|
||||
OsType(OsName.WINDOWS, OsArch.X86_64) -> "win64"
|
||||
else -> error("unsupported os type $currentOsType")
|
||||
}
|
||||
val jsShellLocation = "$jsShellDirectory/jsshell-$jsShellSuffix.zip"
|
||||
|
||||
val downloadedTools = File(buildDir, "tools")
|
||||
|
||||
val downloadJsShell by task<Download> {
|
||||
src(jsShellLocation)
|
||||
dest(File(downloadedTools, "jsshell-$jsShellSuffix.zip"))
|
||||
}
|
||||
|
||||
val unzipJsShell by task<Copy> {
|
||||
dependsOn(downloadJsShell)
|
||||
from(zipTree(downloadJsShell.get().dest))
|
||||
val unpackedDir = File(downloadedTools, "jsshell-$jsShellSuffix")
|
||||
into(unpackedDir)
|
||||
}
|
||||
|
||||
projectTest("wasmTest", true) {
|
||||
dependsOn(unzipJsShell)
|
||||
dependsOn(":compiler:ir.serialization.js:generateWasmRuntimeKLib")
|
||||
include("org/jetbrains/kotlin/js/test/wasm/semantics/*")
|
||||
val jsShellExecutablePath = File(unzipJsShell.get().destinationDir, "js").absolutePath
|
||||
systemProperty("javascript.engine.path.SpiderMonkey", jsShellExecutablePath)
|
||||
setUpBoxTests()
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.js.test.AbstractDceTest
|
||||
import org.jetbrains.kotlin.js.test.AbstractJsLineNumberTest
|
||||
import org.jetbrains.kotlin.js.test.ir.semantics.*
|
||||
import org.jetbrains.kotlin.js.test.semantics.*
|
||||
import org.jetbrains.kotlin.js.test.wasm.semantics.AbstractIrWasmBoxWasmTest
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
@@ -42,6 +43,14 @@ fun main(args: Array<String>) {
|
||||
testClass<AbstractJsLineNumberTest> {
|
||||
model("lineNumbers/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.JS)
|
||||
}
|
||||
|
||||
testClass<AbstractIrWasmBoxWasmTest> {
|
||||
model("wasmBox", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM)
|
||||
}
|
||||
|
||||
testClass<AbstractIrWasmBoxJsTest> {
|
||||
model("wasmBox", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.JS_IR)
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("js/js.tests/test", "compiler/testData", testRunnerMethodName = "runTest0") {
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vfs.StandardFileSystems
|
||||
import com.intellij.openapi.vfs.VirtualFileManager
|
||||
import com.intellij.psi.PsiManager
|
||||
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
|
||||
import org.jetbrains.kotlin.backend.common.phaser.toPhaseMap
|
||||
import org.jetbrains.kotlin.backend.wasm.compileWasm
|
||||
import org.jetbrains.kotlin.backend.wasm.wasmPhases
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.ir.backend.js.loadKlib
|
||||
import org.jetbrains.kotlin.js.config.JsConfig
|
||||
import org.jetbrains.kotlin.js.facade.TranslationUnit
|
||||
import org.jetbrains.kotlin.js.test.engines.SpiderMonkeyEngine
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtNamedFunction
|
||||
import org.jetbrains.kotlin.psi.KtPsiFactory
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment
|
||||
import java.io.Closeable
|
||||
import java.io.File
|
||||
|
||||
private val wasmRuntimeKlib =
|
||||
loadKlib("compiler/ir/serialization.js/build/wasmRuntime/klib")
|
||||
|
||||
abstract class BasicWasmBoxTest(
|
||||
private val pathToTestDir: String,
|
||||
testGroupOutputDirPrefix: String,
|
||||
pathToRootOutputDir: String = TEST_DATA_DIR_PATH
|
||||
) : KotlinTestWithEnvironment() {
|
||||
private val testGroupOutputDirForCompilation = File(pathToRootOutputDir + "out/" + testGroupOutputDirPrefix)
|
||||
|
||||
private val spiderMonkey by lazy { SpiderMonkeyEngine() }
|
||||
|
||||
fun doTest(filePath: String) {
|
||||
val file = File(filePath)
|
||||
val outputDir = getOutputDir(file)
|
||||
val fileContent = KotlinTestUtils.doLoadFile(file)
|
||||
|
||||
TestFileFactoryImpl().use { testFactory ->
|
||||
val inputFiles: MutableList<TestFile> = KotlinTestUtils.createTestFiles(file.name, fileContent, testFactory, true, "")
|
||||
val testPackage = testFactory.testPackage
|
||||
val outputFileBase = outputDir.absolutePath + "/" + getTestName(true)
|
||||
val outputWatFile = outputFileBase + ".wat"
|
||||
val outputJsFile = outputFileBase + ".js"
|
||||
|
||||
val kotlinFiles = inputFiles.filter { it.fileName.endsWith(".kt") }
|
||||
val psiFiles = createPsiFiles(kotlinFiles.map { File(it.fileName).canonicalPath }.sorted())
|
||||
val config = createConfig()
|
||||
translateFiles(
|
||||
psiFiles.map(TranslationUnit::SourceFile),
|
||||
File(outputWatFile),
|
||||
File(outputJsFile),
|
||||
config,
|
||||
testPackage,
|
||||
TEST_FUNCTION
|
||||
)
|
||||
|
||||
spiderMonkey.runFile(outputJsFile)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getOutputDir(file: File, testGroupOutputDir: File = testGroupOutputDirForCompilation): File {
|
||||
val stopFile = File(pathToTestDir)
|
||||
return generateSequence(file.parentFile) { it.parentFile }
|
||||
.takeWhile { it != stopFile }
|
||||
.map { it.name }
|
||||
.toList().asReversed()
|
||||
.fold(testGroupOutputDir, ::File)
|
||||
}
|
||||
|
||||
private fun translateFiles(
|
||||
units: List<TranslationUnit>,
|
||||
outputWatFile: File,
|
||||
outputJsFile: File,
|
||||
config: JsConfig,
|
||||
testPackage: String?,
|
||||
testFunction: String
|
||||
) {
|
||||
val filesToCompile = units.map { (it as TranslationUnit.SourceFile).file }
|
||||
val debugMode = false
|
||||
|
||||
val phaseConfig = if (debugMode) {
|
||||
val allPhasesSet = wasmPhases.toPhaseMap().values.toSet()
|
||||
val dumpOutputDir = File(outputWatFile.parent, outputWatFile.nameWithoutExtension + "-irdump")
|
||||
println("\n ------ Dumping phases to file://$dumpOutputDir")
|
||||
PhaseConfig(
|
||||
wasmPhases,
|
||||
dumpToDirectory = dumpOutputDir.path,
|
||||
toDumpStateAfter = allPhasesSet,
|
||||
toValidateStateAfter = allPhasesSet,
|
||||
dumpOnlyFqName = null
|
||||
)
|
||||
} else {
|
||||
PhaseConfig(wasmPhases)
|
||||
}
|
||||
|
||||
val compilerResult = compileWasm(
|
||||
project = config.project,
|
||||
files = filesToCompile,
|
||||
configuration = config.configuration,
|
||||
phaseConfig = phaseConfig,
|
||||
allDependencies = listOf(wasmRuntimeKlib),
|
||||
friendDependencies = emptyList(),
|
||||
exportedDeclarations = setOf(FqName.fromSegments(listOfNotNull(testPackage, testFunction)))
|
||||
)
|
||||
|
||||
outputWatFile.write(compilerResult.wat)
|
||||
|
||||
val runtime = File("libraries/stdlib/wasm/runtime/runtime.js").readText()
|
||||
|
||||
val testRunner = """
|
||||
const wat = read(String.raw`${outputWatFile.absoluteFile}`);
|
||||
const wasmBinary = wasmTextToBinary(wat);
|
||||
const wasmModule = new WebAssembly.Module(wasmBinary);
|
||||
const wasmInstance = new WebAssembly.Instance(wasmModule, { runtime });
|
||||
|
||||
const actualResult = wasmInstance.exports.$testFunction();
|
||||
if (actualResult !== "OK")
|
||||
throw `Wrong box result '${'$'}{actualResult}'; Expected "OK"`;
|
||||
""".trimIndent()
|
||||
|
||||
outputJsFile.write(runtime + "\n" + compilerResult.js + "\n" + testRunner)
|
||||
}
|
||||
|
||||
private fun createPsiFile(fileName: String): KtFile {
|
||||
val psiManager = PsiManager.getInstance(project)
|
||||
val fileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.FILE_PROTOCOL)
|
||||
|
||||
val file = fileSystem.findFileByPath(fileName) ?: error("File not found: $fileName")
|
||||
|
||||
return psiManager.findFile(file) as KtFile
|
||||
}
|
||||
|
||||
private fun createPsiFiles(fileNames: List<String>): List<KtFile> = fileNames.map(this::createPsiFile)
|
||||
|
||||
private fun createConfig(): JsConfig {
|
||||
val configuration = environment.configuration.copy()
|
||||
configuration.put(CommonConfigurationKeys.MODULE_NAME, TEST_MODULE)
|
||||
return JsConfig(project, configuration, null, null)
|
||||
}
|
||||
|
||||
private inner class TestFileFactoryImpl : KotlinTestUtils.TestFileFactoryNoModules<TestFile>(), Closeable {
|
||||
override fun create(fileName: String, text: String, directives: MutableMap<String, String>): TestFile {
|
||||
val ktFile = KtPsiFactory(project).createFile(text)
|
||||
val boxFunction = ktFile.declarations.find { it is KtNamedFunction && it.name == TEST_FUNCTION }
|
||||
if (boxFunction != null) {
|
||||
testPackage = ktFile.packageFqName.asString()
|
||||
if (testPackage?.isEmpty() == true) {
|
||||
testPackage = null
|
||||
}
|
||||
}
|
||||
|
||||
val temporaryFile = File(tmpDir, "WASM_TEST/$fileName")
|
||||
KotlinTestUtils.mkdirs(temporaryFile.parentFile)
|
||||
temporaryFile.writeText(text, Charsets.UTF_8)
|
||||
|
||||
return TestFile(temporaryFile.absolutePath)
|
||||
}
|
||||
|
||||
var testPackage: String? = null
|
||||
val tmpDir = KotlinTestUtils.tmpDir("wasm-tests")
|
||||
|
||||
override fun close() {
|
||||
FileUtil.delete(tmpDir)
|
||||
}
|
||||
}
|
||||
|
||||
private class TestFile(val fileName: String)
|
||||
|
||||
override fun createEnvironment() =
|
||||
KotlinCoreEnvironment.createForTests(testRootDisposable, CompilerConfiguration(), EnvironmentConfigFiles.JS_CONFIG_FILES)
|
||||
|
||||
companion object {
|
||||
const val TEST_DATA_DIR_PATH = "js/js.translator/testData/"
|
||||
const val TEST_MODULE = "WASM_TESTS"
|
||||
private const val TEST_FUNCTION = "box"
|
||||
}
|
||||
}
|
||||
|
||||
private fun File.write(text: String) {
|
||||
parentFile.mkdirs()
|
||||
writeText(text)
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.engines
|
||||
|
||||
import java.io.BufferedReader
|
||||
import java.io.InputStreamReader
|
||||
import kotlin.test.fail
|
||||
|
||||
class ExternalTool(val path: String) {
|
||||
fun run(vararg arguments: String) {
|
||||
val command = arrayOf(path, *arguments)
|
||||
val process = ProcessBuilder(*command)
|
||||
.redirectErrorStream(true)
|
||||
.start()
|
||||
|
||||
val commandString = command.joinToString(" ") { escapeShellArgument(it) }
|
||||
println(commandString)
|
||||
|
||||
// Print process output
|
||||
val input = BufferedReader(InputStreamReader(process.inputStream))
|
||||
while (true) println(input.readLine() ?: break)
|
||||
|
||||
val exitValue = process.waitFor()
|
||||
if (exitValue != 0) {
|
||||
fail("Command \"$commandString\" terminated with exit code $exitValue")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun escapeShellArgument(arg: String): String =
|
||||
"'${arg.replace("'", "'\\''")}'"
|
||||
|
||||
class SpiderMonkeyEngine(
|
||||
jsShellPath: String = System.getProperty("javascript.engine.path.SpiderMonkey")
|
||||
) {
|
||||
private val jsShell = ExternalTool(jsShellPath)
|
||||
|
||||
fun runFile(file: String) {
|
||||
jsShell.run(file)
|
||||
}
|
||||
}
|
||||
+548
@@ -0,0 +1,548 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.ir.semantics;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("js/js.translator/testData/wasmBox")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class IrWasmBoxJsTestGenerated extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInWasmBox() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("basicTypes.kt")
|
||||
public void testBasicTypes() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/basicTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("primitivesOperatos.kt")
|
||||
public void testPrimitivesOperatos() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/primitivesOperatos.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/number")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Number extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInNumber() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/number"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("assignmentIntOverflow.kt")
|
||||
public void testAssignmentIntOverflow() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/assignmentIntOverflow.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("byteAndShortConversions.kt")
|
||||
public void testByteAndShortConversions() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/byteAndShortConversions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("conversionsWithTruncation.kt")
|
||||
public void testConversionsWithTruncation() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/conversionsWithTruncation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("conversionsWithoutTruncation.kt")
|
||||
public void testConversionsWithoutTruncation() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/conversionsWithoutTruncation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("division.kt")
|
||||
public void testDivision() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/division.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("doubleConversions.kt")
|
||||
public void testDoubleConversions() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/doubleConversions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("hexadecimalConstant.kt")
|
||||
public void testHexadecimalConstant() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/hexadecimalConstant.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incDecOptimization.kt")
|
||||
public void testIncDecOptimization() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/incDecOptimization.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intConversions.kt")
|
||||
public void testIntConversions() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/intConversions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intDivFloat.kt")
|
||||
public void testIntDivFloat() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/intDivFloat.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intIncDecOverflow.kt")
|
||||
public void testIntIncDecOverflow() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/intIncDecOverflow.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intOverflow.kt")
|
||||
public void testIntOverflow() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/intOverflow.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt2342.kt")
|
||||
public void testKt2342() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/kt2342.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("longBinaryOperations.kt")
|
||||
public void testLongBinaryOperations() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/longBinaryOperations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("longBitOperations.kt")
|
||||
public void testLongBitOperations() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/longBitOperations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("longCompareToIntrinsic.kt")
|
||||
public void testLongCompareToIntrinsic() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/longCompareToIntrinsic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("longEqualsIntrinsic.kt")
|
||||
public void testLongEqualsIntrinsic() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/longEqualsIntrinsic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("longHashCode.kt")
|
||||
public void testLongHashCode() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/longHashCode.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("longUnaryOperations.kt")
|
||||
public void testLongUnaryOperations() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/longUnaryOperations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mixedTypesOverflow.kt")
|
||||
public void testMixedTypesOverflow() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/mixedTypesOverflow.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberCompareTo.kt")
|
||||
public void testNumberCompareTo() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/numberCompareTo.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberConversions.kt")
|
||||
public void testNumberConversions() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/numberConversions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberEquals.kt")
|
||||
public void testNumberEquals() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/numberEquals.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberIncDec.kt")
|
||||
public void testNumberIncDec() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/numberIncDec.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PassedCommonTests extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPassedCommonTests() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/boxingOptimization")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class BoxingOptimization extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInBoxingOptimization() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/boxingOptimization"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("explicitEqualsOnDouble.kt")
|
||||
public void testExplicitEqualsOnDouble() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/boxingOptimization/explicitEqualsOnDouble.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/classes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Classes extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInClasses() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/classes"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt2482.kt")
|
||||
public void testKt2482() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/classes/kt2482.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/constants")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Constants extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInConstants() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/constants"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("float.kt")
|
||||
public void testFloat() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/constants/float.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("long.kt")
|
||||
public void testLong() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/constants/long.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ControlStructures extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInControlStructures() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("ifConst1.kt")
|
||||
public void testIfConst1() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures/ifConst1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ifConst2.kt")
|
||||
public void testIfConst2() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures/ifConst2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt1899.kt")
|
||||
public void testKt1899() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures/kt1899.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/extensionProperties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ExtensionProperties extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInExtensionProperties() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/extensionProperties"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevel.kt")
|
||||
public void testTopLevel() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/extensionProperties/topLevel.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/functions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Functions extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInFunctions() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/functions"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt2280.kt")
|
||||
public void testKt2280() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/functions/kt2280.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/ieee754")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Ieee754 extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInIeee754() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/ieee754"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("lessDouble_properIeeeAndNewInference.kt")
|
||||
public void testLessDouble_properIeeeAndNewInference() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ieee754/lessDouble_properIeeeAndNewInference.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/ir")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Ir extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInIr() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/ir"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ClosureConversion extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInClosureConversion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("closureConversion1.kt")
|
||||
public void testClosureConversion1() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion/closureConversion1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("closureConversion3.kt")
|
||||
public void testClosureConversion3() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion/closureConversion3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("closureConversion4.kt")
|
||||
public void testClosureConversion4() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion/closureConversion4.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/labels")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Labels extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInLabels() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/labels"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAccessor.kt")
|
||||
public void testPropertyAccessor() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/labels/propertyAccessor.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class LazyCodegen extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInLazyCodegen() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen/optimizations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Optimizations extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInOptimizations() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen/optimizations"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("negateConstantCompare.kt")
|
||||
public void testNegateConstantCompare() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen/optimizations/negateConstantCompare.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class OperatorConventions extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInOperatorConventions() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotatedAssignment.kt")
|
||||
public void testAnnotatedAssignment() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions/annotatedAssignment.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("infixFunctionOverBuiltinMember.kt")
|
||||
public void testInfixFunctionOverBuiltinMember() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions/infixFunctionOverBuiltinMember.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PrimitiveTypes extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPrimitiveTypes() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("ea35963.kt")
|
||||
public void testEa35963() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/ea35963.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incrementByteCharShort.kt")
|
||||
public void testIncrementByteCharShort() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/incrementByteCharShort.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt1634.kt")
|
||||
public void testKt1634() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt1634.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt3078.kt")
|
||||
public void testKt3078() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt3078.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt6590_identityEquals.kt")
|
||||
public void testKt6590_identityEquals() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt6590_identityEquals.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt737.kt")
|
||||
public void testKt737() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt737.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt828.kt")
|
||||
public void testKt828() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt828.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt877.kt")
|
||||
public void testKt877() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt877.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/publishedApi")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PublishedApi extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPublishedApi() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/publishedApi"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevel.kt")
|
||||
public void testTopLevel() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/publishedApi/topLevel.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/unaryOp")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class UnaryOp extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInUnaryOp() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/unaryOp"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("intrinsic.kt")
|
||||
public void testIntrinsic() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/unaryOp/intrinsic.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/when")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class When extends AbstractIrWasmBoxJsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInWhen() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/when"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("noElseNoMatch.kt")
|
||||
public void testNoElseNoMatch() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/when/noElseNoMatch.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -15,6 +15,11 @@ abstract class AbstractIrJsCodegenBoxTest : BasicIrBoxTest(
|
||||
"codegen/irBox/"
|
||||
)
|
||||
|
||||
abstract class AbstractIrWasmBoxJsTest : BasicIrBoxTest(
|
||||
BasicBoxTest.TEST_DATA_DIR_PATH + "wasmBox/",
|
||||
"irWasmBox/"
|
||||
)
|
||||
|
||||
abstract class BorrowedIrInlineTest(relativePath: String) : BasicIrBoxTest(
|
||||
"compiler/testData/codegen/boxInline/$relativePath",
|
||||
"codegen/irBoxInline/$relativePath"
|
||||
|
||||
Generated
+553
@@ -0,0 +1,553 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.wasm.semantics;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("js/js.translator/testData/wasmBox")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class IrWasmBoxWasmTestGenerated extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInWasmBox() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("basicTypes.kt")
|
||||
public void testBasicTypes() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/basicTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("primitivesOperatos.kt")
|
||||
public void testPrimitivesOperatos() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/primitivesOperatos.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/number")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Number extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInNumber() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/number"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("assignmentIntOverflow.kt")
|
||||
public void testAssignmentIntOverflow() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/assignmentIntOverflow.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("byteAndShortConversions.kt")
|
||||
public void testByteAndShortConversions() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/byteAndShortConversions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("conversionsWithTruncation.kt")
|
||||
public void testConversionsWithTruncation() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/conversionsWithTruncation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("conversionsWithoutTruncation.kt")
|
||||
public void testConversionsWithoutTruncation() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/conversionsWithoutTruncation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("division.kt")
|
||||
public void testDivision() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/division.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("doubleConversions.kt")
|
||||
public void testDoubleConversions() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/doubleConversions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("hashCode.kt")
|
||||
public void testHashCode() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/hashCode.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("hexadecimalConstant.kt")
|
||||
public void testHexadecimalConstant() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/hexadecimalConstant.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incDecOptimization.kt")
|
||||
public void testIncDecOptimization() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/incDecOptimization.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intConversions.kt")
|
||||
public void testIntConversions() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/intConversions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intDivFloat.kt")
|
||||
public void testIntDivFloat() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/intDivFloat.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intIncDecOverflow.kt")
|
||||
public void testIntIncDecOverflow() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/intIncDecOverflow.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("intOverflow.kt")
|
||||
public void testIntOverflow() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/intOverflow.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt2342.kt")
|
||||
public void testKt2342() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/kt2342.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("longBinaryOperations.kt")
|
||||
public void testLongBinaryOperations() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/longBinaryOperations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("longBitOperations.kt")
|
||||
public void testLongBitOperations() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/longBitOperations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("longCompareToIntrinsic.kt")
|
||||
public void testLongCompareToIntrinsic() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/longCompareToIntrinsic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("longEqualsIntrinsic.kt")
|
||||
public void testLongEqualsIntrinsic() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/longEqualsIntrinsic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("longHashCode.kt")
|
||||
public void testLongHashCode() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/longHashCode.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("longUnaryOperations.kt")
|
||||
public void testLongUnaryOperations() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/longUnaryOperations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mixedTypesOverflow.kt")
|
||||
public void testMixedTypesOverflow() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/mixedTypesOverflow.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberCompareTo.kt")
|
||||
public void testNumberCompareTo() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/numberCompareTo.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberConversions.kt")
|
||||
public void testNumberConversions() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/numberConversions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberEquals.kt")
|
||||
public void testNumberEquals() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/numberEquals.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("numberIncDec.kt")
|
||||
public void testNumberIncDec() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/number/numberIncDec.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PassedCommonTests extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPassedCommonTests() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/boxingOptimization")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class BoxingOptimization extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInBoxingOptimization() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/boxingOptimization"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("explicitEqualsOnDouble.kt")
|
||||
public void testExplicitEqualsOnDouble() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/boxingOptimization/explicitEqualsOnDouble.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/classes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Classes extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInClasses() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/classes"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt2482.kt")
|
||||
public void testKt2482() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/classes/kt2482.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/constants")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Constants extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInConstants() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/constants"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("float.kt")
|
||||
public void testFloat() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/constants/float.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("long.kt")
|
||||
public void testLong() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/constants/long.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ControlStructures extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInControlStructures() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("ifConst1.kt")
|
||||
public void testIfConst1() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures/ifConst1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ifConst2.kt")
|
||||
public void testIfConst2() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures/ifConst2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt1899.kt")
|
||||
public void testKt1899() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/controlStructures/kt1899.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/extensionProperties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ExtensionProperties extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInExtensionProperties() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/extensionProperties"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevel.kt")
|
||||
public void testTopLevel() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/extensionProperties/topLevel.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/functions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Functions extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInFunctions() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/functions"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt2280.kt")
|
||||
public void testKt2280() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/functions/kt2280.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/ieee754")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Ieee754 extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInIeee754() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/ieee754"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("lessDouble_properIeeeAndNewInference.kt")
|
||||
public void testLessDouble_properIeeeAndNewInference() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ieee754/lessDouble_properIeeeAndNewInference.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/ir")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Ir extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInIr() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/ir"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ClosureConversion extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInClosureConversion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("closureConversion1.kt")
|
||||
public void testClosureConversion1() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion/closureConversion1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("closureConversion3.kt")
|
||||
public void testClosureConversion3() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion/closureConversion3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("closureConversion4.kt")
|
||||
public void testClosureConversion4() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/ir/closureConversion/closureConversion4.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/labels")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Labels extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInLabels() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/labels"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAccessor.kt")
|
||||
public void testPropertyAccessor() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/labels/propertyAccessor.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class LazyCodegen extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInLazyCodegen() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen/optimizations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Optimizations extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInOptimizations() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen/optimizations"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("negateConstantCompare.kt")
|
||||
public void testNegateConstantCompare() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/lazyCodegen/optimizations/negateConstantCompare.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class OperatorConventions extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInOperatorConventions() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotatedAssignment.kt")
|
||||
public void testAnnotatedAssignment() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions/annotatedAssignment.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("infixFunctionOverBuiltinMember.kt")
|
||||
public void testInfixFunctionOverBuiltinMember() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/operatorConventions/infixFunctionOverBuiltinMember.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PrimitiveTypes extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPrimitiveTypes() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("ea35963.kt")
|
||||
public void testEa35963() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/ea35963.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incrementByteCharShort.kt")
|
||||
public void testIncrementByteCharShort() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/incrementByteCharShort.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt1634.kt")
|
||||
public void testKt1634() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt1634.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt3078.kt")
|
||||
public void testKt3078() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt3078.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt6590_identityEquals.kt")
|
||||
public void testKt6590_identityEquals() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt6590_identityEquals.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt737.kt")
|
||||
public void testKt737() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt737.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt828.kt")
|
||||
public void testKt828() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt828.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt877.kt")
|
||||
public void testKt877() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/primitiveTypes/kt877.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/publishedApi")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PublishedApi extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPublishedApi() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/publishedApi"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevel.kt")
|
||||
public void testTopLevel() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/publishedApi/topLevel.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/unaryOp")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class UnaryOp extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInUnaryOp() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/unaryOp"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("intrinsic.kt")
|
||||
public void testIntrinsic() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/unaryOp/intrinsic.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/wasmBox/passedCommonTests/when")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class When extends AbstractIrWasmBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInWhen() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/wasmBox/passedCommonTests/when"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("noElseNoMatch.kt")
|
||||
public void testNoElseNoMatch() throws Exception {
|
||||
runTest("js/js.translator/testData/wasmBox/passedCommonTests/when/noElseNoMatch.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.wasm.semantics
|
||||
|
||||
import org.jetbrains.kotlin.js.test.BasicBoxTest
|
||||
import org.jetbrains.kotlin.js.test.BasicWasmBoxTest
|
||||
|
||||
abstract class AbstractIrWasmBoxWasmTest : BasicWasmBoxTest(BasicBoxTest.TEST_DATA_DIR_PATH + "wasmBox", "wasmBox/")
|
||||
|
||||
abstract class AbstractIrCodegenBoxWasmTest : BasicWasmBoxTest(
|
||||
"compiler/testData/codegen/box/",
|
||||
"codegen/wasmBox/"
|
||||
)
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
|
||||
fun foo(
|
||||
x1: Int,
|
||||
x2: Long,
|
||||
x3: Float,
|
||||
x4: Double
|
||||
): Int {
|
||||
var mtmp1: Int = 0
|
||||
var mtmp2: Long = 0L
|
||||
var mtmp3: Float = 0f
|
||||
var mtmp4: Double = 0.0
|
||||
val tmp1 = x1
|
||||
val tmp2 = x2
|
||||
val tmp3 = x3
|
||||
val tmp4 = x4
|
||||
mtmp1 = x1
|
||||
mtmp2 = x2
|
||||
mtmp3 = x3
|
||||
mtmp4 = x4
|
||||
return mtmp1
|
||||
}
|
||||
|
||||
var g1: Int = 0
|
||||
var g2: Long = 0L
|
||||
var g3: Float = 0f
|
||||
var g4: Double = 0.0
|
||||
fun fooUnit() {
|
||||
g1 = 10
|
||||
g2 = 10L
|
||||
g3 = 10f
|
||||
g4 = 10.0
|
||||
g1 = g1
|
||||
g2 = g2
|
||||
g3 = g3
|
||||
g4 = g4
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
fooUnit()
|
||||
val res = foo(42, 100L, 100f, 100.0)
|
||||
if (res == 42)
|
||||
return "OK"
|
||||
return "Fail"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
package foo
|
||||
|
||||
fun bigValue() = 0x7FFFFFFC
|
||||
|
||||
fun mediumValue() = 0x12345
|
||||
|
||||
fun box(): String {
|
||||
var v = bigValue()
|
||||
v += 1
|
||||
if (v != 0x7FFFFFFD) return "fail1"
|
||||
|
||||
v = bigValue()
|
||||
v += 8
|
||||
if (v != -0x7FFFFFFC) return "fail2"
|
||||
|
||||
v = mediumValue()
|
||||
v *= 0x23456
|
||||
if (v != -2112496338) return "fail3"
|
||||
|
||||
v = bigValue()
|
||||
v *= bigValue()
|
||||
if (v != 16) return "fail4"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1284
|
||||
package foo
|
||||
|
||||
fun testShortConversions(c: Short): Boolean {
|
||||
if (c.toDouble() != 3.0) {
|
||||
return false
|
||||
}
|
||||
if (c.toFloat() != 3.toFloat()) {
|
||||
return false
|
||||
}
|
||||
if (c.toByte() != 3.toByte()) {
|
||||
return false
|
||||
}
|
||||
if (c.toInt() != 3) {
|
||||
return false
|
||||
}
|
||||
if (c.toShort() != 3.toShort()) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun testByteConversions(c: Byte): Boolean {
|
||||
if (c.toDouble() != 3.0) {
|
||||
return false
|
||||
}
|
||||
if (c.toFloat() != 3.toFloat()) {
|
||||
return false
|
||||
}
|
||||
if (c.toByte() != 3.toByte()) {
|
||||
return false
|
||||
}
|
||||
if (c.toInt() != 3) {
|
||||
return false
|
||||
}
|
||||
if (c.toShort() != 3.toShort()) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (!testShortConversions(3)) return "fail: testShortConversions"
|
||||
if (!testByteConversions(3)) return "fail: testByteConversions"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1227
|
||||
package foo
|
||||
|
||||
// TODO: Floats to ints
|
||||
|
||||
fun box(): String {
|
||||
|
||||
// assertEquals(65, 321.0.toByte())
|
||||
// assertEquals(-56, 200.0.toByte())
|
||||
//
|
||||
// assertEquals(65, 321.0f.toByte())
|
||||
// assertEquals(-56, 200.0f.toByte())
|
||||
|
||||
assertEquals(65, 321L.toByte())
|
||||
assertEquals(-56, 200L.toByte())
|
||||
|
||||
assertEquals(65, 321.toByte())
|
||||
assertEquals(-56, 200.toByte())
|
||||
|
||||
assertEquals(65, (321.toShort()).toByte())
|
||||
assertEquals(-56, (200.toShort()).toByte())
|
||||
|
||||
// assertEquals(-1, 65535.0.toShort())
|
||||
// assertEquals(-1, 65535.0f.toShort())
|
||||
assertEquals(-1, 65535L.toShort())
|
||||
assertEquals(-1, 65535.toShort())
|
||||
|
||||
// assertEquals(65535, 65535.2.toInt())
|
||||
// assertEquals(23, 23.6f.toInt())
|
||||
// assertEquals(-12, -12.4.toShort())
|
||||
// assertEquals(-12, -12.4.toByte())
|
||||
|
||||
assertEquals('\u0419', (-654311).toChar())
|
||||
// assertEquals('\u0419', (-654311.0).toChar())
|
||||
// assertEquals('\u0419', (-654311.0f).toChar())
|
||||
|
||||
// TODO: Long.toString
|
||||
val longX: Long = 9223372034707292481L
|
||||
// assertEquals("9223372034707292481", longX.toString())
|
||||
|
||||
assertEquals(-2147483327, longX.toInt())
|
||||
assertEquals(321, longX.toShort())
|
||||
assertEquals(65, longX.toByte())
|
||||
assertEquals('\u0141', longX.toChar())
|
||||
|
||||
val intX: Int = longX.toInt()
|
||||
assertEquals(321, intX.toShort())
|
||||
assertEquals(65, intX.toByte())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1293
|
||||
package foo
|
||||
|
||||
//fun testForNumber(numberX: Number) {
|
||||
// assertEquals(true, 65.0 == numberX.toDouble())
|
||||
// assertEquals(true, 65.0f == numberX.toFloat())
|
||||
// assertEquals(true, 65L == numberX.toLong())
|
||||
// assertEquals(true, 65 == numberX.toInt())
|
||||
// assertEquals(true, 65.toShort() == numberX.toShort())
|
||||
// assertEquals(true, 65.toByte() == numberX.toByte())
|
||||
// assertEquals(true, 'A' == numberX.toChar())
|
||||
//}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
// TODO: Number is not supported yet
|
||||
// testForNumber(65.0)
|
||||
// testForNumber(65.0f)
|
||||
// testForNumber(65L)
|
||||
// testForNumber(65)
|
||||
// testForNumber(65.toShort())
|
||||
// testForNumber(65.toByte())
|
||||
|
||||
var doubleX: Double = 65.0
|
||||
assertEquals(true, 65.0 == doubleX.toDouble())
|
||||
assertEquals(true, 65.0f == doubleX.toFloat())
|
||||
// TODO: Float to integer convertions are not supported yet
|
||||
// assertEquals(true, 65L == doubleX.toLong())
|
||||
// assertEquals(true, 65 == doubleX.toInt())
|
||||
// assertEquals(true, 65.toShort() == doubleX.toShort())
|
||||
// assertEquals(true, 65.toByte() == doubleX.toByte())
|
||||
// assertEquals(true, 'A' == doubleX.toChar())
|
||||
|
||||
var floatX: Float = 65.0f
|
||||
assertEquals(true, 65.0 == floatX.toDouble())
|
||||
assertEquals(true, 65.0f == floatX.toFloat())
|
||||
// TODO: Float to integer convertions are not supported yet
|
||||
// assertEquals(true, 65L == floatX.toLong())
|
||||
// assertEquals(true, 65 == floatX.toInt())
|
||||
// assertEquals(true, 65.toShort() == floatX.toShort())
|
||||
// assertEquals(true, 65.toByte() == floatX.toByte())
|
||||
// assertEquals(true, 'A' == floatX.toChar())
|
||||
|
||||
val longX: Long = 65L
|
||||
assertEquals(true, 65.0 == longX.toDouble())
|
||||
assertEquals(true, 65.0f == longX.toFloat())
|
||||
assertEquals(true, 65L == longX.toLong())
|
||||
assertEquals(true, 65 == longX.toInt())
|
||||
assertEquals(true, 65.toShort() == longX.toShort())
|
||||
assertEquals(true, 65.toByte() == longX.toByte())
|
||||
assertEquals(true, 'A' == longX.toChar())
|
||||
|
||||
val intX: Int = 65
|
||||
assertEquals(true, 65.0 == intX.toDouble())
|
||||
assertEquals(true, 65.0f == intX.toFloat())
|
||||
assertEquals(true, 65L == intX.toLong())
|
||||
assertEquals(true, 65 == intX.toInt())
|
||||
assertEquals(true, 65.toShort() == intX.toShort())
|
||||
assertEquals(true, 65.toByte() == intX.toByte())
|
||||
assertEquals(true, 'A' == intX.toChar())
|
||||
|
||||
val shortX: Short = 65.toShort()
|
||||
assertEquals(true, 65.0 == shortX.toDouble())
|
||||
assertEquals(true, 65.0f == shortX.toFloat())
|
||||
assertEquals(true, 65L == shortX.toLong())
|
||||
assertEquals(true, 65 == shortX.toInt())
|
||||
assertEquals(true, 65.toShort() == shortX.toShort())
|
||||
assertEquals(true, 65.toByte() == shortX.toByte())
|
||||
assertEquals(true, 'A' == shortX.toChar())
|
||||
|
||||
val byteX: Byte = 65.toByte()
|
||||
assertEquals(true, 65.0 == byteX.toDouble())
|
||||
assertEquals(true, 65.0f == byteX.toFloat())
|
||||
assertEquals(true, 65L == byteX.toLong())
|
||||
assertEquals(true, 65 == byteX.toInt())
|
||||
assertEquals(true, 65.toShort() == byteX.toShort())
|
||||
assertEquals(true, 65.toByte() == byteX.toByte())
|
||||
assertEquals(true, 'A' == byteX.toChar())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1280
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
if (3 / 4 != 0) {
|
||||
return "fail11"
|
||||
}
|
||||
if (-5 / 4 != -1) {
|
||||
return "fail2"
|
||||
}
|
||||
if ((3.0 / 4.0 - 0.75) > 0.01) {
|
||||
return "fail3"
|
||||
}
|
||||
if ((-10.0 / 4.0 + 2.5) > 0.01) {
|
||||
return "fail44"
|
||||
}
|
||||
val i1: Int = 5
|
||||
val i2: Int = 2
|
||||
if (i1 / i2 != 2) {
|
||||
return "fail55"
|
||||
}
|
||||
val i3: Short = 5
|
||||
val i4: Short = 2
|
||||
if (i3 / i4 != 2) {
|
||||
return "fail6"
|
||||
}
|
||||
val i5: Byte = 5
|
||||
val i6: Byte = 2
|
||||
if (i5 / i6 != 2) {
|
||||
return "fail7"
|
||||
}
|
||||
|
||||
val f1: Double = 5.0
|
||||
val f2: Double = 2.0
|
||||
if ((f1 / f2 - 2.5) > 0.01) {
|
||||
return "fail8"
|
||||
}
|
||||
|
||||
val f3: Float = 5.0.toFloat()
|
||||
val f4: Float = 2.0.toFloat()
|
||||
if ((f3 / f4 - 2.5.toFloat()) > 0.01) {
|
||||
return "fail9"
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1222
|
||||
|
||||
// IGNORE_BACKEND: WASM
|
||||
// TODO: Support floating-point to integer conversions
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
val c: Double = 3.6
|
||||
if (c.toDouble() != 3.6) {
|
||||
return "fail1"
|
||||
}
|
||||
if (c.toFloat() != 3.6.toFloat()) {
|
||||
return "fail2"
|
||||
}
|
||||
if (c.toByte() != 3.toByte()) {
|
||||
return "fail3"
|
||||
}
|
||||
if (c.toInt() != 3) {
|
||||
return "fail4"
|
||||
}
|
||||
if (c.toShort() != 3.toShort()) {
|
||||
return "fail5"
|
||||
}
|
||||
|
||||
val cn: Double = -3.6
|
||||
if (cn.toDouble() != -3.6) {
|
||||
return "fail6"
|
||||
}
|
||||
if (cn.toFloat() != -3.6.toFloat()) {
|
||||
return "fail7"
|
||||
}
|
||||
if (cn.toByte() != (-3).toByte()) {
|
||||
return "fail8"
|
||||
}
|
||||
if (cn.toInt() != -3) {
|
||||
return "fail9"
|
||||
}
|
||||
if (cn.toShort() != (-3).toShort()) {
|
||||
return "fail10"
|
||||
}
|
||||
|
||||
val f: Float = 3.6.toFloat()
|
||||
if (f.toDouble() != 3.6) {
|
||||
return "fail11"
|
||||
}
|
||||
if (f.toFloat() != 3.6.toFloat()) {
|
||||
return "fail12"
|
||||
}
|
||||
if (f.toByte() != 3.toByte()) {
|
||||
return "fail13"
|
||||
}
|
||||
if (f.toInt() != 3) {
|
||||
return "fail14"
|
||||
}
|
||||
if (f.toShort() != 3.toShort()) {
|
||||
return "fail15"
|
||||
}
|
||||
|
||||
val fn: Float = -3.6.toFloat()
|
||||
if (fn.toDouble() != -3.6) {
|
||||
return "fail16"
|
||||
}
|
||||
if (fn.toFloat() != -3.6.toFloat()) {
|
||||
return "fail17"
|
||||
}
|
||||
if (fn.toByte() != (-3).toByte()) {
|
||||
return "fail18"
|
||||
}
|
||||
if (fn.toInt() != -3) {
|
||||
return "fail19"
|
||||
}
|
||||
if (fn.toShort() != (-3).toShort()) {
|
||||
return "fail20"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// TARGET_BACKEND: WASM
|
||||
// EXPECTED_REACHABLE_NODES: 1280
|
||||
|
||||
// NOTE: Hash codes are the same as in Native and JVM
|
||||
|
||||
fun box(): String {
|
||||
var value = (3).hashCode()
|
||||
if (value != 3) return "fail1"
|
||||
|
||||
value = (3.14).hashCode()
|
||||
if (value != 300063655) return "fail2"
|
||||
|
||||
value = (3.14159).hashCode()
|
||||
if (value != -1340954729) return "fail3"
|
||||
|
||||
value = (1e80).hashCode()
|
||||
if (value != 24774576) return "fail4"
|
||||
|
||||
value = (1e81).hashCode()
|
||||
if (value != -1007271154) return "fail5"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1219
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
val i = 0x80000000 + 0x8000000
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1283
|
||||
// CHECK_VARS_COUNT: function=test count=1
|
||||
|
||||
// TODO: Support classes
|
||||
|
||||
fun test(): String {
|
||||
|
||||
var i = 23
|
||||
|
||||
var x = ++i
|
||||
if (x != 24) return "fail1:"
|
||||
|
||||
i++
|
||||
if (i != 25) return "fail2:"
|
||||
|
||||
// a.i++, used as expression, requires temporary variable
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun box(): String = test()
|
||||
@@ -0,0 +1,29 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
val c: Int = 3
|
||||
if (c.toDouble() != 3.0) {
|
||||
return "fail1"
|
||||
}
|
||||
if (c.toFloat() != 3.toFloat()) {
|
||||
return "fail2"
|
||||
}
|
||||
if (c.toByte() != 3.toByte()) {
|
||||
return "fail3"
|
||||
}
|
||||
if (c.toInt() != 3) {
|
||||
return "fail4"
|
||||
}
|
||||
if (c.toShort() != 3.toShort()) {
|
||||
return "fail5"
|
||||
}
|
||||
val c2: Int = -5
|
||||
if (c2.toShort() != (-5).toShort()) {
|
||||
return "fail6"
|
||||
}
|
||||
if (c2.toFloat() != -5.toFloat()) {
|
||||
return "fail7"
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1284
|
||||
// http://youtrack.jetbrains.com/issue/KT-5345
|
||||
// KT-5345 (Javascript) Type mismatch on Int / Float division
|
||||
// If any of Number operands is floating-point, the result should be float too.
|
||||
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(0.5f, 1 / 2.0f, "Int / Float")
|
||||
|
||||
assertEquals(0.5, 1 / 2.0, "Int / Double")
|
||||
|
||||
assertEquals(0.5f, 1.toShort() / 2.0f, "Short / Float")
|
||||
assertEquals(0.5, 1.toShort() / 2.0, "Short / Double")
|
||||
|
||||
assertEquals(0.5f, 1.toByte() / 2.0f, "Byte / Float")
|
||||
assertEquals(0.5, 1.toByte() / 2.0, "Byte / Double")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
package foo
|
||||
|
||||
|
||||
fun box(): String {
|
||||
var b: Byte = 0x7F
|
||||
b++
|
||||
if (b.toInt() != -0x80) return "fail1a"
|
||||
b--
|
||||
if (b.toInt() != 0x7F) return "fail1b"
|
||||
|
||||
var s: Short = 0x7FFF
|
||||
s++
|
||||
if (s.toInt() != -0x8000) return "fail2a"
|
||||
s--
|
||||
if (s.toInt() != 0x7FFF) return "fail2b"
|
||||
|
||||
var i: Int = 0x7FFFFFFF
|
||||
i++
|
||||
if (i != -0x80000000) return "fail3a"
|
||||
i--
|
||||
if (i != 0x7FFFFFFF) return "fail3b"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1284
|
||||
package foo
|
||||
|
||||
fun bigValue() = 0x7FFFFFFC
|
||||
|
||||
fun mediumValue() = 0x12345
|
||||
|
||||
fun four() = 4
|
||||
|
||||
fun box(): String {
|
||||
var v = bigValue() + 1
|
||||
if (v != 0x7FFFFFFD) return "fail1"
|
||||
|
||||
v = bigValue() + 8
|
||||
if (v != -0x7FFFFFFC) return "fail2"
|
||||
|
||||
v = bigValue() + four() + 4
|
||||
if (v != -0x7FFFFFFC) return "fail3"
|
||||
|
||||
v = (bigValue() + four() - 4) shr 1
|
||||
if (v != 0x3FFFFFFE) return "fail3"
|
||||
|
||||
v = mediumValue() * 0x23456
|
||||
if (v != -2112496338) return "fail5"
|
||||
|
||||
v = bigValue() * bigValue()
|
||||
if (v != 16) return "fail6"
|
||||
|
||||
v = -minInt()
|
||||
if (v != -2147483648) return "fail7"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun minInt() = -2147483648
|
||||
@@ -0,0 +1,20 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1281
|
||||
package foo
|
||||
|
||||
fun test(a: Int, b: Int, expected: Int): Int {
|
||||
val result = a / b
|
||||
if (expected == result) return 100
|
||||
return 25
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var r = test(10, 3, 3)
|
||||
if (r != 100) return "Fail1"
|
||||
|
||||
r = test(49, 6, 8)
|
||||
if (r != 100) return "Fail 2"
|
||||
|
||||
if (2133 / 3 / 7 / (91 / 5) != 5) return "2133 / 3 / 7 / (91 / 5) != 5"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1230
|
||||
package foo
|
||||
|
||||
fun fact(n: Int): Long = if (n == 1) 1L else n * fact(n - 1)
|
||||
|
||||
// TODO: Support loops
|
||||
//fun fib(n: Int): Long {
|
||||
// var a = 0L
|
||||
// var b = 1L
|
||||
// for (i in 2..n) {
|
||||
// var tmp = a
|
||||
// a = b
|
||||
// b = b + tmp
|
||||
// }
|
||||
// return b
|
||||
//}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
assertEquals(30.0, 10L + 20.0)
|
||||
assertEquals(30.0f, 10L + 20.0f)
|
||||
assertEquals(30L, 10L + 20L)
|
||||
assertEquals(30L, 10L + 20)
|
||||
assertEquals(30L, 10L + 20.toShort())
|
||||
assertEquals(30L, 10L + 20.toByte())
|
||||
|
||||
assertEquals(30.0, 20.0 + 10L)
|
||||
assertEquals(30.0f, 20.0f + 10L)
|
||||
assertEquals(20L, 10 + 10L)
|
||||
assertEquals(20L, 10.toShort() + 10L)
|
||||
assertEquals(20L, 10.toByte() + 10L)
|
||||
|
||||
assertEquals(20L, 30 - 10L)
|
||||
|
||||
assertEquals(100L, 10 * 10L)
|
||||
assertEquals(100.0, 10.0 * 10L)
|
||||
|
||||
assertEquals(100L, 10L * 10)
|
||||
assertEquals(100.0, 10L * 10.0)
|
||||
|
||||
assertEquals(100L, 1000L / 10)
|
||||
assertEquals(100L, 1000 / 10L)
|
||||
|
||||
assertEquals(100.0, 1000L / 10.0)
|
||||
assertEquals(100.0, 1000.0 / 10L)
|
||||
|
||||
assertEquals(2L, 100L % 7)
|
||||
assertEquals(2L, 100 % 7L)
|
||||
|
||||
assertEquals(2432902008176640000L, fact(20))
|
||||
|
||||
// TODO: Support loops
|
||||
// assertEquals(12586269025L, fib(50))
|
||||
// assertEquals(7540113804746346429L, fib(92))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1228
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
|
||||
assertEquals(65536L, 1L shl 16)
|
||||
assertEquals(1L, 65536L shr 16)
|
||||
|
||||
assertEquals(-1L, -1L shr 48)
|
||||
assertEquals(65535L, -1L ushr 48)
|
||||
|
||||
assertEquals(-1L, 0L.inv())
|
||||
|
||||
assertEquals(0b1000L, 0b1100L and 0b1010L)
|
||||
assertEquals(0b1110L, 0b1100L or 0b1010L)
|
||||
assertEquals(0b0110L, 0b1100L xor 0b1010L)
|
||||
|
||||
assertEquals(0xab88ac0021L, 0xabcdef0123L and 0xefaabcdef1L)
|
||||
assertEquals(0xefefffdff3L, 0xabcdef0123L or 0xefaabcdef1L)
|
||||
assertEquals(0x446753dfd2L, 0xabcdef0123L xor 0xefaabcdef1L)
|
||||
assertEquals(-737894400292, 0xabcdef0123L.inv())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1226
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
|
||||
assertEquals(true, 10.0 < 20L, "Double.compareTo(Long)")
|
||||
assertEquals(true, 10.0 < 7540113804746346429L, "Double.compareTo(Long)")
|
||||
|
||||
assertEquals(true, 10.0f < 20L, "Float.compareTo(Long)")
|
||||
assertEquals(true, 10.0f < 7540113804746346429L, "Float.compareTo(Long)")
|
||||
|
||||
assertEquals(true, 10L < 20L, "Long.compareTo(Long)")
|
||||
assertEquals(true, 10 < 20L, "Int.compareTo(Long)")
|
||||
assertEquals(true, 10 < 7540113804746346429L, "Int.compareTo(Long)")
|
||||
|
||||
assertEquals(true, 10.toShort() < 20L, "Short.compareTo(Long)")
|
||||
assertEquals(true, 10.toShort() < 7540113804746346429L, "Short.compareTo(Long)")
|
||||
assertEquals(true, 10.toByte() < 20L, "Byte.compareTo(Long)")
|
||||
assertEquals(true, 10.toByte() < 7540113804746346429L, "Byte.compareTo(Long)")
|
||||
|
||||
assertEquals(true, 10L < 20.0, "Long.compareTo(Double)")
|
||||
assertEquals(false, 7540113804746346429L < 20.0, "Long.compareTo(Double)")
|
||||
|
||||
assertEquals(true, 10L < 20.0f, "Long.compareTo(Float)")
|
||||
assertEquals(true, 7540113804746346429L > 20.0f, "Long.compareTo(Float)")
|
||||
assertEquals(false, 7540113804746346429L < 20.0f, "Long.compareTo(Float)")
|
||||
|
||||
assertEquals(true, 10L < 20, "Long.compareTo(Int)")
|
||||
assertEquals(true, 7540113804746346429L > 20, "Long.compareTo(Int)")
|
||||
assertEquals(false, 7540113804746346429L < 20, "Long.compareTo(Int)")
|
||||
|
||||
assertEquals(true, 10L < 20.toShort(), "Long.compareTo(Short)")
|
||||
assertEquals(true, 7540113804746346429L > 20.toShort(), "Long.compareTo(Short)")
|
||||
assertEquals(false, 7540113804746346429L < 20.toShort(), "Long.compareTo(Short)")
|
||||
|
||||
assertEquals(true, 10L < 20.toByte(), "Long.compareTo(Byte)")
|
||||
assertEquals(true, 7540113804746346429L > 20.toByte(), "Long.compareTo(Byte)")
|
||||
assertEquals(false, 7540113804746346429L < 20.toByte(), "Long.compareTo(Byte)")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1284
|
||||
package foo
|
||||
|
||||
// WASM: TODO: Nullable types, Number, Any
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(true, 10L == 10L, "Long == Long")
|
||||
assertEquals(true, 10L != 11L, "Long != Long")
|
||||
|
||||
// val x1: Long? = 10L
|
||||
// val x2: Long? = 10L
|
||||
// assertEquals(false, x1 == null, "Long? == null")
|
||||
// assertEquals(false, null == x1, "null == Long?")
|
||||
// assertEquals(true, x1 == 10L, "Long? == Long")
|
||||
// assertEquals(true, 10L == x1, "Long == Long?")
|
||||
// assertEquals(true, x1 == x2, "Long? == Long?")
|
||||
|
||||
// val x3: Long? = null
|
||||
// val x4: Long? = null
|
||||
// assertEquals(true, x3 == null, "Long?(null) == null")
|
||||
// assertEquals(true, null == x3, "null == Long?(null)")
|
||||
// assertEquals(false, x3 == 10L, "Long?(null) == Long")
|
||||
// assertEquals(false, 10L == x3, "Long == Long?(null)")
|
||||
// assertEquals(false, x3 == x1, "Long?(null) == Long?")
|
||||
// assertEquals(true, x3 == x4, "Long?(null) == Long?(null)")
|
||||
|
||||
// val number1: Number = 10L
|
||||
// val number2: Number = 10L
|
||||
// assertEquals(true, number1 == number2, "Number == Number")
|
||||
// assertEquals(true, number1 == 10L, "Number == Long")
|
||||
// assertEquals(true, number1 != 11L, "Number != Long")
|
||||
// assertEquals(true, 10L == number1, "Long == Number")
|
||||
// assertEquals(true, 11L != number1, "Long != Number")
|
||||
//
|
||||
// val y1: Any = 10L
|
||||
// var y2: Any = 10
|
||||
// var y3: Any? = null
|
||||
// assertEquals(true, y1 == 10L, "Any == Long")
|
||||
// assertEquals(true, 10L == y1, "Long == Any 1")
|
||||
// assertEquals(false, 10L == y2, "Long == Any 2")
|
||||
// assertEquals(false, 10L == y3, "Long == Any?(null)")
|
||||
// assertEquals(true, x3 == y3, "Long?(null) == Any?(null)")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1284
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
var l1: Long = 0x12344478935690
|
||||
var l2: Long = 0x12344478935698
|
||||
var diff: Long = l2 - l1
|
||||
l1 += (diff / 2)
|
||||
l2 -= (diff / 2)
|
||||
|
||||
assertEquals(l1, l2, "When L1 == L2")
|
||||
assertEquals(l1.hashCode(), l2.hashCode(), "L1.hashCode() == L2.hashCode()")
|
||||
|
||||
// var l3: Any = l2
|
||||
// assertEquals(l1.hashCode(), l3.hashCode(), "Any(Long).hashCode()")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1225
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
|
||||
var x: Long = 2L
|
||||
x++
|
||||
assertEquals(3L, x)
|
||||
++x
|
||||
assertEquals(4L, x)
|
||||
|
||||
var y = x++
|
||||
assertEquals(4L, y)
|
||||
assertEquals(5L, x)
|
||||
|
||||
y = ++x
|
||||
assertEquals(6L, y)
|
||||
assertEquals(6L, x)
|
||||
|
||||
x--
|
||||
assertEquals(5L, x)
|
||||
--x
|
||||
assertEquals(4L, x)
|
||||
|
||||
y = +x
|
||||
assertEquals(4L, y)
|
||||
|
||||
y = -x
|
||||
assertEquals(-4L, y)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1284
|
||||
// IGNORE_BACKEND: JS
|
||||
package foo
|
||||
|
||||
// TODO(WASM) Companions are not supported yet
|
||||
|
||||
fun box(): String {
|
||||
val byteOne = 1.toByte()
|
||||
val shortOne = 1.toShort()
|
||||
var v: Int
|
||||
|
||||
v = maxInt() + byteOne
|
||||
if (v != minInt()) return "fail1"
|
||||
|
||||
v = minInt() - byteOne
|
||||
if (v != maxInt()) return "fail2"
|
||||
|
||||
v = maxInt() + shortOne
|
||||
if (v != minInt()) return "fail3"
|
||||
|
||||
v = minInt() - shortOne
|
||||
if (v != maxInt()) return "fail4"
|
||||
|
||||
v = maxInt() * 127 // Byte.MAX_VALUE
|
||||
if (v != 2147483521) return "fail5"
|
||||
|
||||
v = maxInt() * 32767 // Short.MAX_VALUE
|
||||
if (v != 2147450881) return "fail6"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun minInt() = -2147483648 // Int.MIN_VALUE
|
||||
fun maxInt() = 2147483647 // Int.MAX_VALUE
|
||||
@@ -0,0 +1,127 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1289
|
||||
package foo
|
||||
|
||||
// TODO: Wasm global initialization is not supported
|
||||
//var global: String = ""
|
||||
//
|
||||
//fun id(s: String, value: Int): Int {
|
||||
// global += s
|
||||
// return value
|
||||
//}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
assertEquals(-1, 1.compareTo(2))
|
||||
// assertEquals(-1, (1 as Comparable<Int>).compareTo(2))
|
||||
|
||||
assertEquals(-1, 1.compareTo(2L))
|
||||
assertEquals(-1, 1.compareTo(2L))
|
||||
assertEquals(-1, 1.compareTo(7540113804746346429L))
|
||||
assertEquals(-1, 1.compareTo(2.toShort()))
|
||||
assertEquals(-1, 1.compareTo(2.toByte()))
|
||||
assertEquals(-1, 1.compareTo(2.0))
|
||||
assertEquals(-1, 1.compareTo(2.0f))
|
||||
|
||||
assertEquals(1, 10.compareTo(2L))
|
||||
assertEquals(1, 10.compareTo(2))
|
||||
assertEquals(1, 10.compareTo(2.toShort()))
|
||||
assertEquals(1, 10.compareTo(2.toByte()))
|
||||
assertEquals(1, 10.compareTo(2.0))
|
||||
assertEquals(1, 10.compareTo(2.0f))
|
||||
|
||||
assertEquals(0, 2.compareTo(2L))
|
||||
assertEquals(0, 2.compareTo(2))
|
||||
assertEquals(0, 2.compareTo(2.toShort()))
|
||||
assertEquals(0, 2.compareTo(2.toByte()))
|
||||
assertEquals(0, 2.compareTo(2.0))
|
||||
assertEquals(0, 2.compareTo(2.0f))
|
||||
|
||||
assertEquals(-1, 1.toShort().compareTo(2L))
|
||||
assertEquals(-1, 1.toShort().compareTo(7540113804746346429L))
|
||||
assertEquals(-1, 1.toShort().compareTo(2))
|
||||
assertEquals(-1, 1.toShort().compareTo(2.toShort()))
|
||||
// assertEquals(-1, (1.toShort() as Comparable<Short>).compareTo(2.toShort()))
|
||||
assertEquals(-1, 1.toShort().compareTo(2.toByte()))
|
||||
assertEquals(-1, 1.toShort().compareTo(2.0))
|
||||
assertEquals(-1, 1.toShort().compareTo(2.0f))
|
||||
|
||||
assertEquals(1, 10.toByte().compareTo(2L))
|
||||
assertEquals(-1, 10.toByte().compareTo(7540113804746346429L))
|
||||
assertEquals(1, 10.toByte().compareTo(2))
|
||||
assertEquals(1, 10.toByte().compareTo(2.toShort()))
|
||||
assertEquals(1, 10.toByte().compareTo(2.toByte()))
|
||||
// assertEquals(1, (10.toByte() as Comparable<Byte>).compareTo(2.toByte()))
|
||||
assertEquals(1, 10.toByte().compareTo(2.0))
|
||||
assertEquals(1, 10.toByte().compareTo(2.0f))
|
||||
|
||||
assertEquals(0, 2.0.compareTo(2L))
|
||||
assertEquals(-1, 2.0.compareTo(7540113804746346429L))
|
||||
assertEquals(0, 2.0.compareTo(2))
|
||||
assertEquals(0, 2.0.compareTo(2.toShort()))
|
||||
assertEquals(0, 2.0.compareTo(2.toByte()))
|
||||
assertEquals(0, 2.0.compareTo(2.0))
|
||||
// assertEquals(0, (2.0 as Comparable<Double>).compareTo(2.0))
|
||||
assertEquals(0, 2.0.compareTo(2.0f))
|
||||
|
||||
assertEquals(1, 3.0f.compareTo(2L))
|
||||
assertEquals(-1, 3.0f.compareTo(7540113804746346429L))
|
||||
assertEquals(1, 3.0f.compareTo(2))
|
||||
assertEquals(1, 3.0f.compareTo(2.toShort()))
|
||||
assertEquals(1, 3.0f.compareTo(2.toByte()))
|
||||
assertEquals(1, 3.0f.compareTo(2.0))
|
||||
assertEquals(1, 3.0f.compareTo(2.0f))
|
||||
// assertEquals(1, (3.0f as Comparable<Float>).compareTo(2.0f))
|
||||
|
||||
assertEquals(1, 10L.compareTo(2L))
|
||||
assertEquals(-1, 10L.compareTo(7540113804746346429L))
|
||||
// assertEquals(1, (10L as Comparable<Long>).compareTo(2L))
|
||||
assertEquals(1, 10L.compareTo(2))
|
||||
assertEquals(1, 10L.compareTo(2.toShort()))
|
||||
assertEquals(1, 10L.compareTo(2.toByte()))
|
||||
assertEquals(1, 10L.compareTo(2.0))
|
||||
assertEquals(1, 10L.compareTo(2.0f))
|
||||
|
||||
assertEquals(0, 'A'.compareTo('A'))
|
||||
|
||||
assertEquals(-1, 1L.compareTo(2L))
|
||||
assertEquals(-1, 1L.compareTo(2))
|
||||
assertEquals(-1, 1L.compareTo(2.toShort()))
|
||||
assertEquals(-1, 1L.compareTo(2.toByte()))
|
||||
assertEquals(-1, 1L.compareTo(2.0))
|
||||
assertEquals(-1, 1L.compareTo(2.0f))
|
||||
|
||||
assertEquals(0, 7540113804746346429L.compareTo(7540113804746346429L))
|
||||
assertEquals(1, 7540113804746346429L.compareTo(2L))
|
||||
assertEquals(0, 2L.compareTo(2L))
|
||||
assertEquals(0, 2L.compareTo(2))
|
||||
assertEquals(0, 2L.compareTo(2.toShort()))
|
||||
assertEquals(0, 2L.compareTo(2.toByte()))
|
||||
assertEquals(0, 2L.compareTo(2.0))
|
||||
assertEquals(0, 2L.compareTo(2.0f))
|
||||
|
||||
assertEquals(1, 10L.compareTo(2L))
|
||||
assertEquals(1, 10L.compareTo(2))
|
||||
assertEquals(1, 10L.compareTo(2.toShort()))
|
||||
assertEquals(1, 10L.compareTo(2.toByte()))
|
||||
assertEquals(1, 10L.compareTo(2.0))
|
||||
assertEquals(1, 10L.compareTo(2.0f))
|
||||
|
||||
assertEquals(-1, 1L.compareTo(2L))
|
||||
assertEquals(-1, 1L.compareTo(2))
|
||||
assertEquals(-1, 1L.compareTo(2.toShort()))
|
||||
assertEquals(-1, 1L.compareTo(2.toByte()))
|
||||
assertEquals(-1, 1L.compareTo(2.0))
|
||||
assertEquals(-1, 1L.compareTo(2.0f))
|
||||
|
||||
assertEquals(0, 2L.compareTo(2L))
|
||||
assertEquals(0, 2L.compareTo(2))
|
||||
assertEquals(0, 2L.compareTo(2.toShort()))
|
||||
assertEquals(0, 2L.compareTo(2.toByte()))
|
||||
assertEquals(0, 2L.compareTo(2.0))
|
||||
assertEquals(0, 2L.compareTo(2.0f))
|
||||
|
||||
// assertEquals(1, id("A", 10).compareTo(id("B", 5)))
|
||||
// assertEquals("AB", global)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1289
|
||||
package foo
|
||||
|
||||
fun testIntegerConversions(c: Byte): Boolean {
|
||||
if (c.toDouble() != 3.0) {
|
||||
return false
|
||||
}
|
||||
if (c.toFloat() != 3.toFloat()) {
|
||||
return false
|
||||
}
|
||||
if (c.toByte() != 3.toByte()) {
|
||||
return false
|
||||
}
|
||||
if (c.toInt() != 3) {
|
||||
return false
|
||||
}
|
||||
if (c.toShort() != 3.toShort()) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun testIntegerConversions(c: Short): Boolean {
|
||||
if (c.toDouble() != 3.0) {
|
||||
return false
|
||||
}
|
||||
if (c.toFloat() != 3.toFloat()) {
|
||||
return false
|
||||
}
|
||||
if (c.toByte() != 3.toByte()) {
|
||||
return false
|
||||
}
|
||||
if (c.toInt() != 3) {
|
||||
return false
|
||||
}
|
||||
if (c.toShort() != 3.toShort()) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun testIntegerConversions(c: Int): Boolean {
|
||||
if (c.toDouble() != 3.0) {
|
||||
return false
|
||||
}
|
||||
if (c.toFloat() != 3.toFloat()) {
|
||||
return false
|
||||
}
|
||||
if (c.toByte() != 3.toByte()) {
|
||||
return false
|
||||
}
|
||||
if (c.toInt() != 3) {
|
||||
return false
|
||||
}
|
||||
if (c.toShort() != 3.toShort()) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
fun testFloatingPointConversions(c: Float): Boolean {
|
||||
// This is FALSE on JVM
|
||||
// if (c.toDouble() != 3.6) {
|
||||
// return false
|
||||
// }
|
||||
if (c.toFloat() != 3.6.toFloat()) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun testFloatingPointConversions(c: Double): Boolean {
|
||||
if (c.toDouble() != 3.6) {
|
||||
return false
|
||||
}
|
||||
if (c.toFloat() != 3.6.toFloat()) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
if (!testIntegerConversions(3)) return "fail: testIntegerConversions1"
|
||||
if (!testFloatingPointConversions(3.6)) return "fail: testFloatingPointConversions1"
|
||||
if (!testFloatingPointConversions(3.6.toFloat())) return "fail: testFloaintPointConversions2"
|
||||
if (!testIntegerConversions(3.toByte())) return "fail: testIntegerConversions2"
|
||||
if (!testIntegerConversions(3.toShort())) return "fail: testIntegerConversions3"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
package foo
|
||||
|
||||
|
||||
//fun testNullable(): String {
|
||||
// val undefined: Double? = js("undefined")
|
||||
// val doubleNull: Double? = null
|
||||
//
|
||||
// val plusZero: Double? = +0.0
|
||||
// val minusZero: Double? = -0.0
|
||||
//
|
||||
// if ((+0.0).equals(minusZero)) return "Total order fail"
|
||||
// if (plusZero != minusZero) return "IEEE 754 equals fail"
|
||||
//
|
||||
// if (plusZero == doubleNull) return "+0.0 != null fail"
|
||||
// if (plusZero == undefined) return "+0.0 != undefined fail"
|
||||
//
|
||||
// if (undefined != doubleNull) return "undefined == null fail"
|
||||
// if (undefined != undefined) return "undefined = undefined fail"
|
||||
// if (doubleNull != doubleNull) return "doubleNull = doubleNull fail"
|
||||
//
|
||||
// // Double == Float
|
||||
// val plusZeroAny: Any? = +0.0
|
||||
// val minusZeroAny: Any? = -0.0f
|
||||
//
|
||||
// if (plusZeroAny is Double && minusZeroAny is Float) {
|
||||
// if (plusZeroAny != minusZeroAny) return "IEEE 754 quals fail 2"
|
||||
// }
|
||||
//
|
||||
// return "OK"
|
||||
//}
|
||||
|
||||
fun box(): String {
|
||||
val plusZero: Double = +0.0
|
||||
val minusZero: Double = -0.0
|
||||
|
||||
if (plusZero.equals(minusZero)) return "Total order fail"
|
||||
if (plusZero != minusZero) return "IEEE 754 equals fail"
|
||||
|
||||
val plusZeroFloat: Float = +0.0f
|
||||
val minusZeroFloat: Float = -0.0f
|
||||
|
||||
if (plusZeroFloat.equals(minusZeroFloat)) return "Total order fail 2"
|
||||
if (plusZeroFloat != minusZeroFloat) return "IEEE 754 equals fail 2"
|
||||
|
||||
// if ((plusZero as Any) == (minusZero as Any)) return "Total order fail 4"
|
||||
// if ((plusZeroFloat as Any) == (minusZeroFloat as Any)) return "Total order fail 5"
|
||||
// if (plusZero == (minusZero as Any)) return "Total order fail 6"
|
||||
|
||||
// val nullableRes = testNullable()
|
||||
// if (nullableRes != "OK")
|
||||
// return "Nullable" + nullableRes
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
|
||||
assertEquals(100.inc(), 101)
|
||||
assertEquals(100.dec(), 99)
|
||||
|
||||
var x = 100
|
||||
assertEquals(x.inc(), 101)
|
||||
assertEquals(x, 100)
|
||||
|
||||
assertEquals(x.dec(), 99)
|
||||
assertEquals(x, 100)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
|
||||
fun equals1(a: Double, b: Double) = a.equals(b)
|
||||
|
||||
fun box(): String {
|
||||
if ((-0.0).equals(0.0)) return "fail 0"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public fun box() : String {
|
||||
if ( 0 == 0 ) { // Does not crash if either this...
|
||||
if ( 0 == 0 ) { // ...or this is changed to if ( true )
|
||||
// Does not crash if the following is uncommented.
|
||||
//println("foo")
|
||||
}
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fun box(): String {
|
||||
if (1F != 1.toFloat()) return "fail 1"
|
||||
if (1.0F != 1.0.toFloat()) return "fail 2"
|
||||
if (1e1F != 1e1.toFloat()) return "fail 3"
|
||||
if (1.0e1F != 1.0e1.toFloat()) return "fail 4"
|
||||
if (1e-1F != 1e-1.toFloat()) return "fail 5"
|
||||
if (1.0e-1F != 1.0e-1.toFloat()) return "fail 6"
|
||||
|
||||
if (1f != 1.toFloat()) return "fail 7"
|
||||
if (1.0f != 1.0.toFloat()) return "fail 8"
|
||||
if (1e1f != 1e1.toFloat()) return "fail 9"
|
||||
if (1.0e1f != 1.0e1.toFloat()) return "fail 10"
|
||||
if (1e-1f != 1e-1.toFloat()) return "fail 11"
|
||||
if (1.0e-1f != 1.0e-1.toFloat()) return "fail 12"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
fun box(): String {
|
||||
if (1L != 1.toLong()) return "fail 1"
|
||||
if (0x1L != 0x1.toLong()) return "fail 2"
|
||||
if (0X1L != 0X1.toLong()) return "fail 3"
|
||||
if (0b1L != 0b1.toLong()) return "fail 4"
|
||||
if (0B1L != 0B1.toLong()) return "fail 5"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
fun foo(b: Boolean): String {
|
||||
return if (b) {
|
||||
"OK"
|
||||
} else if (false) {
|
||||
"fail: reached unreachable code at line 5"
|
||||
} else if (true) {
|
||||
"fail: reached unexpected code at line 7"
|
||||
} else if (true) {
|
||||
"fail: reached unreachable code at line 9"
|
||||
} else if (b) {
|
||||
"fail: reached unreachable code at line 11"
|
||||
} else {
|
||||
"fail: reached unreachable code at line 13"
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return foo(true)
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
fun foo(b: Boolean): String {
|
||||
return if (b) {
|
||||
"fail: reached unexpected code at line 3"
|
||||
} else if (false) {
|
||||
"fail: reached unreachable code at line 5"
|
||||
} else if (true) {
|
||||
"OK"
|
||||
} else if (true) {
|
||||
"fail: reached unreachable code at line 9"
|
||||
} else if (b) {
|
||||
"fail: reached unreachable code at line 11"
|
||||
} else {
|
||||
"fail: reached unreachable code at line 13"
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return foo(false)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fun box(): String {
|
||||
if (1 != 0) {
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
val Int.foo: String
|
||||
get() = "OK"
|
||||
|
||||
fun box(): String {
|
||||
return 1.foo
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun box(): String {
|
||||
fun rmrf(i: Int) {
|
||||
if (i > 0) rmrf(i - 1)
|
||||
}
|
||||
rmrf(5)
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons +NewInference
|
||||
|
||||
fun box(): String {
|
||||
if (-0.0 < 0.0) return "Fail 1"
|
||||
if (-0.0 < 0) return "Fail 2"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
fun foo(x: String): String {
|
||||
fun bar(y: String) = x + y
|
||||
return bar("K")
|
||||
}
|
||||
|
||||
fun box() = foo("O")
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
fun foo(x: String): String {
|
||||
fun bar(y: String): String {
|
||||
fun qux(z: String): String =
|
||||
x + y + z
|
||||
return qux("")
|
||||
}
|
||||
return bar("K")
|
||||
}
|
||||
|
||||
fun box(): String =
|
||||
foo("O")
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
fun String.foo(): String {
|
||||
fun bar(y: String) = this + y
|
||||
return bar("K")
|
||||
}
|
||||
|
||||
fun box() = "O".foo()
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
val Int.getter: Int
|
||||
get() {
|
||||
return this@getter
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val i = 1
|
||||
if (i.getter != 1) return "getter failed"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fun box(): String {
|
||||
if (!(1 < 2)) {
|
||||
return "fail"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class Annotation
|
||||
|
||||
fun box(): String {
|
||||
var v = 0
|
||||
@Annotation v += 1 + 2
|
||||
if (v != 3) return "fail1"
|
||||
|
||||
@Annotation v = 4
|
||||
if (v != 4) return "fail2"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
infix fun Int.rem(other: Int) = 10
|
||||
infix operator fun Int.minus(other: Int): Int = 20
|
||||
|
||||
fun box(): String {
|
||||
val a = 5 rem 2
|
||||
if (a != 10) return "fail 1"
|
||||
|
||||
val b = 5 minus 3
|
||||
if (b != 20) return "fail 2"
|
||||
|
||||
val a1 = 5.rem(2)
|
||||
if (a1 != 1) return "fail 3"
|
||||
|
||||
val b2 = 5.minus(3)
|
||||
if (b2 != 2) return "fail 4"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
fun box(): String {
|
||||
if (1 != 0) {
|
||||
1
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
fun byteArg(b: Byte) {}
|
||||
fun charArg(c: Char) {}
|
||||
fun shortArg(s: Short) {}
|
||||
|
||||
fun box(): String {
|
||||
var b = 42.toByte()
|
||||
b++
|
||||
++b
|
||||
byteArg(b)
|
||||
|
||||
var c = 'x'
|
||||
c++
|
||||
++c
|
||||
charArg(c)
|
||||
|
||||
var s = 239.toShort()
|
||||
s++
|
||||
++s
|
||||
shortArg(s)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
fun box(): String {
|
||||
!true
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun box(): String {
|
||||
if (1 >= 1.9) return "Fail #1"
|
||||
if (1.compareTo(1.1) >= 0) return "Fail #2"
|
||||
if (1.9 <= 1) return "Fail #3"
|
||||
if (1.1.compareTo(1) <= 0) return "Fail #4"
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
fun box(): String {
|
||||
val i: Int = 10000
|
||||
if (!(i === i)) return "Fail int ==="
|
||||
if (i !== i) return "Fail int !=="
|
||||
|
||||
val j: Long = 123L
|
||||
if (!(j === j)) return "Fail long ==="
|
||||
if (j !== j) return "Fail long !=="
|
||||
|
||||
val d: Double = 3.14
|
||||
if (!(d === d)) return "Fail double ==="
|
||||
if (d !== d) return "Fail double !=="
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun box(): String {
|
||||
if (3.compareTo(2) != 1) return "Fail #1"
|
||||
if (5.toByte().compareTo(10.toLong()) >= 0) return "Fail #2"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package demo
|
||||
|
||||
fun box() : String {
|
||||
var res : Boolean = true
|
||||
res = (res and false)
|
||||
res = (res or false)
|
||||
res = (res xor false)
|
||||
res = (true and false)
|
||||
res = (true or false)
|
||||
res = (true xor false)
|
||||
res = (!true)
|
||||
res = (true && false)
|
||||
res = (true || false)
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fun box() : String {
|
||||
var a : Int = -1
|
||||
if((+a) != -1) return "fail 1"
|
||||
a = 1
|
||||
if((+a) != 1) return "fail 2"
|
||||
if((+-1) != -1) return "fail 3"
|
||||
if((-+a) != -1) return "fail 4"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
@PublishedApi
|
||||
internal fun published() = "OK"
|
||||
|
||||
inline fun test() = published()
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
fun box() = test()
|
||||
@@ -0,0 +1,17 @@
|
||||
fun box(): String {
|
||||
val a1: Byte = -1
|
||||
val a2: Short = -1
|
||||
val a3: Int = -1
|
||||
val a4: Long = -1
|
||||
val a5: Double = -1.0
|
||||
val a6: Float = -1f
|
||||
|
||||
if (a1 != (-1).toByte()) return "fail 1"
|
||||
if (a2 != (-1).toShort()) return "fail 2"
|
||||
if (a3 != -1) return "fail 3"
|
||||
if (a4 != -1L) return "fail 4"
|
||||
if (a5 != -1.0) return "fail 5"
|
||||
if (a6 != -1f) return "fail 6"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fun box(): String {
|
||||
val x = 3
|
||||
when (x) {
|
||||
1 -> {}
|
||||
2 -> {}
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
fun box(): String {
|
||||
return "O" + "K"
|
||||
}
|
||||
Reference in New Issue
Block a user