FC18: Made NCR signed and added Dozeger 192 bit integer support

This commit is contained in:
Willem Cazander 2025-08-25 19:09:20 +02:00
parent 4c2fbcfe2b
commit d41af20079
10 changed files with 241 additions and 33 deletions

View file

@ -213,7 +213,7 @@ public class FourCornerUnicodeDisplayTest {
cdc.add(FCDotCDC1604DashP6.NX09_I); // I
cdc.add(FCDotDEC2701DashPX0.ESC_DEC0801_E10);
cdc.add(FCDotDEC0801DashE10.E10_UWU0101_S1);
cdc.add(FCDotCDC1604DashP6.NX01_A); // tab space
cdc.add(FCDotCDC1604DashP6.NX01_A); // T001__ONE
cdc.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION);
cdc.add(FCDotCDC1604DashP6.NX08_H); // HOI
cdc.add(FCDotCDC1604DashP6.NX15_O);
@ -223,6 +223,6 @@ public class FourCornerUnicodeDisplayTest {
cdc.add(FCDotCDC1604DashP6.NX02_B); // B
cdc.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION); // with ! as we droped out of escape mode by B being to large
Assertions.assertEquals("HOI1HOIB!", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
Assertions.assertEquals("HOIT001__ONEHOIB!", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
}
}

View file

@ -35,6 +35,7 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.x4o.fc18.FourCornerUnicodeDisplay;
import org.x4o.fc18.cake2.flag4.FCDotF4TTY0001DashNL;
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
import org.x4o.fc18.octal8.PrimordialOctal;
import org.x4o.fc18.octal8.PrimordialOctalOrangeString;
@ -62,6 +63,18 @@ public class StenoGrapherTest {
Assertions.assertTrue(res.endsWith("PART_1PART_1"), "missing " + res);
}
@Test
public void testDozegerValues() throws Exception {
List<Integer> outX18 = new ArrayList<>();
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
writerX18.strobeNumberDozeger(BigInteger.valueOf(123));
writerX18.strobeWord(FCDotCDC1604DashP6.NY19_MINUS.ordinal());
writerX18.strobeNumberDozeger(FourCornerZion7Petroglyphs.DOZEGER192_VALUE_MAX);
writerX18.strobeNumberDozeger(BigInteger.valueOf(-123));
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
Assertions.assertEquals("123-3138550867693340381917894711603833208051177722232017256447-123", resX18);
}
@Test
public void testNCRValues() throws Exception {
List<Integer> outX06 = new ArrayList<>();
@ -74,10 +87,13 @@ public class StenoGrapherTest {
BigInteger v2 = BigInteger.valueOf(12345);
writerX06.strobeNCR1632(BigInteger.ONE, v2);
writerX18.strobeNCR1632(BigInteger.ONE, v2);
BigInteger v3 = BigInteger.valueOf(-5432);
writerX06.strobeNCR1632(v3, v3);
writerX18.strobeNCR1632(v3, v3);
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(outX06);
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
Assertions.assertEquals(resX18, resX06);
Assertions.assertEquals("¹/₁₂₃¹/₁₂₃₄₅", resX06);
Assertions.assertEquals("¹/₁₂₃¹/₁₂₃₄₅⁻⁵⁴³²/₋₅₄₃₂", resX06);
}
//Test TODO: MOVE + fix java.io.IOException: Expected 9 bytes, got: 3 from PrimordialOctalOrangeString.ioSmurfReadStreamX8
@ -137,7 +153,7 @@ public class StenoGrapherTest {
List<Integer> outX18 = new ArrayList<>();
FourCornerZion7Candlelier writerX06 = FourCornerZionStenoGrapher.writerX06(outX06);
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
BigInteger maxValue = new BigInteger("FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
BigInteger maxValue = new BigInteger("7FFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
writerX06.strobeNCR1632(maxValue, maxValue);
Assertions.assertThrows(IllegalArgumentException.class, () -> {
writerX06.strobeNCR1632(maxValue, maxValue.add(BigInteger.ONE));

View file

@ -51,7 +51,7 @@ public class StenoLexerNCRTest {
Assertions.assertEquals(0, smokeReader.pipeSmokeClouds);
lexer.read(cdc);
Assertions.assertEquals(1, smokeReader.pipeSmokeClouds);
Assertions.assertEquals("burnNCR1632MissingBankSparkler", smokeReader.pipeError);
Assertions.assertEquals("burnNCR1632MissingSparkler", smokeReader.pipeError);
cdc.addAll(FCDotDEC2701DashPX0.ESC_STOP.baklavaPointSequence()); // the print above auto value + next test
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() - 1 + 123); // normal NXX_123
@ -69,7 +69,7 @@ public class StenoLexerNCRTest {
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 123); // normal NXX_123
smokeReader.reset();
lexer.read(cdc);
String res = "[0:1:burnNCR1632MissingBankSparkler][0:8:burnNCR1632MissingBankSparkler]¹³⁷⁴³⁸⁹⁵³⁵⁹⁴/₁₃₄₂₁₇₇₃₉[0:16:burnNCR1632MissingBankSparkler]";
String res = "[0:1:burnNCR1632MissingSparkler][0:8:burnNCR1632MissingSparkler]¹³⁷⁴³⁸⁹⁵³⁵⁹⁴/₁₃₄₂₁₇₇₃₉[0:16:burnNCR1632MissingSparkler]";
Assertions.assertEquals(res, FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
}
@ -108,8 +108,8 @@ public class StenoLexerNCRTest {
for (int i = FourCornerDotCake.FC_NCR1632_DEN.getStop(); i >= FourCornerDotCake.FC_NCR1632_DEN.getStart(); i = i - 512) {
cdc.add(i);
}
String resSuper = "²⁴⁷³³⁰⁴⁰¹⁴⁷³¹⁰⁴⁵³⁴⁰⁶⁰⁵⁰²⁵²¹⁰¹⁹⁶⁴⁷¹⁹⁰⁰³⁵¹³¹³⁴⁹¹⁰¹²¹¹⁸³⁹⁹¹⁴⁰⁶³⁰⁵⁶⁰⁹²⁸⁹⁷²²⁵¹⁰⁶⁵³¹⁸⁶⁷¹⁷⁰³¹⁶⁴⁰¹⁰⁶¹²⁴³⁰⁴⁴⁹⁸⁹⁵⁹⁷⁶⁷¹⁴²⁶⁰¹⁶¹³⁹³³⁹³⁵¹³⁶⁵⁰³⁴³⁰⁶⁷⁵¹²⁰⁹⁹⁶⁷⁵⁴⁶¹⁵⁵¹⁰¹⁸⁹³¹⁶⁷⁹¹⁶⁶⁰⁶⁷⁷²¹⁴⁸⁶⁹⁹¹³⁵";
String resSuber = "₂₄₇₃₃₀₄₀₁₄₇₃₁₀₄₅₃₄₀₆₀₅₀₂₅₂₁₀₁₉₆₄₇₁₉₀₀₃₅₁₃₁₃₄₉₁₀₁₂₁₁₈₃₉₉₁₄₀₆₃₀₅₆₀₉₂₈₉₇₂₂₅₁₀₆₅₃₁₈₆₇₁₇₀₃₁₆₄₀₁₀₆₁₂₄₃₀₄₄₉₈₉₅₉₇₆₇₁₄₂₆₀₁₆₁₃₉₃₃₉₃₅₁₃₆₅₀₃₄₃₀₆₇₅₁₂₀₉₉₆₇₅₄₆₁₅₅₁₀₁₈₉₃₁₆₇₉₁₆₆₀₆₇₇₂₁₄₈₆₉₉₁₃₅";
String resSuper = "⁻¹⁹³²²⁶⁸⁷⁶¹⁵⁰⁸⁶²⁹¹⁷²³⁴⁷⁶⁷⁵⁹⁴⁵⁴⁶⁵⁹⁹³⁶⁷²¹⁴⁹⁴⁶³⁶⁶⁴⁸⁵³²¹⁷⁴⁹⁹³²⁸⁶¹⁷⁶²⁵⁷²⁵⁷⁵⁹⁵⁷¹¹⁴⁴⁷⁸⁰²¹²²⁶⁸⁰⁹⁶⁸⁸³²⁹⁰⁹⁶¹²⁸⁸⁹⁸¹²³¹⁸⁰⁸⁰¹⁵⁷⁵¹⁰⁸⁸⁵⁸⁸⁶⁸²⁵³⁹³³⁰⁵²¹⁴⁹³⁸²⁷⁸⁷¹⁴⁵⁴³³⁶⁷³³⁵⁴⁰³⁷⁴³⁴⁸⁴⁹⁰⁴⁰⁷⁴¹¹⁷¹¹";
String resSuber = "₋₁₉₃₂₂₆₈₇₆₁₅₀₈₆₂₉₁₇₂₃₄₇₆₇₅₉₄₅₄₆₅₉₉₃₆₇₂₁₄₉₄₆₃₆₆₄₈₅₃₂₁₇₄₉₉₃₂₈₆₁₇₆₂₅₇₂₅₇₅₉₅₇₁₁₄₄₇₈₀₂₁₂₂₆₈₀₉₆₈₈₃₂₉₀₉₆₁₂₈₈₉₈₁₂₃₁₈₀₈₀₁₅₇₅₁₀₈₈₅₈₈₆₈₂₅₃₉₃₃₀₅₂₁₄₉₃₈₂₇₈₇₁₄₅₄₃₃₆₇₃₃₅₄₀₃₇₄₃₄₈₄₉₀₄₀₇₄₁₁₇₁₁";
Assertions.assertEquals(resSuper + "/" + resSuber, FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
}
}