[KT-65126] Initial version of Swift export integration tests

Here we reuse infrastructure from existing ObjC Framework tests.
It is not the prettiest approach, and ideally we would like to use XCTest,
but for now we need to quickly kick-start end-to-end tests.
This commit is contained in:
Sergey Bogolepov
2024-02-09 15:50:51 +02:00
parent 2d01c4ca4c
commit b5cb1fddff
8 changed files with 280 additions and 0 deletions
@@ -0,0 +1,15 @@
fun fooByte(): Byte {
return -1
}
fun fooShort(): Short {
return -1
}
fun fooInt(): Int {
return -1
}
fun fooLong(): Long {
return -1
}
@@ -0,0 +1,35 @@
import Smokes
extension Bool {
static func ^ (left: Bool, right: Bool) -> Bool {
return left != right
}
}
func smoke() throws {
try assertEquals(actual: fooByte(), expected: -1)
try assertEquals(actual: fooShort(), expected: -1)
try assertEquals(actual: fooInt(), expected: -1)
try assertEquals(actual: fooLong(), expected: -1)
try assertEquals(actual: org.kotlin.plus(a: 1, b: 2, c: 3), expected: 1 + 2 + 3)
try assertEquals(actual: org.kotlin.logicalOr(a: true, b: true), expected: true || true)
try assertEquals(actual: org.kotlin.logicalOr(a: true, b: false), expected: true || false)
try assertEquals(actual: org.kotlin.logicalOr(a: false, b: false), expected: false || false)
try assertEquals(actual: org.kotlin.xor(a: true, b: true), expected: true ^ true)
try assertEquals(actual: org.kotlin.xor(a: true, b: false), expected: true ^ false)
try assertEquals(actual: org.kotlin.xor(a: false, b: false), expected: false ^ false)
}
class Smoke0Tests : TestProvider {
var tests: [TestCase] = []
init() {
providers.append(self)
tests = [
TestCase(name: "Smokes", method: withAutorelease(smoke)),
]
}
}
@@ -0,0 +1,8 @@
package org.kotlin
fun plus(a: Int, b: Int, c: Int) =
a + b + c
fun logicalOr(a: Boolean, b: Boolean) = a || b
fun xor(a: Boolean, b: Boolean) = a xor b