Support for Unsigned Types in swift export #KT-65668 fixed

Merge-request: KT-MR-14300
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
This commit is contained in:
Artem Olkov
2024-02-14 11:10:51 +00:00
committed by Space Team
parent fa5ae18980
commit 16b985b36e
12 changed files with 105 additions and 22 deletions
@@ -14,6 +14,24 @@ func smoke() throws {
try assertEquals(actual: org.kotlin.plus(a: 1, b: 2, c: 3), expected: 1 + 2 + 3)
// we expect strange stuff for plus and minus if UInt8 and UInt16 because kotlin behaves that way:
// https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-byte/minus.html
try assertEquals(actual: fooUByte(), expected: UInt8.min)
try assertEquals(actual: org.kotlin.minus(a: fooUByte(), b: UInt8(1)), expected: UInt32.max)
try assertEquals(actual: org.kotlin.plus(a: UInt8.max, b: UInt8(1)), expected: UInt32(256))
try assertEquals(actual: fooUShort(), expected: UInt16.min)
try assertEquals(actual: org.kotlin.minus(a: fooUShort(), b: UInt16(1)), expected: UInt32.max)
try assertEquals(actual: org.kotlin.plus(a: UInt16.max, b: UInt16(1)), expected: UInt32(65536))
try assertEquals(actual: fooUInt(), expected: UInt32.min)
try assertEquals(actual: org.kotlin.minus(a: fooUInt(), b: UInt32(1)), expected: UInt32.max)
try assertEquals(actual: org.kotlin.plus(a: UInt32.max, b: UInt32(1)), expected: UInt32.min)
try assertEquals(actual: fooULong(), expected: UInt64.min)
try assertEquals(actual: org.kotlin.minus(a: fooULong(), b: UInt64(1)), expected: UInt64.max)
try assertEquals(actual: org.kotlin.plus(a: UInt64.max, b: UInt64(1)), expected: UInt64.min)
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)