[WASM/Native] Split AllCodePointsTest into two separate tests

This commit is contained in:
Igor Yakovlev
2022-02-03 17:57:39 +01:00
parent 8eec1743fb
commit d30a4fa4d5
@@ -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)
} }
} }