Skip to content

Commit

Permalink
[K/N] Add testcase for KT-48591
Browse files Browse the repository at this point in the history
  • Loading branch information
sbogolepov authored and Space committed Sep 10, 2021
1 parent af1d1c2 commit 5d4d91e
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions kotlin-native/backend.native/tests/runtime/text/chars0.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ package runtime.text.chars0

import kotlin.test.*

fun assertTrue(v: Boolean) = if (!v) throw AssertionError() else Unit
fun assertFalse(v: Boolean) = if (v) throw AssertionError() else Unit
fun assertEquals(a: Int, b: Int) { if (a != b) throw AssertionError() }

fun testIsSupplementaryCodePoint() {
assertFalse(Char.isSupplementaryCodePoint(-1))
Expand Down Expand Up @@ -112,11 +109,27 @@ fun testCategory() {
} catch (e: IllegalArgumentException) {}
}

fun testIsHighSurrogate() {
assertTrue('\uD800'.isHighSurrogate())
assertTrue('\uDBFF'.isHighSurrogate())
assertFalse('\uDC00'.isHighSurrogate())
assertFalse('\uDFFF'.isHighSurrogate())
}

fun testIsLowSurrogate() {
assertFalse('\uD800'.isLowSurrogate())
assertFalse('\uDBFF'.isLowSurrogate())
assertTrue('\uDC00'.isLowSurrogate())
assertTrue('\uDFFF'.isLowSurrogate())
}

@Test fun runTest() {
testIsSurrogatePair()
testToChars()
testToCodePoint()
testIsSupplementaryCodePoint()
testCase()
testCategory()
testIsHighSurrogate()
testIsLowSurrogate()
}

0 comments on commit 5d4d91e

Please sign in to comment.