Added X08 and X18 display in unicode

This commit is contained in:
Willem Cazander 2025-01-07 19:29:50 +01:00
parent 6bd01424d8
commit bac0041239
6 changed files with 273 additions and 91 deletions

View file

@ -98,14 +98,42 @@ public class FourCornerUnicodeDisplay {
return buf.toString();
}
public String renderFromP6(List<FourCornerX06BaklavaPoints> chars) {
return buildString(v -> renderFromP6(chars, v));
public String renderFromX06(List<FourCornerX06BaklavaPoints> chars) {
return buildString(v -> renderFromX06(chars, v));
}
public void renderFromP6(List<FourCornerX06BaklavaPoints> chars, StringBuilder buf) {
public void renderFromX06(List<FourCornerX06BaklavaPoints> chars, StringBuilder buf) {
List<Integer> charPoints = new ArrayList<>(chars.size());
for (FourCornerX06BaklavaPoints baklava : chars) {
for (int v : baklava.baklavaPoints()) {
for (FourCornerX06BaklavaPoints oven : chars) {
for (int v : oven.baklavaPoints()) {
charPoints.add(v);
}
}
renderFromInt18(charPoints, buf);
}
public String renderFromX08(List<FourCornerX08MuffinPoints> chars) {
return buildString(v -> renderFromX08(chars, v));
}
public void renderFromX08(List<FourCornerX08MuffinPoints> chars, StringBuilder buf) {
List<Integer> charPoints = new ArrayList<>(chars.size());
for (FourCornerX08MuffinPoints oven : chars) {
for (int v : oven.muffinPoints()) {
charPoints.add(v);
}
}
renderFromInt18(charPoints, buf);
}
public String renderFromX18(List<FourCornerX18CakePoints> chars) {
return buildString(v -> renderFromX18(chars, v));
}
public void renderFromX18(List<FourCornerX18CakePoints> chars, StringBuilder buf) {
List<Integer> charPoints = new ArrayList<>(chars.size());
for (FourCornerX18CakePoints oven : chars) {
for (int v : oven.cakePoints()) {
charPoints.add(v);
}
}
@ -133,9 +161,23 @@ public class FourCornerUnicodeDisplay {
boolean prevWord = false;
while (cdc.hasNext()) {
Integer cdcPoint = cdc.next();
if (FCDotCDC1604DashP6.__ESC6.ordinal() == cdcPoint) {
if (cdcPoint >= FourCornerDotCake.FC_DEC1604_P7.getStart() && cdcPoint <= FourCornerDotCake.FC_DEC1604_P7.getStop()) {
Integer decPoint = cdcPoint - FourCornerDotCake.FC_DEC1604_P7.getLength();
FCDotDEC1604DashP7 decCode = FCDotDEC1604DashP7.indexOf(decPoint);
numberMode = null; // out of range, thus stop
Integer handled = handleEscape6(cdc, buf);
Integer handled = handleEscape6(decCode, cdc, buf);
if (handled == null) {
continue;
}
cdcPoint = handled; // out of range, is back to normal
}
if (FCDotCDC1604DashP6.__ESC6.ordinal() == cdcPoint) {
if (!cdc.hasNext()) {
break;
}
FCDotDEC1604DashP7 decCode = FCDotDEC1604DashP7.indexOf(cdc.next());
numberMode = null; // out of range, thus stop
Integer handled = handleEscape6(decCode, cdc, buf);
if (handled == null) {
continue;
}
@ -212,14 +254,12 @@ public class FourCornerUnicodeDisplay {
}
}
private Integer handleEscape6(Iterator<Integer> cdc, StringBuilder buf) {
if (!cdc.hasNext()) {
return null;
}
FCDotDEC1604DashP7 decCode = FCDotDEC1604DashP7.indexOf(cdc.next());
if (FCDotDEC1604DashP7.__NUL_DEC.equals(decCode)) {
private Integer handleEscape6(FCDotDEC1604DashP7 decCode, Iterator<Integer> cdc, StringBuilder buf) {
if (renderHiddenControls) {
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
}
if (FCDotDEC1604DashP7.__NUL_DEC.equals(decCode)) {
if (renderHiddenControls) {
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__NUL_DEC.ordinal()));
}
return null;
@ -229,7 +269,6 @@ public class FourCornerUnicodeDisplay {
return null;
}
if (renderHiddenControls) {
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__ESC6_APL.ordinal()));
}
FCDotAPL1604DashP8L aplCode = FCDotAPL1604DashP8L.indexOf(cdc.next());
@ -241,7 +280,6 @@ public class FourCornerUnicodeDisplay {
return null;
}
if (renderHiddenControls) {
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__ESC6_BYD.ordinal()));
}
FCDotBYD1604DashP8H bydCode = FCDotBYD1604DashP8H.indexOf(cdc.next());
@ -250,7 +288,6 @@ public class FourCornerUnicodeDisplay {
}
if (FCDotDEC1604DashP7.__ESC_STOP.equals(decCode)) {
if (renderHiddenControls) {
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__ESC_STOP.ordinal()));
}
return null;
@ -267,12 +304,16 @@ public class FourCornerUnicodeDisplay {
if (idx > 26 || idx < 0) {
return checkChr; // can't handle this
}
if (!renderHiddenControls) {
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
}
FCDotPIE9CDash26 lowCode = FCDotPIE9CDash26.values()[idx];
Arrays.stream(lowCode.codePoints()).forEach(v -> buf.appendCodePoint(v));
return null;
}
if (!renderHiddenControls) {
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
}
return decCode.ordinal();
}

View file

@ -23,13 +23,13 @@
package org.x4o.o2o.fc18;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PrimitiveIterator;
import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
import org.x4o.o2o.fc18.zero33.FCDotDEC1604DashP7;
import org.x4o.o2o.octal.PrimordialOctalOrangeJuiceCord;
import org.x4o.o2o.octal.PrimordialOctalOrangeString;
@ -41,8 +41,6 @@ import org.x4o.o2o.octal.PrimordialOctalOrangeString;
///
public class FourCornerUnicodeImport {
static private final FourCornerUnicodeImport IMPORT_STRICT = new FourCornerUnicodeImport(false);
static private final FourCornerUnicodeImport IMPORT_LOSSY = new FourCornerUnicodeImport(true);
private boolean convertDiacritics = false;
private final Map<Integer, FourCornerX00PetitVidePoints> int21ToVide = new HashMap<>();
@ -52,11 +50,11 @@ public class FourCornerUnicodeImport {
}
static public FourCornerUnicodeImport strict() {
return IMPORT_STRICT;
return new FourCornerUnicodeImport(false);
}
static public FourCornerUnicodeImport lossy() {
return IMPORT_LOSSY;
return new FourCornerUnicodeImport(true);
}
public PrimordialOctalOrangeJuiceCord convertToJuice(String text) {
@ -64,13 +62,31 @@ public class FourCornerUnicodeImport {
}
public List<Integer> convertToInt18(String text) {
return convertToP6(text).stream().map(v -> v.baklavaPoints()[0]).toList();
List<Integer> cakePoints = new ArrayList<>(text.length());
for (FourCornerX18CakePoints oven : convertToX18(text)) {
for (int v : oven.cakePoints()) {
cakePoints.add(v);
}
}
return cakePoints;
}
public List<FourCornerX06BaklavaPoints> convertToP6(String text) {
public List<FourCornerX06BaklavaPoints> convertToX06(String text) {
return convertToXXX(text, 6).stream().map(v -> v.toX06()).toList();
}
public List<FourCornerX08MuffinPoints> convertToX08(String text) {
return convertToXXX(text, 8).stream().map(v -> v.toX08()).toList();
}
public List<FourCornerX18CakePoints> convertToX18(String text) {
return convertToXXX(text, 18).stream().map(v -> v.toX18()).toList();
}
private List<FourCornerX00PetitVidePoints> convertToXXX(String text, int bits) {
String textSingleNewLines = text.replaceAll("\r\n", "\n"); // FIXME: regex only allowed in test scope classpath
PrimitiveIterator.OfInt i = textSingleNewLines.codePoints().iterator();
List<FourCornerX06BaklavaPoints> result = new ArrayList<>(text.length());
List<FourCornerX00PetitVidePoints> result = new ArrayList<>(text.length());
FCDotCDC1604DashP6 cdcNumberTerminator = null;
FCDotCDC1604DashP6 cdcCaseTerminator = null;
while (i.hasNext()) {
@ -85,6 +101,7 @@ public class FourCornerUnicodeImport {
}
// Handle number sequences manual, to escape once
if (bits != 18) { // 18 direct cake point is found by generic lookup
if (codePoint >= '0' && codePoint <= '9') {
if (!FCDotCDC1604DashP6.NX10_J.equals(cdcNumberTerminator)) {
result.add(FCDotCDC1604DashP6.__PIE);
@ -98,11 +115,17 @@ public class FourCornerUnicodeImport {
}
if (cdcNumberTerminator != null) {
cdcNumberTerminator = null;
if (bits == 6) {
result.add(FCDotCDC1604DashP6.__ESC6);
result.add(FCDotCDC1604DashP6.__ESC6);
} else {
result.add(FCDotDEC1604DashP7.__ESC_STOP);
}
}
}
// Handle lower case sequences manual, to escape once
if (bits != 18) { // 18 direct cake point is found by generic lookup
if (codePoint >= 'a' && codePoint <= 'z') {
if (!FCDotCDC1604DashP6.NX26_Z.equals(cdcCaseTerminator)) {
result.add(FCDotCDC1604DashP6.__PIE);
@ -116,18 +139,39 @@ public class FourCornerUnicodeImport {
}
if (cdcCaseTerminator != null) {
cdcCaseTerminator = null;
if (bits == 6) {
result.add(FCDotCDC1604DashP6.__ESC6);
result.add(FCDotCDC1604DashP6.__ESC6);
} else {
result.add(FCDotDEC1604DashP7.__ESC_STOP);
}
}
}
// Lookup mapped values
FourCornerX00PetitVidePoints chs = int21ToVide.get(codePoint);
if (chs != null) {
if (bits == 6) {
if (!chs.isX06()) {
continue;
}
Arrays.stream(chs.toX06().baklavaPoints()).mapToObj(v -> FCDotCDC1604DashP6.indexOf(v)).forEach(v -> result.add(v));
result.add(chs.toX06());
//Arrays.stream(chs.toX06().baklavaPoints()).mapToObj(v -> FCDotCDC1604DashP6.indexOf(v)).forEach(v -> result.add(v));
continue;
} else if (bits == 8) {
if (!chs.isX08()) {
continue;
}
result.add(chs.toX08());
continue;
} else {
if (!chs.isX18()) {
continue;
}
result.add(chs.toX18());
continue;
}
// fails below in exception
}
// Check lossy aliases

View file

@ -37,16 +37,16 @@ import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
*/
public enum FCDotPIE9CDash10 implements FourCornerX06BaklavaPoints, FourCornerX08MuffinPoints, FourCornerX18CakePoints, FourCornerX21CodePoints {
NXX_01('0'),
NXX_02('1'),
NXX_03('2'),
NXX_04('3'),
NXX_05('4'),
NXX_06('5'),
NXX_07('6'),
NXX_08('7'),
NXX_09('8'),
NXX_10('9'),
DECIMAL_0('0'),
DECIMAL_1('1'),
DECIMAL_2('2'),
DECIMAL_3('3'),
DECIMAL_4('4'),
DECIMAL_5('5'),
DECIMAL_6('6'),
DECIMAL_7('7'),
DECIMAL_8('8'),
DECIMAL_9('9'),
;
private final int[] codePoints;

View file

@ -22,7 +22,6 @@
*/
package org.x4o.o2o.fc18.zero33;
import org.x4o.o2o.fc18.FourCornerDotCake;
import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints;
import org.x4o.o2o.fc18.FourCornerX08MuffinPoints;
import org.x4o.o2o.fc18.FourCornerX18CakePoints;
@ -140,12 +139,12 @@ public enum FCDotCDC1604DashP6 implements FourCornerX06BaklavaPoints, FourCorner
@Override
public int[] muffinPoints() {
return cakePoints();
return new int[] {ordinal()};
}
@Override
public int[] cakePoints() {
return new int[] {FourCornerDotCake.FC_CDC1604_P6.getStart() + ordinal()};
return new int[] {ordinal()};
}
@Override

View file

@ -47,7 +47,7 @@ public class FourCornerUnicodeDisplayTest {
cdc.add(FCDotCDC1604DashP6.NX03_C); // T003
cdc.add(FCDotCDC1604DashP6.NX01_A); // NXX_001
String out = FourCornerUnicodeDisplay.text().renderFromP6(cdc);
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
Assertions.assertEquals("X¹/₃", out);
}
@ -81,8 +81,8 @@ public class FourCornerUnicodeDisplayTest {
cdc.add(FCDotDEC1604DashP7.__ESC_STOP);
cdc.add(FCDotCDC1604DashP6.NX15_O);
Assertions.assertEquals("ab B␃cD.jklmO", FourCornerUnicodeDisplay.text().renderFromP6(cdc));
Assertions.assertEquals("ab B␃cD.jklm␃␃O", FourCornerUnicodeDisplay.text(true).renderFromP6(cdc));
Assertions.assertEquals("ab B␃cD.jklmO", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
Assertions.assertEquals("ab B␃cD.jklm␃␃O", FourCornerUnicodeDisplay.text(true).renderFromX06(cdc));
}
@Test
@ -96,7 +96,7 @@ public class FourCornerUnicodeDisplayTest {
cdc.add(FCDotCDC1604DashP6._AT);
cdc.add(FCDotCDC1604DashP6.NX11_K); // = K
String out = FourCornerUnicodeDisplay.text().renderFromP6(cdc);
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
Assertions.assertEquals("X^%@K", out);
}
@ -111,7 +111,7 @@ public class FourCornerUnicodeDisplayTest {
cdc.add(FCDotCDC1604DashP6.NX04_D); // 3
cdc.add(FCDotCDC1604DashP6.NX11_K); // K
String out = FourCornerUnicodeDisplay.text().renderFromP6(cdc);
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
Assertions.assertEquals("B3K", out);
}
}

View file

@ -26,7 +26,10 @@ import java.util.List;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash10;
import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash26;
import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
import org.x4o.o2o.fc18.zero33.FCDotDEC1604DashP7;
/**
* Tests four corner unicode import.
@ -37,8 +40,25 @@ import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
public class FourCornerUnicodeImportTest {
@Test
public void testAsciiSimple() throws Exception {
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.lossy().convertToP6("foobar");
public void testAsciiUpper() throws Exception {
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.strict().convertToX06("FOOBAR");
Assertions.assertNotNull(cdc);
Assertions.assertFalse(cdc.isEmpty());
Assertions.assertEquals(6, cdc.size());
Assertions.assertEquals(FCDotCDC1604DashP6.NX06_F, cdc.get(0));
Assertions.assertEquals(FCDotCDC1604DashP6.NX15_O, cdc.get(1));
Assertions.assertEquals(FCDotCDC1604DashP6.NX15_O, cdc.get(2));
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdc.get(3));
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(4));
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdc.get(5));
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
Assertions.assertEquals("FOOBAR", out);
}
@Test
public void testAsciiLower() throws Exception {
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.strict().convertToX06("foobar");
Assertions.assertNotNull(cdc);
Assertions.assertFalse(cdc.isEmpty());
Assertions.assertEquals(8, cdc.size());
@ -51,16 +71,16 @@ public class FourCornerUnicodeImportTest {
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(6));
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdc.get(7));
String out = FourCornerUnicodeDisplay.text().renderFromP6(cdc);
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
Assertions.assertEquals("foobar", out);
}
@Test
public void testAsciiUpper() throws Exception {
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.lossy().convertToP6("fooBAR");
public void testAsciiMixedX06() throws Exception {
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.strict().convertToX06("fooBAR");
Assertions.assertNotNull(cdc);
Assertions.assertFalse(cdc.isEmpty());
Assertions.assertEquals(10, cdc.size());
Assertions.assertEquals(10, cdc.size()); // = 60 bit
Assertions.assertEquals(FCDotCDC1604DashP6.__PIE, cdc.get(0));
Assertions.assertEquals(FCDotCDC1604DashP6.NX26_Z, cdc.get(1));
Assertions.assertEquals(FCDotCDC1604DashP6.NX06_F, cdc.get(2));
@ -72,25 +92,63 @@ public class FourCornerUnicodeImportTest {
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(8));
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdc.get(9));
String out = FourCornerUnicodeDisplay.text().renderFromP6(cdc);
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
Assertions.assertEquals("fooBAR", out);
}
@Test
public void testCheckDiacritics() throws Exception {
String foobar = "ꞘȍőḆẬř";
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.lossy().convertToP6(foobar);
public void testAsciiMixedX08() throws Exception {
List<FourCornerX08MuffinPoints> cdc = FourCornerUnicodeImport.strict().convertToX08("fooBAR");
Assertions.assertNotNull(cdc);
Assertions.assertFalse(cdc.isEmpty());
Assertions.assertEquals("FOOBAR", FourCornerUnicodeDisplay.text().renderFromP6(cdc));
Assertions.assertEquals(9, cdc.size()); // = 72 bit
Assertions.assertEquals(FCDotCDC1604DashP6.__PIE, cdc.get(0));
Assertions.assertEquals(FCDotCDC1604DashP6.NX26_Z, cdc.get(1));
Assertions.assertEquals(FCDotCDC1604DashP6.NX06_F, cdc.get(2));
Assertions.assertEquals(FCDotCDC1604DashP6.NX15_O, cdc.get(3));
Assertions.assertEquals(FCDotCDC1604DashP6.NX15_O, cdc.get(4));
Assertions.assertEquals(FCDotDEC1604DashP7.__ESC_STOP, cdc.get(5));
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdc.get(6));
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(7));
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdc.get(8));
String out = FourCornerUnicodeDisplay.text().renderFromX08(cdc);
Assertions.assertEquals("fooBAR", out);
}
@Test
public void testAsciiMixedX18() throws Exception {
List<FourCornerX18CakePoints> cdc = FourCornerUnicodeImport.strict().convertToX18("fooBAR");
Assertions.assertNotNull(cdc);
Assertions.assertFalse(cdc.isEmpty());
Assertions.assertEquals(6, cdc.size()); // = 108 bit
Assertions.assertEquals(FCDotPIE9CDash26.LOW_F, cdc.get(0));
Assertions.assertEquals(FCDotPIE9CDash26.LOW_O, cdc.get(1));
Assertions.assertEquals(FCDotPIE9CDash26.LOW_O, cdc.get(2));
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdc.get(3));
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(4));
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdc.get(5));
String out = FourCornerUnicodeDisplay.text().renderFromX18(cdc);
Assertions.assertEquals("fooBAR", out);
}
@Test
public void testCheckDiacritics() throws Exception {
String foobar = "ꞘȍőḆẬř";
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.lossy().convertToX06(foobar);
Assertions.assertNotNull(cdc);
Assertions.assertFalse(cdc.isEmpty());
Assertions.assertEquals("FOOBAR", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
Assertions.assertThrows(IllegalArgumentException.class, () -> {
FourCornerUnicodeImport.strict().convertToP6(foobar);
FourCornerUnicodeImport.strict().convertToX06(foobar);
});
}
@Test
public void testNumber012() throws Exception {
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.lossy().convertToP6("01201337");
public void testNumberX06() throws Exception {
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.strict().convertToX06("01201337");
Assertions.assertNotNull(cdc);
Assertions.assertFalse(cdc.isEmpty());
Assertions.assertEquals(10, cdc.size());
@ -105,13 +163,53 @@ public class FourCornerUnicodeImportTest {
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdc.get(8)); // 3
Assertions.assertEquals(FCDotCDC1604DashP6.NX08_H, cdc.get(9)); // 7
String out = FourCornerUnicodeDisplay.text().renderFromP6(cdc);
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
Assertions.assertEquals("01201337", out);
}
@Test
public void testNumberX08() throws Exception {
List<FourCornerX08MuffinPoints> cdc = FourCornerUnicodeImport.strict().convertToX08("01201337");
Assertions.assertNotNull(cdc);
Assertions.assertFalse(cdc.isEmpty());
Assertions.assertEquals(10, cdc.size());
Assertions.assertEquals(FCDotCDC1604DashP6.__PIE, cdc.get(0));
Assertions.assertEquals(FCDotCDC1604DashP6.NX10_J, cdc.get(1));
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(2)); // 0
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdc.get(3)); // 1
Assertions.assertEquals(FCDotCDC1604DashP6.NX03_C, cdc.get(4)); // 2
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdc.get(5)); // 0
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdc.get(6)); // 1
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdc.get(7)); // 3
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdc.get(8)); // 3
Assertions.assertEquals(FCDotCDC1604DashP6.NX08_H, cdc.get(9)); // 7
String out = FourCornerUnicodeDisplay.text().renderFromX08(cdc);
Assertions.assertEquals("01201337", out);
}
@Test
public void testNumberX18() throws Exception {
List<FourCornerX18CakePoints> cdc = FourCornerUnicodeImport.strict().convertToX18("01201337");
Assertions.assertNotNull(cdc);
Assertions.assertFalse(cdc.isEmpty());
Assertions.assertEquals(8, cdc.size());
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_0, cdc.get(0)); // 0
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_1, cdc.get(1)); // 1
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_2, cdc.get(2)); // 2
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_0, cdc.get(3)); // 0
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_1, cdc.get(4)); // 1
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_3, cdc.get(5)); // 3
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_3, cdc.get(6)); // 3
Assertions.assertEquals(FCDotPIE9CDash10.DECIMAL_7, cdc.get(7)); // 7
String out = FourCornerUnicodeDisplay.text().renderFromX18(cdc);
Assertions.assertEquals("01201337", out);
}
@Test
public void testLineEndings() throws Exception {
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.strict().convertToP6("A\nB\rC\r\nD\n");
List<FourCornerX06BaklavaPoints> cdc = FourCornerUnicodeImport.strict().convertToX06("A\nB\rC\r\nD\n");
Assertions.assertNotNull(cdc);
Assertions.assertFalse(cdc.isEmpty());
Assertions.assertEquals(8, cdc.size());
@ -124,7 +222,7 @@ public class FourCornerUnicodeImportTest {
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdc.get(6));
Assertions.assertEquals(FCDotCDC1604DashP6.__LINE, cdc.get(7));
String out = FourCornerUnicodeDisplay.text().renderFromP6(cdc);
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
Assertions.assertEquals("A\nB\nC\nD\n", out);
}
}