Easter cleaning
This commit is contained in:
commit
9e36078b2e
1862 changed files with 270281 additions and 0 deletions
130
nx01-x4o-fc18/src/test/java/org/x4o/fc18/zion7/LexerNCRTest.java
Normal file
130
nx01-x4o-fc18/src/test/java/org/x4o/fc18/zion7/LexerNCRTest.java
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.zion7;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.fc18.FourCornerUnicodeDisplay;
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.FourCornerX06BaklavaPointSequence;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
|
||||
/**
|
||||
* Tests four corner lexer parts.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 14, 2025
|
||||
*/
|
||||
public class LexerNCRTest {
|
||||
|
||||
@Test
|
||||
public void testNCRMagicSparkler() throws Exception {
|
||||
TestFireWalker fireWalker = new TestFireWalker();
|
||||
FourCornerZionStenoLexer lexer = new FourCornerZionStenoLexer(new FourCornerZion7Candlelier.Adapter() {}, true);
|
||||
lexer.withFireSignals(fireWalker);
|
||||
|
||||
List<Integer> cdc = new ArrayList<>();
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XD.getStart() + (512*3) + 1); /// auto NXX_001
|
||||
Assertions.assertEquals(0, fireWalker.ncr1632BankSparkler);
|
||||
lexer.read(cdc);
|
||||
Assertions.assertEquals(1, fireWalker.ncr1632BankSparkler);
|
||||
|
||||
cdc.addAll(FCDotDEC2701DashPX0.ESC_STOP.baklavaPointSequence()); // the print above auto value + next test
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() - 1 + 123); // normal NXX_123
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() + (512*4) + 2); /// auto NXX_123 + this
|
||||
fireWalker.reset();
|
||||
lexer.read(cdc);
|
||||
Assertions.assertEquals(2, fireWalker.ncr1632BankSparkler);
|
||||
|
||||
Assertions.assertEquals(0, fireWalker.ncr1632BankReset);
|
||||
cdc.addAll(FCDotDEC2701DashPX0.ESC_STOP.cakePointSequence()); // the print above auto value + next test (normal bank reset)
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XD.getStart() - 1 + 11);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XD.getStart() + (512*3) + 12);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() + (512*4) + 13);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() + (512*5) + 14);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart()); // and one which prints
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStop());
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStop()); // embedded bank reset
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() - 1 + 123); // normal NXX_123
|
||||
fireWalker.reset();
|
||||
lexer.read(cdc);
|
||||
Assertions.assertEquals(1, fireWalker.ncr1632BankReset);
|
||||
|
||||
Assertions.assertEquals("¹/₁₃₄₂₁₇₇₂₉¹²³/₁¹³⁷⁴³⁸⁹⁵³⁵⁹⁵/₁⁴⁹³⁴⁷⁴⁵⁶²⁴⁴¹²¹⁷/₁₆₁₀₆₁₂₇₄₇¹²³/₁", FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNCRSimpleX06() throws Exception {
|
||||
List<FourCornerX06BaklavaPointSequence> cdc = new ArrayList<>();
|
||||
cdc.add(FCDotCDC1604DashP6.NX24_X); // = X
|
||||
cdc.add(FCDotCDC1604DashP6.NY09_EQUALS);
|
||||
cdc.add(FCDotCDC1604DashP6._ESC6_X2);
|
||||
cdc.add(FCDotCDC1604DashP6._ESC6_X3);
|
||||
cdc.add(FCDotCDC1604DashP6._ESC6_X2);
|
||||
cdc.add(FCDotCDC1604DashP6.NX15_O); // T015
|
||||
cdc.add(FCDotCDC1604DashP6.NX14_N); // NXX_014
|
||||
cdc.add(FCDotCDC1604DashP6.NX05_E); // NXX_005
|
||||
cdc.add(FCDotCDC1604DashP6.NX07_G); // NXX_007
|
||||
cdc.add(FCDotCDC1604DashP6.NX15_O); // NXX_015
|
||||
cdc.add(FCDotCDC1604DashP6.NX04_D); // NXX_004
|
||||
//cdc.add(FCDotCDC1604DashP6.NY14_SEMICOLON);
|
||||
//cdc.add(FCDotCDC1604DashP6._NEWLINE);
|
||||
|
||||
Assertions.assertEquals("X=¹⁴/₁₅⁵/₁₅⁷/₁₅¹⁵/₁₅⁴/₁₅", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
Assertions.assertEquals("X=␇␘␇ONEGOD", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNCRLargeF9() throws Exception {
|
||||
List<Integer> cdc = new ArrayList<>();
|
||||
cdc.add(FCDotCDC1604DashP6.NX24_X.ordinal()); // = X
|
||||
cdc.add(FCDotCDC1604DashP6.NY09_EQUALS.ordinal());
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() - 1 + 11); // NXX_011
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XD.getStart()); // T001
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart()); // NXX_001
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XD.getStart() - 1 + 15); // T015
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() - 1 + 14); // NXX_014
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XD.getStart() - 1 + 1); // one
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XD.getStart() + 512 + 2); // T1024 + one
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() - 1 + 123); // NXX_123
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() - 1 + 4); // NXX_004
|
||||
cdc.add(FCDotCDC1604DashP6.NY14_SEMICOLON.ordinal());
|
||||
//cdc.add(FCDotCDC1604DashP6._NEWLINE.ordinal());
|
||||
|
||||
Assertions.assertEquals("X=¹¹/₁¹/₁¹⁴/₁₅¹²³/₁₀₂₅⁴/₁₀₂₅;", FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNCRLargestF576() throws Exception {
|
||||
List<Integer> cdc = new ArrayList<>();
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XD.getStart() + (512*63) + 1);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() - 1 + 123); // NXX_123
|
||||
|
||||
String res = "¹²³/₄₈₃₀₆₇₁₉₀₃₇₇₁₅₇₂₉₃₀₈₆₉₁₈₉₈₆₃₆₆₄₉₈₄₁₈₀₃₇₃₆₅₉₁₆₂₁₃₃₀₄₃₇₄₈₃₂₁₅₄₄₀₆₄₃₁₄₃₉₈₉₂₇₈₆₁₉₅₀₅₃₀₆₇₀₂₄₂₂₀₈₂₂₇₄₀₃₂₂₂₄₅₃₀₇₉₅₂₀₀₃₉₃₇₇₇₂₁₄₇₁₇₀₆₃₄₈₃₂₆₃₀₃₇₃₄₅₆₉₆₇₈₆₃₅₈₄₁₈₃₃₈₅₀₉₃₅₈₇₁₂₂₆₀₁₈₅₂₉₂₉";
|
||||
Assertions.assertEquals(res, FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.zion7;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
|
||||
/**
|
||||
* Tests four corner lexer parts.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 14, 2025
|
||||
*/
|
||||
public class LexerUNI21Test {
|
||||
|
||||
@Test
|
||||
public void testUNI21Invalid() throws Exception {
|
||||
TestSmokeReader smokeReader = new TestSmokeReader();
|
||||
FourCornerZionStenoLexer lexer = new FourCornerZionStenoLexer(new FourCornerZion7Candlelier.Adapter() {}, true);
|
||||
lexer.withSmokeSignals(smokeReader);
|
||||
List<Integer> cdc = new ArrayList<>();
|
||||
cdc.add(FourCornerDotCake.FC_UNI2K_22.getStart() + 123);
|
||||
|
||||
smokeReader.reset();
|
||||
Assertions.assertEquals(0, smokeReader.pipeSmokeClouds);
|
||||
lexer.read(cdc);
|
||||
Assertions.assertEquals(1, smokeReader.pipeSmokeClouds);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.zion7;
|
||||
|
||||
/**
|
||||
* Walks four corner lexer fire signals.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 16, 2025
|
||||
*/
|
||||
public class TestFireWalker implements FourCornerZionStenoLexerFire.Adapter {
|
||||
|
||||
int currentLine;
|
||||
int scanBlockStart;
|
||||
int scanBlockStop;
|
||||
int scanMatchPoint;
|
||||
int ncr1632BankSparkler;
|
||||
int ncr1632BankReset;
|
||||
|
||||
public TestFireWalker() {
|
||||
reset();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
currentLine = 0;
|
||||
scanBlockStart = 0;
|
||||
scanMatchPoint = 0;
|
||||
scanMatchPoint = 0;
|
||||
ncr1632BankSparkler = 0;
|
||||
ncr1632BankReset = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireStateLine(int line) {
|
||||
currentLine = line;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireStateScannerMatch(int blockStart, int blockStop, int matchPoint, int idxFirst, int idxLast) {
|
||||
scanBlockStart = blockStart;
|
||||
scanBlockStop = blockStop;
|
||||
scanMatchPoint = matchPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireStateNCR1632BankSparkler(boolean magic) {
|
||||
if (magic) {
|
||||
ncr1632BankSparkler++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireStateNCR1632BankReset(boolean magic) {
|
||||
if (magic) {
|
||||
ncr1632BankReset++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.zion7;
|
||||
|
||||
/**
|
||||
* Reads four corner lexer smoke signals.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 14, 2025
|
||||
*/
|
||||
public class TestSmokeReader implements FourCornerZionStenoLexerSmoke.AdapterMonoPipe {
|
||||
|
||||
int pipeSmokeClouds;
|
||||
int pipeErrorLine;
|
||||
int pipeErrorCol;
|
||||
String pipeError;
|
||||
|
||||
public TestSmokeReader() {
|
||||
reset();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.pipeSmokeClouds = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void burnMonoPipe(int line, int col, String pipeError) {
|
||||
this.pipeSmokeClouds++;
|
||||
this.pipeErrorLine = line;
|
||||
this.pipeErrorCol = col;
|
||||
this.pipeError = pipeError;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue