Easter cleaning
This commit is contained in:
commit
9e36078b2e
1862 changed files with 270281 additions and 0 deletions
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
|
||||
/**
|
||||
* Tests FourCornerDotCake values.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Dec 30, 2024
|
||||
*/
|
||||
public class FourCornerDotCakeTest {
|
||||
|
||||
@Test
|
||||
public void testValues() throws Exception {
|
||||
for (FourCornerDotCake v : FourCornerDotCake.values()) {
|
||||
Assertions.assertNotNull(v);
|
||||
Assertions.assertNotNull(v.getVidePoints());
|
||||
Assertions.assertNotNull(v.tower());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTowerSizes() throws Exception {
|
||||
int sizeTotal = 0;
|
||||
for (FourCornerDotCake v : FourCornerDotCake.values()) {
|
||||
Assertions.assertTrue(v.getStart() <= v.getStop(), "Start is larger than stop in: " + v.name());
|
||||
sizeTotal += v.getLength();
|
||||
int videSize = v.getVidePoints().length;
|
||||
if (videSize != 0) {
|
||||
Assertions.assertEquals(v.getLength(), videSize, "Vide size mismatch: " + v);
|
||||
}
|
||||
}
|
||||
Assertions.assertEquals(262144, sizeTotal);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
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.FourCornerX06BaklavaPointSequence;
|
||||
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash26;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotCMD5401Dash2D;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC0801DashE10;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotINC0801DashP8;
|
||||
|
||||
/**
|
||||
* Tests four corner displayed as unicode.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Dec 23, 2024
|
||||
*/
|
||||
public class FourCornerUnicodeDisplayTest {
|
||||
|
||||
@Test
|
||||
public void testMixedCasing() throws Exception {
|
||||
List<FourCornerX06BaklavaPointSequence> cdc = new ArrayList<>();
|
||||
cdc.add(FCDotPIE9CDash26.LOW_A);
|
||||
cdc.add(FCDotPIE9CDash26.LOW_B); // if used as this per letter full escaping here....
|
||||
cdc.add(FCDotCMD5401Dash2D.CMD_F4TXT0001_SP);
|
||||
cdc.add(FCDotCDC1604DashP6.NX02_B);
|
||||
cdc.add(FCDotCDC1604DashP6.NX03_C);
|
||||
cdc.add(FCDotCDC1604DashP6.NX04_D);
|
||||
cdc.add(FCDotCDC1604DashP6.NY16_DOT);
|
||||
cdc.add(FCDotDEC2701DashPX0.ESC68_2PIE);
|
||||
cdc.add(FCDotCDC1604DashP6.NX26_Z); // select lower case
|
||||
cdc.add(FCDotCDC1604DashP6.NX10_J);
|
||||
cdc.add(FCDotCDC1604DashP6.NX11_K);
|
||||
cdc.add(FCDotCDC1604DashP6.NX12_L);
|
||||
cdc.add(FCDotCDC1604DashP6.NX13_M);
|
||||
cdc.add(FCDotDEC2701DashPX0.ESC_STOP);
|
||||
cdc.add(FCDotCDC1604DashP6.NX15_O);
|
||||
|
||||
Assertions.assertEquals("ab BCD.jklmO", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
Assertions.assertEquals("␇␇␘ZA␇␇␘ZB␘␆␆ABCD.␇␇␘ZJKLM␘␘␘O", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNumberTerminatorOutOfRange() throws Exception {
|
||||
List<FourCornerX06BaklavaPointSequence> cdc = new ArrayList<>();
|
||||
cdc.add(FCDotCDC1604DashP6.NX24_X); // = X
|
||||
cdc.add(FCDotDEC2701DashPX0.ESC68_2PIE);
|
||||
cdc.add(FCDotCDC1604DashP6.NY10_CARET); // ^
|
||||
cdc.add(FCDotCDC1604DashP6.NY06_PERCENT); // = %
|
||||
cdc.add(FCDotDEC2701DashPX0.ESC68_2PIE);
|
||||
cdc.add(FCDotCDC1604DashP6.NY01_AT);
|
||||
cdc.add(FCDotCDC1604DashP6.NX11_K); // = K
|
||||
|
||||
Assertions.assertEquals("X^%@K", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNumberPieOutOfRange() throws Exception {
|
||||
List<FourCornerX06BaklavaPointSequence> cdc = new ArrayList<>();
|
||||
cdc.add(FCDotDEC2701DashPX0.ESC68_2PIE);
|
||||
cdc.add(FCDotCDC1604DashP6.NX01_A);
|
||||
cdc.add(FCDotCDC1604DashP6.NX02_B); // B
|
||||
cdc.add(FCDotDEC2701DashPX0.ESC68_2PIE);
|
||||
cdc.add(FCDotCDC1604DashP6.NX10_J);
|
||||
cdc.add(FCDotCDC1604DashP6.NX04_D); // 3
|
||||
cdc.add(FCDotCDC1604DashP6.NX11_K); // K
|
||||
|
||||
Assertions.assertEquals("B3K", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnicode() throws Exception {
|
||||
List<Integer> cdc = new ArrayList<>();
|
||||
cdc.add(FCDotCDC1604DashP6.NX23_W.ordinal());
|
||||
cdc.add(FCDotCDC1604DashP6.NY09_EQUALS.ordinal());
|
||||
cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.embedUNI2K("©Δ∞ 仙上主天"));
|
||||
cdc.add(FCDotCDC1604DashP6.NY20_PLUS.ordinal());
|
||||
cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.embedUNI2K("𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡 𑀪𑀸𑀕"));
|
||||
cdc.add(FCDotCDC1604DashP6.NY14_SEMICOLON.ordinal());
|
||||
//cdc.add(FCDotCDC1604DashP6._NEWLINE.ordinal());
|
||||
|
||||
String outputExpected = "W=©Δ∞ 仙上主天+𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡 𑀪𑀸𑀕;";
|
||||
Assertions.assertEquals(outputExpected, FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||
|
||||
int bitsUTF8 = outputExpected.getBytes(StandardCharsets.UTF_8).length*8;
|
||||
int bitsFC18 = cdc.size()*18;
|
||||
Assertions.assertTrue(bitsFC18 < bitsUTF8, "FC18 is not smaller");
|
||||
|
||||
List<Integer> cdc6 = FourCornerUnicodeMapper.DICTIONARY.embedFC18(cdc);
|
||||
Assertions.assertEquals(outputExpected, FourCornerUnicodeDisplay.text().renderFromInt18(cdc6));
|
||||
Assertions.assertTrue(cdc6.size() > cdc.size(), "FCx6 is not bigger");
|
||||
|
||||
System.out.println("size FC18="+cdc.size());
|
||||
System.out.println("size 0x21="+outputExpected.length());
|
||||
System.out.println("size UTF8="+outputExpected.getBytes(StandardCharsets.UTF_8).length);
|
||||
System.out.println("size FCx6="+cdc6.size());
|
||||
System.out.println("raw FCx6="+FourCornerUnicodeDisplay.raw().renderFromInt18(cdc6));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItianalText() throws Exception {
|
||||
List<FourCornerX06BaklavaPointSequence> cdc = new ArrayList<>();
|
||||
cdc.add(FCDotDEC2701DashPX0.ESC68_INC0801_P8);
|
||||
cdc.add(FCDotINC0801DashP8.INC_PIE9D_27);
|
||||
cdc.add(FCDotCDC1604DashP6.NX08_H);
|
||||
cdc.add(FCDotCDC1604DashP6.NX15_O);
|
||||
cdc.add(FCDotCDC1604DashP6.NX09_I);
|
||||
cdc.add(FCDotINC0801DashP8.INC_BYD0127_P7D);
|
||||
cdc.add(FCDotCDC1604DashP6.NX08_H);
|
||||
cdc.add(FCDotCDC1604DashP6.NX15_O);
|
||||
cdc.add(FCDotCDC1604DashP6.NX09_I);
|
||||
cdc.add(FCDotINC0801DashP8.INC_PIE9C_26);
|
||||
cdc.add(FCDotCDC1604DashP6.NX08_H);
|
||||
cdc.add(FCDotCDC1604DashP6.NX15_O);
|
||||
cdc.add(FCDotCDC1604DashP6.NX09_I);
|
||||
cdc.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION);
|
||||
|
||||
Assertions.assertEquals("𝘩𝘰𝘪╗╞╘hoi", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecE10RangeChecks() throws Exception {
|
||||
List<FourCornerX06BaklavaPointSequence> cdc = new ArrayList<>();
|
||||
cdc.add(FCDotDEC2701DashPX0.ESC_DEC0801_E10);
|
||||
cdc.add(FCDotDEC0801DashE10.E10_UWU0101_S1);
|
||||
cdc.add(FCDotCDC1604DashP6.NX08_H); // H
|
||||
cdc.add(FCDotDEC2701DashPX0.ESC_DEC0801_E10);
|
||||
cdc.add(FCDotDEC0801DashE10.E10_UWU0101_S1);
|
||||
cdc.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION);
|
||||
cdc.add(FCDotCDC1604DashP6.NX15_O); // O
|
||||
cdc.add(FCDotDEC2701DashPX0.ESC_DEC0801_E10);
|
||||
cdc.add(FCDotDEC0801DashE10.E10_UWU0101_S1);
|
||||
cdc.add(FCDotDEC2701DashPX0.ESC_STOP);
|
||||
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._SALAH_EXCLAMATION);
|
||||
cdc.add(FCDotCDC1604DashP6.NX08_H); // HOI
|
||||
cdc.add(FCDotCDC1604DashP6.NX15_O);
|
||||
cdc.add(FCDotCDC1604DashP6.NX09_I);
|
||||
cdc.add(FCDotDEC2701DashPX0.ESC_DEC0801_E10);
|
||||
cdc.add(FCDotDEC0801DashE10.E10_UWU0101_S1);
|
||||
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("HOI__ __.:=UWU=:.__ __HOIB!", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,279 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.fc18.cake2.FourCornerX06BaklavaPointSequence;
|
||||
import org.x4o.fc18.cake2.FourCornerX08MuffinPointSequence;
|
||||
import org.x4o.fc18.cake2.FourCornerX18CakePointSequence;
|
||||
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash10;
|
||||
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash26;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotCMD5401Dash2D;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
|
||||
/**
|
||||
* Tests four corner unicode import.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Dec 23, 2024
|
||||
*/
|
||||
public class FourCornerUnicodeImportTest {
|
||||
|
||||
@Test
|
||||
public void testAsciiUpper() throws Exception {
|
||||
List<FourCornerX06BaklavaPointSequence> 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<FourCornerX06BaklavaPointSequence> cdc = FourCornerUnicodeImport.strict().convertToX06("foobar");
|
||||
Iterator<FourCornerX06BaklavaPointSequence> cdi = cdc.iterator();
|
||||
Assertions.assertNotNull(cdc);
|
||||
Assertions.assertFalse(cdc.isEmpty());
|
||||
Assertions.assertEquals(8, cdc.size());
|
||||
Assertions.assertEquals(FCDotDEC2701DashPX0.ESC68_2PIE, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX26_Z, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX06_F, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX15_O, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX15_O, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdi.next());
|
||||
|
||||
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
|
||||
Assertions.assertEquals("foobar", out);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAsciiMixedX06() throws Exception {
|
||||
List<FourCornerX06BaklavaPointSequence> cdc = FourCornerUnicodeImport.strict().convertToX06("fooBAR");
|
||||
Iterator<FourCornerX06BaklavaPointSequence> cdi = cdc.iterator();
|
||||
Assertions.assertNotNull(cdc);
|
||||
Assertions.assertFalse(cdc.isEmpty());
|
||||
Assertions.assertEquals(11, cdc.size());
|
||||
Assertions.assertEquals(FCDotDEC2701DashPX0.ESC68_2PIE, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX26_Z, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX06_F, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX15_O, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX15_O, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X3, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X3, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X3, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdi.next());
|
||||
|
||||
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
|
||||
Assertions.assertEquals("fooBAR", out);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAsciiMixedX08() throws Exception {
|
||||
List<FourCornerX08MuffinPointSequence> cdc = FourCornerUnicodeImport.strict().convertToX08("fooBAR");
|
||||
Iterator<FourCornerX08MuffinPointSequence> cdi = cdc.iterator();
|
||||
Assertions.assertNotNull(cdc);
|
||||
Assertions.assertFalse(cdc.isEmpty());
|
||||
Assertions.assertEquals(9, cdc.size());
|
||||
Assertions.assertEquals(FCDotDEC2701DashPX0.ESC68_2PIE, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX26_Z, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX06_F, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX15_O, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX15_O, cdi.next());
|
||||
Assertions.assertEquals(FCDotDEC2701DashPX0.ESC_STOP, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX18_R, cdi.next());
|
||||
|
||||
String out = FourCornerUnicodeDisplay.text().renderFromX08(cdc);
|
||||
Assertions.assertEquals("fooBAR", out);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAsciiMixedX18() throws Exception {
|
||||
List<FourCornerX18CakePointSequence> 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<FourCornerX06BaklavaPointSequence> 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().convertToX06(foobar);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckMissingChar() throws Exception {
|
||||
String foobar = "FOO\u5432\u5432\u5432";
|
||||
List<FourCornerX06BaklavaPointSequence> cdc = FourCornerUnicodeImport.lossy().convertToX06(foobar);
|
||||
Assertions.assertNotNull(cdc);
|
||||
Assertions.assertFalse(cdc.isEmpty());
|
||||
Assertions.assertEquals("FOO???", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
FourCornerUnicodeImport.strict().convertToX06(foobar);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNumberX06() throws Exception {
|
||||
List<FourCornerX06BaklavaPointSequence> cdc = FourCornerUnicodeImport.strict().convertToX06("01201337");
|
||||
Iterator<FourCornerX06BaklavaPointSequence> cdi = cdc.iterator();
|
||||
Assertions.assertNotNull(cdc);
|
||||
Assertions.assertFalse(cdc.isEmpty());
|
||||
Assertions.assertEquals(10, cdc.size());
|
||||
Assertions.assertEquals(FCDotDEC2701DashPX0.ESC68_2PIE, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX10_J, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdi.next()); // 0
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdi.next()); // 1
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX03_C, cdi.next()); // 2
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdi.next()); // 0
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdi.next()); // 1
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdi.next()); // 3
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdi.next()); // 3
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX08_H, cdi.next()); // 7
|
||||
|
||||
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
|
||||
Assertions.assertEquals("01201337", out);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNumberX08() throws Exception {
|
||||
List<FourCornerX08MuffinPointSequence> cdc = FourCornerUnicodeImport.strict().convertToX08("01201337");
|
||||
Iterator<FourCornerX08MuffinPointSequence> cdi = cdc.iterator();
|
||||
Assertions.assertNotNull(cdc);
|
||||
Assertions.assertFalse(cdc.isEmpty());
|
||||
Assertions.assertEquals(10, cdc.size());
|
||||
Assertions.assertEquals(FCDotDEC2701DashPX0.ESC68_2PIE, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX10_J, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdi.next()); // 0
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdi.next()); // 1
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX03_C, cdi.next()); // 2
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdi.next()); // 0
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdi.next()); // 1
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdi.next()); // 3
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdi.next()); // 3
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX08_H, cdi.next()); // 7
|
||||
|
||||
String out = FourCornerUnicodeDisplay.text().renderFromX08(cdc);
|
||||
Assertions.assertEquals("01201337", out);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNumberX18() throws Exception {
|
||||
List<FourCornerX18CakePointSequence> 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<FourCornerX06BaklavaPointSequence> cdc = FourCornerUnicodeImport.lossy().convertToX06("A\nB\rC\r\nD\nE\u001B\u0085F\n\r\n\r\r\n");
|
||||
Iterator<FourCornerX06BaklavaPointSequence> cdi = cdc.iterator();
|
||||
Assertions.assertNotNull(cdc);
|
||||
Assertions.assertTrue(cdi.hasNext());
|
||||
Assertions.assertFalse(cdc.isEmpty());
|
||||
Assertions.assertEquals(14, cdc.size());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX01_A, cdi.next());
|
||||
Assertions.assertEquals(FCDotCMD5401Dash2D.CMD_F4TTY0001_NL, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX02_B, cdi.next());
|
||||
Assertions.assertEquals(FCDotCMD5401Dash2D.CMD_F4TTY0001_NL, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX03_C, cdi.next());
|
||||
Assertions.assertEquals(FCDotCMD5401Dash2D.CMD_F4TTY0001_NL, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX04_D, cdi.next());
|
||||
Assertions.assertEquals(FCDotCMD5401Dash2D.CMD_F4TTY0001_NL, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX05_E, cdi.next());
|
||||
Assertions.assertEquals(FCDotCMD5401Dash2D.CMD_F4TTY0001_NL, cdi.next());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6.NX06_F, cdi.next());
|
||||
Assertions.assertEquals(FCDotCMD5401Dash2D.CMD_F4TTY0001_NL, cdi.next());
|
||||
Assertions.assertEquals(FCDotCMD5401Dash2D.CMD_F4TTY0001_NL, cdi.next());
|
||||
Assertions.assertEquals(FCDotCMD5401Dash2D.CMD_F4TTY0001_NL, cdi.next());
|
||||
|
||||
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
|
||||
Assertions.assertEquals("A\nB\nC\nD\nE\nF\n\n\n", out);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWhiteSpace() throws Exception {
|
||||
String space16 = "\u3000\u205F\u202F\u200A\u2009\u2008\u2007\u2006\u2005\u2004\u2003\u2002\u2001\u2000\u00A0\u0020";
|
||||
List<FourCornerX06BaklavaPointSequence> cdc = FourCornerUnicodeImport.lossy().convertToX06(space16);
|
||||
Iterator<FourCornerX06BaklavaPointSequence> cdi = cdc.iterator();
|
||||
Assertions.assertNotNull(cdc);
|
||||
Assertions.assertTrue(cdi.hasNext());
|
||||
Assertions.assertFalse(cdc.isEmpty());
|
||||
Assertions.assertEquals(16, cdc.size());
|
||||
while (cdi.hasNext()) {
|
||||
Assertions.assertEquals(FCDotCMD5401Dash2D.CMD_F4TXT0001_SP, cdi.next());
|
||||
}
|
||||
String out = FourCornerUnicodeDisplay.text().renderFromX06(cdc);
|
||||
Assertions.assertEquals(" ", out);
|
||||
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
FourCornerUnicodeImport.strict().convertToX06(space16);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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.cake2.gram5;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Tests FCDotCDC1604DashP6 encoding.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Dec 30, 2024
|
||||
*/
|
||||
public class FCDotBIP0039Dash2KTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
if (args.length == 0) {
|
||||
System.err.println("No argument file given");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
File wordFile = new File(args[0]);
|
||||
List<String> words = Files.readAllLines(wordFile.toPath());
|
||||
int num = 0;
|
||||
for (String word : words) {
|
||||
String wordEnum = word.toUpperCase();
|
||||
System.out.println(String.format("\tT2048__%04d_%s,", num, wordEnum));
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValues() throws Exception {
|
||||
Assertions.assertEquals(2048, FCDotBIP0039Dash2K.valuesLength());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* 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.cake2.zero33;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Tests APL encoding.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 1, 2025
|
||||
*/
|
||||
public class FCDotAPLTest {
|
||||
|
||||
@Test
|
||||
public void testValuesLength() throws Exception {
|
||||
Assertions.assertEquals(27, FCDotAPL0127DashP7A.valuesLength());
|
||||
Assertions.assertEquals(27, FCDotAPL0127DashP7B.valuesLength());
|
||||
Assertions.assertEquals(27, FCDotAPL0127DashP7C.valuesLength());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValues() throws Exception {
|
||||
boolean duplicate = false;
|
||||
Map<Integer,FCDotAPL0127DashP7A> global = new HashMap<>();
|
||||
for (FCDotAPL0127DashP7A v : FCDotAPL0127DashP7A.values()) {
|
||||
Assertions.assertNotNull(v);
|
||||
if (global.containsKey(v.codePointDotIndex())) {
|
||||
duplicate = true;
|
||||
break;
|
||||
}
|
||||
global.put(v.codePointDotIndex(), v);
|
||||
}
|
||||
Assertions.assertTrue(global.size() > 1);
|
||||
Assertions.assertFalse(duplicate, "Duplicate ascii core value detected");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* 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.cake2.zero33;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.fc18.FourCornerUnicodeDisplay;
|
||||
import org.x4o.fc18.cake2.FourCornerX06BaklavaPointSequence;
|
||||
|
||||
/**
|
||||
* Tests BYD encoding.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Dec 30, 2024
|
||||
*/
|
||||
public class FCDotBYDTest {
|
||||
|
||||
@Test
|
||||
public void testValuesLength() throws Exception {
|
||||
Assertions.assertEquals(27, FCDotBYD0127DashP7D.valuesLength());
|
||||
Assertions.assertEquals(27, FCDotBYD0127DashP7E.valuesLength());
|
||||
Assertions.assertEquals(27, FCDotBYD0127DashP7F.valuesLength());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValues() throws Exception {
|
||||
boolean duplicate = false;
|
||||
Map<Integer,FCDotBYD0127DashP7D> global = new HashMap<>();
|
||||
for (FCDotBYD0127DashP7D v : FCDotBYD0127DashP7D.values()) {
|
||||
Assertions.assertNotNull(v);
|
||||
if (global.containsKey(v.codePointDotIndex())) {
|
||||
duplicate = true;
|
||||
break;
|
||||
}
|
||||
global.put(v.codePointDotIndex(), v);
|
||||
}
|
||||
Assertions.assertTrue(global.size() > 1);
|
||||
Assertions.assertFalse(duplicate, "Duplicate ascii core value detected");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDisplay() throws Exception {
|
||||
List<FourCornerX06BaklavaPointSequence> cdc = new ArrayList<>();
|
||||
cdc.add(FCDotBYD0127DashP7D.BOX2_01);
|
||||
cdc.add(FCDotBYD0127DashP7D.BOX2_02);
|
||||
cdc.add(FCDotBYD0127DashP7D.BOX2_02);
|
||||
cdc.add(FCDotBYD0127DashP7D.BOX2_01);
|
||||
cdc.add(FCDotBYD0127DashP7E.BOX1_01);
|
||||
cdc.add(FCDotBYD0127DashP7E.BOX1_03);
|
||||
cdc.add(FCDotBYD0127DashP7E.BOX1_03);
|
||||
cdc.add(FCDotBYD0127DashP7E.BOX1_07);
|
||||
|
||||
Assertions.assertEquals("═║║═─┄┄┌", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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.cake2.zero33;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Tests FCDotCDC1604DashP6 encoding.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Dec 30, 2024
|
||||
*/
|
||||
public class FCDotCDC1604DashP6Test {
|
||||
|
||||
@Test
|
||||
public void testValues() throws Exception {
|
||||
Assertions.assertEquals(64, FCDotCDC1604DashP6.valuesLength());
|
||||
boolean duplicate = false;
|
||||
Map<Integer,FCDotCDC1604DashP6> global = new HashMap<>();
|
||||
for (FCDotCDC1604DashP6 v : FCDotCDC1604DashP6.values()) {
|
||||
Assertions.assertNotNull(v);
|
||||
if (global.containsKey(v.codePointDotIndex())) {
|
||||
duplicate = true;
|
||||
break;
|
||||
}
|
||||
global.put(v.codePointDotIndex(), v);
|
||||
}
|
||||
Assertions.assertTrue(global.size() > 1);
|
||||
Assertions.assertFalse(duplicate, "Duplicate ascii core value detected");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* 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.cake2.zero33;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
|
||||
/**
|
||||
* Tests DEC encoding.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 08, 2025
|
||||
*/
|
||||
public class FCDotDEC0127DashPX0Test {
|
||||
|
||||
@Test
|
||||
public void testSize() throws Exception {
|
||||
Assertions.assertEquals(27, FCDotDEC2701DashPX0.values().length);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBaklavaSequence() throws Exception {
|
||||
List<Integer> seq = null;
|
||||
seq = FCDotDEC2701DashPX0._ESC_USER_1.baklavaPointSequence();
|
||||
Assertions.assertEquals(3, seq.size());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X1.ordinal(), seq.get(0));
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X1.ordinal(), seq.get(1));
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X1.ordinal(), seq.get(2));
|
||||
|
||||
seq = FCDotDEC2701DashPX0.ESC_VT06.baklavaPointSequence();
|
||||
Assertions.assertEquals(3, seq.size());
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X3.ordinal(), seq.get(0));
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X3.ordinal(), seq.get(1));
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X2.ordinal(), seq.get(2));
|
||||
|
||||
seq = FCDotDEC2701DashPX0.ESC_STOP.baklavaPointSequence();
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X3.ordinal(), seq.get(0));
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X3.ordinal(), seq.get(1));
|
||||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X3.ordinal(), seq.get(2));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* 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.cake2.zero33;
|
||||
|
||||
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.FourCornerUnicodeMapper;
|
||||
import org.x4o.fc18.cake2.FourCornerX06BaklavaPointSequence;
|
||||
import org.x4o.fc18.cake2.zero33.vt06.VTDash06DotZeroACursor;
|
||||
import org.x4o.fc18.cake2.zero33.vt06.VTDash06DotZeroCClear;
|
||||
|
||||
/**
|
||||
* Tests VT-06 encoding.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 14, 2025
|
||||
*/
|
||||
public class FCDotVT06Test {
|
||||
|
||||
@Test
|
||||
public void testCusorGoto() throws Exception {
|
||||
List<FourCornerX06BaklavaPointSequence> cdc = new ArrayList<>();
|
||||
cdc.add(VTDash06DotZeroACursor.NX_CURSOR_GOTO);
|
||||
cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(123)); // TODO: fix these are the wrong, we need to use the txt grams version
|
||||
cdc.add(FCDotCDC1604DashP6._RAKA_QUESTION);
|
||||
cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(456));
|
||||
cdc.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION);
|
||||
|
||||
Assertions.assertEquals("␘␘␇AG␇␇␘JBCD?␇␇␘JEFG!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||
// TODO: Fix lexer embedded escapes, and display external with single unicode escape sign
|
||||
//Assertions.assertEquals("?AG?BCD?EFG!", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClearTop5Lines() throws Exception {
|
||||
List<FourCornerX06BaklavaPointSequence> cdc = new ArrayList<>();
|
||||
cdc.add(VTDash06DotZeroCClear.VT_CLEAR_TOP);
|
||||
cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(5));
|
||||
cdc.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION);
|
||||
|
||||
Assertions.assertEquals("␘␘␇CA␇␇␘JF!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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.octal8;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/// Tests for smurf and hinari octal big indian sex words.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public class PrimordialOctalOrangeSexWordTest {
|
||||
|
||||
@Test
|
||||
public void testOctalMSB() throws Exception {
|
||||
PrimordialOctalOrangeSexWord word = new PrimordialOctalOrangeSexWord(PrimordialOctal.PART_1, PrimordialOctal.PART_1, PrimordialOctal.PART_1, PrimordialOctal.PART_2, PrimordialOctal.PART_8, PrimordialOctal.PART_8);
|
||||
Assertions.assertEquals(127, word.baitOctalNumber());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValueOfOne() throws Exception {
|
||||
PrimordialOctalOrangeSexWord word = PrimordialOctalOrangeSexWord.valueOfOne();
|
||||
Assertions.assertEquals(0, word.baitOctalNumber());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValueOfSmurf() throws Exception {
|
||||
PrimordialOctalOrangeSexWord word = PrimordialOctalOrangeSexWord.valueOfSmurf(0);
|
||||
Assertions.assertEquals(0, word.baitOctalNumber());
|
||||
|
||||
word = PrimordialOctalOrangeSexWord.valueOfSmurf(127);
|
||||
Assertions.assertEquals(127, word.baitOctalNumber());
|
||||
|
||||
word = PrimordialOctalOrangeSexWord.valueOfSmurf(32768);
|
||||
Assertions.assertEquals(32768, word.baitOctalNumber());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToString() throws Exception {
|
||||
PrimordialOctalOrangeSexWord word = PrimordialOctalOrangeSexWord.valueOfSmurf(0);
|
||||
Assertions.assertEquals("יֽ֔יֽ֔", word.toString());
|
||||
|
||||
word = PrimordialOctalOrangeSexWord.valueOfSmurf(262143); // max
|
||||
Assertions.assertEquals("וַ֝וַ֝", word.toString());
|
||||
|
||||
word = PrimordialOctalOrangeSexWord.valueOfSmurf(22270); // immortal
|
||||
Assertions.assertEquals("יֻ֟װַ֞", word.toString());
|
||||
}
|
||||
}
|
||||
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