Skip to content

Commit 5d4d91e

Browse files
sbogolepovSpace
authored and
Space
committed
[K/N] Add testcase for KT-48591
1 parent af1d1c2 commit 5d4d91e

File tree

1 file changed

+16
-3
lines changed
  • kotlin-native/backend.native/tests/runtime/text

1 file changed

+16
-3
lines changed

kotlin-native/backend.native/tests/runtime/text/chars0.kt

+16-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ package runtime.text.chars0
77

88
import kotlin.test.*
99

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

1411
fun testIsSupplementaryCodePoint() {
1512
assertFalse(Char.isSupplementaryCodePoint(-1))
@@ -112,11 +109,27 @@ fun testCategory() {
112109
} catch (e: IllegalArgumentException) {}
113110
}
114111

112+
fun testIsHighSurrogate() {
113+
assertTrue('\uD800'.isHighSurrogate())
114+
assertTrue('\uDBFF'.isHighSurrogate())
115+
assertFalse('\uDC00'.isHighSurrogate())
116+
assertFalse('\uDFFF'.isHighSurrogate())
117+
}
118+
119+
fun testIsLowSurrogate() {
120+
assertFalse('\uD800'.isLowSurrogate())
121+
assertFalse('\uDBFF'.isLowSurrogate())
122+
assertTrue('\uDC00'.isLowSurrogate())
123+
assertTrue('\uDFFF'.isLowSurrogate())
124+
}
125+
115126
@Test fun runTest() {
116127
testIsSurrogatePair()
117128
testToChars()
118129
testToCodePoint()
119130
testIsSupplementaryCodePoint()
120131
testCase()
121132
testCategory()
133+
testIsHighSurrogate()
134+
testIsLowSurrogate()
122135
}

0 commit comments

Comments
 (0)