Added Duytschen

This commit is contained in:
Willem Cazander 2022-10-21 22:06:41 +02:00
parent 51864e2262
commit 0ecc63e44c
59 changed files with 624 additions and 295 deletions

View file

@ -0,0 +1,77 @@
package love.distributedrebirth.bassboon.jpp.lang;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import love.distributedrebirth.bassboon.clazz.BãßBȍőnAuthor注;
@BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
public class StringUnicodeTest {
// 8 icon glyphs, 29 word chars, 15 unicode points (and 58 bytes) and one length method
String test = "𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡 𑀪𑀸𑀕";
// Can we have this in top down china version too ?
String count = "";
String china1 = "";
String china2 = "";
String china3 = "";
String china4 = "";
String china = china1 + china2 + china3 + china4;
@Test
public void testCountChina() {
Assertions.assertEquals(4, china.length());
Assertions.assertEquals(4, StringUnicode.REAL.lengthCodePoints(china));
}
@Test
public void testCountOne() {
Assertions.assertEquals(1, count.length());
Assertions.assertEquals(1, StringUnicode.REAL.lengthCodePoints(count));
}
@Test
public void testStringLength() {
Assertions.assertNotEquals(StringUnicode.REAL.lengthCodePoints(test), test.length());
}
@Test
public void testStringChars() {
Assertions.assertEquals(StringUnicode.REAL.lengthChars(test), test.length());
}
@Test
public void testStringCodePointCount() {
Assertions.assertEquals(StringUnicode.REAL.lengthCodePoints(test), StringUnicode.REAL.codePointCount(test));
}
@Test
public void testStringLoopInt() {
StringBuilder buf = new StringBuilder();
for (int i=0;i<StringUnicode.REAL.lengthCodePoints(test);i++) {
int codePoint = StringUnicode.REAL.codePointAt(test, i);
buf.appendCodePoint(codePoint);
}
Assertions.assertEquals(test, buf.toString());
}
@Test
public void testStringLoopFail() {
StringBuilder buf = new StringBuilder();
for (int i=0;i<test.length();i++) {
int v = test.codePointAt(i); // java docs are lying
buf.appendCodePoint(v);
}
Assertions.assertNotEquals(test, buf.toString());
}
@Test
public void testStringLoopChar() {
StringBuilder buf = new StringBuilder();
for (int i=0;i<test.length();i++) { // java docs are lying
char v = test.charAt(i);
buf.append(v);
}
Assertions.assertEquals(test, buf.toString());
}
}