Merge pull request #61 from wh0/patch-1

adjust UnicodeSupport.mergePairs logic
This commit is contained in:
Alexey Andreev 2015-02-22 22:33:43 +03:00
commit 103fc0f9cc
2 changed files with 22 additions and 2 deletions

View File

@ -144,12 +144,12 @@ public class UnicodeSupport {
int j = 0; int j = 0;
int t = 0; int t = 0;
while (true) { while (true) {
if (i == a.length) { if (j == b.length) {
while (i < a.length) { while (i < a.length) {
result[t++] = a[i++]; result[t++] = a[i++];
} }
break; break;
} else if (j == b.length) { } else if (i == a.length) {
while (j < b.length) { while (j < b.length) {
result[t++] = b[j++]; result[t++] = b[j++];
} }

View File

@ -0,0 +1,20 @@
package org.teavm.classlib.impl.unicode;
import static org.junit.Assert.assertFalse;
public class UnicodeSupportTest {
private static boolean pairsEqual(final int[] pairs, final int index1, final int index2) {
return pairs[index1] == pairs[index2] && pairs[index1 + 1] == pairs[index2 + 1];
}
@Test
public void test_getDigitValues() {
final int[] digitValues = UnicodeSupport.getDigitValues();
if (digitValues.length >= 4) {
// there are no duplicates, so the last two pairs should not be identical
assertFalse(pairsEqual(digitValues, digitValues.length - 4, digitValues.length - 2));
}
}
}