FC18: Converted NCR magic sparkler to smoke signal for missing sparkler

This commit is contained in:
Willem Cazander 2025-08-22 15:39:33 +02:00
parent e7e26b569b
commit 7ea17d7628
6 changed files with 35 additions and 47 deletions

View file

@ -63,7 +63,6 @@ public class FourCornerRecipeTest {
BigInteger v2 = BigInteger.valueOf(12345);
FourCornerRecipe.embedNCR1632FractionX06(cdcX06, v2, BigInteger.ONE);
FourCornerRecipe.embedNCR1632FractionX18(cdcX18, v2, BigInteger.ONE);
System.out.println(FourCornerUnicodeDisplay.raw().renderFromInt18(cdcX06));
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(cdcX06);
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(cdcX18);
Assertions.assertEquals(resX18, resX06);
@ -79,7 +78,6 @@ public class FourCornerRecipeTest {
FourCornerRecipe.embedNCR1632FractionX06(cdcX06, v, BigInteger.ONE);
FourCornerRecipe.embedNCR1632FractionX18(cdcX18, v, BigInteger.ONE);
}
System.out.println(FourCornerUnicodeDisplay.raw().renderFromInt18(cdcX06));
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(cdcX06);
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(cdcX18);
Assertions.assertEquals(resX18, resX06);

View file

@ -41,23 +41,24 @@ import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
public class LexerNCRTest {
@Test
public void testNCRMagicSparkler() throws Exception {
TestFireWalker fireWalker = new TestFireWalker();
public void testNCRSmokeSignals() throws Exception {
TestSmokeReader smokeReader = new TestSmokeReader();
FourCornerZionStenoLexer lexer = new FourCornerZionStenoLexer(new FourCornerZion7Candlelier.Adapter() {}, true);
lexer.withFireSignals(fireWalker);
lexer.withSmokeSignals(smokeReader);
List<Integer> cdc = new ArrayList<>();
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + (512*3) + 1); /// auto NXX_001
Assertions.assertEquals(0, fireWalker.ncr1632BankSparkler);
Assertions.assertEquals(0, smokeReader.pipeSmokeClouds);
lexer.read(cdc);
Assertions.assertEquals(1, fireWalker.ncr1632BankSparkler);
Assertions.assertEquals(1, smokeReader.pipeSmokeClouds);
Assertions.assertEquals("burnNCR1632MissingBankSparkler", 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
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + (512*4) + 2); /// auto NXX_123 + this
fireWalker.reset();
smokeReader.reset();
lexer.read(cdc);
Assertions.assertEquals(2, fireWalker.ncr1632BankSparkler);
Assertions.assertEquals(2, smokeReader.pipeSmokeClouds);
cdc.addAll(FCDotDEC2701DashPX0.ESC_STOP.cakePointSequence()); // the print above auto value + next test (normal bank reset)
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() - 1 + 11);
@ -68,9 +69,9 @@ public class LexerNCRTest {
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStop());
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStop()); // embedded bank reset
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() - 1 + 123); // normal NXX_123
fireWalker.reset();
smokeReader.reset();
lexer.read(cdc);
String res = "¹/₁₃₄₂₁₇₇₂₉¹²³/₁¹³⁷⁴³⁸⁹⁵³⁴⁷³/₁⁴⁹³⁴⁷⁴⁵⁶²⁴⁴¹²¹⁷/₁₆₁₀₆₁₂₇₄₇²⁴⁶⁸⁴⁷³³⁴²⁸²⁷²⁷³⁷⁶⁷⁶⁷⁴¹⁵⁶⁰²⁰³³²⁸⁰⁶⁹¹⁶¹⁷⁰⁹³⁹⁸³¹⁸⁴⁹⁹⁸⁵³⁵⁵³⁹²³⁰⁹⁰¹⁶⁸⁶⁴⁶⁵⁷⁸⁵²¹³⁷⁴⁵⁶⁷²¹¹⁷²⁴⁹³⁷⁶⁸⁴⁰⁴²⁰³⁰⁴⁶⁶⁷³⁵²³⁶³⁴⁷⁴⁰¹²²⁰¹⁵⁶⁷²⁰⁴¹⁹⁴³⁹⁹⁴⁷⁴¹²⁰⁸³⁶⁵¹⁰⁵⁷⁸²⁹¹⁵¹⁷⁷⁰⁹⁷⁸²⁸²³⁰¹⁹⁶⁴⁹⁵⁴⁶⁸⁴⁶³³¹/₁";
String res = "[0:1:burnNCR1632MissingBankSparkler]¹²³/₁₃₄₂₁₇₇₂₉[0:8:burnNCR1632MissingBankSparkler]⁴⁹³⁴⁷⁴⁵⁶²⁴⁴¹²¹⁷/₁₆₁₀₆₁₂₇₄₇²⁴⁶⁸⁴⁷³³⁴²⁸²⁷²⁷³⁷⁶⁷⁶⁷⁴¹⁵⁶⁰²⁰³³²⁸⁰⁶⁹¹⁶¹⁷⁰⁹³⁹⁸³¹⁸⁴⁹⁹⁸⁵³⁵⁵³⁹²³⁰⁹⁰¹⁶⁸⁶⁴⁶⁵⁷⁸⁵²¹³⁷⁴⁵⁶⁷²¹¹⁷²⁴⁹³⁷⁶⁸⁴⁰⁴²⁰³⁰⁴⁶⁶⁷³⁵²³⁶³⁴⁷⁴⁰¹²²⁰¹⁵⁶⁷²⁰⁴¹⁹⁴³⁹⁹⁴⁷⁴¹²⁰⁸³⁶⁵¹⁰⁵⁷⁸²⁹¹⁵¹⁷⁷⁰⁹⁷⁸²⁸²³⁰¹⁹⁶⁴⁹⁵⁴⁶⁸⁴⁶³³¹/₁";
Assertions.assertEquals(res, FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
}

View file

@ -34,7 +34,6 @@ public class TestFireWalker implements FourCornerZionStenoLexerFire.Adapter {
int scanBlockStart;
int scanBlockStop;
int scanMatchPoint;
int ncr1632BankSparkler;
public TestFireWalker() {
reset();
@ -45,7 +44,6 @@ public class TestFireWalker implements FourCornerZionStenoLexerFire.Adapter {
scanBlockStart = 0;
scanMatchPoint = 0;
scanMatchPoint = 0;
ncr1632BankSparkler = 0;
}
@Override
@ -59,11 +57,4 @@ public class TestFireWalker implements FourCornerZionStenoLexerFire.Adapter {
scanBlockStop = blockStop;
scanMatchPoint = matchPoint;
}
@Override
public void fireStateNCR1632BankSparkler(boolean magic) {
if (magic) {
ncr1632BankSparkler++;
}
}
}