[WASM/Native] Split AllCodePointsTest into two separate tests
This commit is contained in:
@@ -31,35 +31,24 @@ class AllCodePointsTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Here is a performance problem: an execution of this test requires much more time than it in Kotlin/JVM.
|
// TODO: Here is a performance problem: an execution of this test requires much more time than it in Kotlin/JVM.
|
||||||
@Test fun test() {
|
fun testImpl(regex: String, expectedCount: Int) {
|
||||||
// Regression for HARMONY-3145
|
// Regression for HARMONY-3145
|
||||||
var p = Regex("(\\p{all})+")
|
val p = Regex(regex)
|
||||||
var res = true
|
|
||||||
var cnt = 0
|
var cnt = 0
|
||||||
var s: String
|
|
||||||
for (i in 0..1114111) {
|
for (i in 0..1114111) {
|
||||||
s = codePointToString(i)
|
val s = codePointToString(i)
|
||||||
if (!s.matches(p)) {
|
if (!s.matches(p)) {
|
||||||
cnt++
|
cnt++
|
||||||
res = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertTrue(res)
|
assertEquals(expectedCount, cnt)
|
||||||
assertEquals(0, cnt)
|
}
|
||||||
|
|
||||||
p = Regex("(\\P{all})+")
|
@Test fun test1() {
|
||||||
res = true
|
testImpl("(\\p{all})+", 0)
|
||||||
cnt = 0
|
}
|
||||||
|
|
||||||
for (i in 0..1114111) {
|
@Test fun test2() {
|
||||||
s = codePointToString(i)
|
testImpl("(\\P{all})+", 0x110000)
|
||||||
if (!s.matches(p)) {
|
|
||||||
cnt++
|
|
||||||
res = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assertFalse(res)
|
|
||||||
assertEquals(0x110000, cnt)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user