diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotAPL0127DashP7A.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotAPL0127DashP7A.java index 632af03..4773dd8 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotAPL0127DashP7A.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotAPL0127DashP7A.java @@ -133,11 +133,11 @@ public enum FCDotAPL0127DashP7A implements FourCornerX06BaklavaPoints, FourCorne return new int[] {codePoint}; } - static public int length() { + static public int valuesLength() { return VALUES.length; } - static public FCDotAPL0127DashP7A indexOf(int idx) { + static public FCDotAPL0127DashP7A valueOf(int idx) { return VALUES[idx]; } } diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotAPL0127DashP7B.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotAPL0127DashP7B.java index 2ac3f04..635da36 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotAPL0127DashP7B.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotAPL0127DashP7B.java @@ -137,11 +137,11 @@ public enum FCDotAPL0127DashP7B implements FourCornerX06BaklavaPoints, FourCorne return new int[] {codePoint}; } - static public int length() { + static public int valuesLength() { return VALUES.length; } - static public FCDotAPL0127DashP7B indexOf(int idx) { + static public FCDotAPL0127DashP7B valueOf(int idx) { return VALUES[idx]; } } diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotAPL0127DashP7C.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotAPL0127DashP7C.java index 9baafb3..9261736 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotAPL0127DashP7C.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotAPL0127DashP7C.java @@ -139,11 +139,11 @@ public enum FCDotAPL0127DashP7C implements FourCornerX06BaklavaPoints, FourCorne return new int[] {codePoint}; } - static public int length() { + static public int valuesLength() { return VALUES.length; } - static public FCDotAPL0127DashP7C indexOf(int idx) { + static public FCDotAPL0127DashP7C valueOf(int idx) { return VALUES[idx]; } } diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotBYD0127DashP7D.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotBYD0127DashP7D.java index 0f42f46..952eac7 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotBYD0127DashP7D.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotBYD0127DashP7D.java @@ -95,11 +95,11 @@ public enum FCDotBYD0127DashP7D implements FourCornerX06BaklavaPoints, FourCorne return new int[] {codePoint}; } - static public int length() { + static public int valuesLength() { return VALUES.length; } - static public FCDotBYD0127DashP7D indexOf(int idx) { + static public FCDotBYD0127DashP7D valueOf(int idx) { return VALUES[idx]; } } diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotBYD0127DashP7E.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotBYD0127DashP7E.java index 4b075ad..dcaa079 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotBYD0127DashP7E.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotBYD0127DashP7E.java @@ -95,11 +95,11 @@ public enum FCDotBYD0127DashP7E implements FourCornerX06BaklavaPoints, FourCorne return new int[] {codePoint}; } - static public int length() { + static public int valuesLength() { return VALUES.length; } - static public FCDotBYD0127DashP7E indexOf(int idx) { + static public FCDotBYD0127DashP7E valueOf(int idx) { return VALUES[idx]; } } diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotBYD0127DashP7F.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotBYD0127DashP7F.java index 57c7579..3ae3c86 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotBYD0127DashP7F.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotBYD0127DashP7F.java @@ -94,11 +94,11 @@ public enum FCDotBYD0127DashP7F implements FourCornerX06BaklavaPoints, FourCorne return new int[] {codePoint}; } - static public int length() { + static public int valuesLength() { return VALUES.length; } - static public FCDotBYD0127DashP7F indexOf(int idx) { + static public FCDotBYD0127DashP7F valueOf(int idx) { return VALUES[idx]; } } diff --git a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerWriteExampleMD.java b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerWriteExampleMD.java index 86151f1..d088d92 100644 --- a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerWriteExampleMD.java +++ b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerWriteExampleMD.java @@ -79,18 +79,18 @@ public class FourCornerWriteExampleMD { int startAPL = FourCornerDotCake.FC_APL0127_P7A.getStart(); writeTitle3(buf, "FC.APL0127-P7(ABC)"); writeTableStart28(buf); - writeAPL(buf, startAPL + 0, v -> FCDotAPL0127DashP7A.indexOf(v).codePoints()[0]); - writeAPL(buf, startAPL + 27, v -> FCDotAPL0127DashP7B.indexOf(v).codePoints()[0]); - writeAPL(buf, startAPL + 54, v -> FCDotAPL0127DashP7C.indexOf(v).codePoints()[0]); + writeAPL(buf, startAPL + 0, v -> FCDotAPL0127DashP7A.valueOf(v).codePoints()[0]); + writeAPL(buf, startAPL + 27, v -> FCDotAPL0127DashP7B.valueOf(v).codePoints()[0]); + writeAPL(buf, startAPL + 54, v -> FCDotAPL0127DashP7C.valueOf(v).codePoints()[0]); writeTableEnd(buf); buf.append("

\n"); int startBYD = FourCornerDotCake.FC_BYD0127_P7D.getStart(); writeTitle3(buf, "FC.BYD0127-P7(DEF)"); writeTableStart28(buf); - writeBYD(buf, startBYD + 0, v -> FCDotBYD0127DashP7D.indexOf(v).codePoints()[0]); - writeBYD(buf, startBYD + 27, v -> FCDotBYD0127DashP7E.indexOf(v).codePoints()[0]); - writeBYD(buf, startBYD + 54, v -> FCDotBYD0127DashP7F.indexOf(v).codePoints()[0]); + writeBYD(buf, startBYD + 0, v -> FCDotBYD0127DashP7D.valueOf(v).codePoints()[0]); + writeBYD(buf, startBYD + 27, v -> FCDotBYD0127DashP7E.valueOf(v).codePoints()[0]); + writeBYD(buf, startBYD + 54, v -> FCDotBYD0127DashP7F.valueOf(v).codePoints()[0]); writeTableEnd(buf); buf.append("

\n"); diff --git a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotAPL1604DashP8LTest.java b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotAPLTest.java similarity index 86% rename from nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotAPL1604DashP8LTest.java rename to nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotAPLTest.java index ca6d3e6..9b77905 100644 --- a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotAPL1604DashP8LTest.java +++ b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotAPLTest.java @@ -29,18 +29,22 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** - * Tests FCDotAPL1604DashS6 encoding. + * Tests APL encoding. * * @author Willem Cazander * @version 1.0 Jan 1, 2025 */ -public class FCDotAPL1604DashP8LTest { +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 { - Assertions.assertEquals(27, FCDotAPL0127DashP7A.length()); - Assertions.assertEquals(27, FCDotAPL0127DashP7B.length()); - Assertions.assertEquals(27, FCDotAPL0127DashP7C.length()); boolean duplicate = false; Map global = new HashMap<>(); for (FCDotAPL0127DashP7A v : FCDotAPL0127DashP7A.values()) { diff --git a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotBYD1604DashP8HTest.java b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotBYDTest.java similarity index 89% rename from nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotBYD1604DashP8HTest.java rename to nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotBYDTest.java index d6e2848..edc386d 100644 --- a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotBYD1604DashP8HTest.java +++ b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotBYDTest.java @@ -33,16 +33,22 @@ import org.x4o.o2o.fc18.FourCornerUnicodeDisplay; import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints; /** - * Tests FCDotBYD1604DashC6 encoding. + * Tests BYD encoding. * * @author Willem Cazander * @version 1.0 Dec 30, 2024 */ -public class FCDotBYD1604DashP8HTest { +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 { - Assertions.assertEquals(27, FCDotBYD0127DashP7D.length()); boolean duplicate = false; Map global = new HashMap<>(); for (FCDotBYD0127DashP7D v : FCDotBYD0127DashP7D.values()) { diff --git a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC0127DashP7GTest.java b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC0127DashPX0Test.java similarity index 65% rename from nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC0127DashP7GTest.java rename to nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC0127DashPX0Test.java index 46dbb7e..991b761 100644 --- a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC0127DashP7GTest.java +++ b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC0127DashPX0Test.java @@ -22,24 +22,16 @@ */ package org.x4o.o2o.fc18.zero33; -import java.util.ArrayList; -import java.util.List; - import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.x4o.o2o.fc18.FourCornerUnicodeDisplay; -import org.x4o.o2o.fc18.FourCornerUnicodeMapper; -import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints; -import org.x4o.o2o.fc18.vt06.VTDash06DotZeroACursor; -import org.x4o.o2o.fc18.vt06.VTDash06DotZeroCClear; /** - * Tests FCDotCDC1604DashP6 encoding. + * Tests DEC encoding. * * @author Willem Cazander * @version 1.0 Jan 08, 2025 */ -public class FCDotDEC0127DashP7GTest { +public class FCDotDEC0127DashPX0Test { @Test public void testSize() throws Exception { @@ -71,29 +63,4 @@ public class FCDotDEC0127DashP7GTest { Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X3.ordinal(), seq[1]); Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X3.ordinal(), seq[2]); } - - @Test - public void testCusorGoto() throws Exception { - List cdc = new ArrayList<>(); - cdc.add(VTDash06DotZeroACursor.NX_CURSOR_GOTO); - cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(123)); - cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_RAKA_AT); - cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(456)); - cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_SALAH); - - 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 cdc = new ArrayList<>(); - cdc.add(VTDash06DotZeroCClear.VT_CLEAR_TOP); - cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_RAKA_AT); - cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(5)); - cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_SALAH); - - Assertions.assertEquals("␁␂␃CA␂␃␂␃␃␁JF␂␃␁", FourCornerUnicodeDisplay.raw().renderFromX06(cdc)); - } } diff --git a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotVT06Test.java b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotVT06Test.java new file mode 100644 index 0000000..fcef3b1 --- /dev/null +++ b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotVT06Test.java @@ -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.o2o.fc18.zero33; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.x4o.o2o.fc18.FourCornerUnicodeDisplay; +import org.x4o.o2o.fc18.FourCornerUnicodeMapper; +import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints; +import org.x4o.o2o.fc18.vt06.VTDash06DotZeroACursor; +import org.x4o.o2o.fc18.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 cdc = new ArrayList<>(); + cdc.add(VTDash06DotZeroACursor.NX_CURSOR_GOTO); + cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(123)); + cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_RAKA_AT); + cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(456)); + cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_SALAH); + + 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 cdc = new ArrayList<>(); + cdc.add(VTDash06DotZeroCClear.VT_CLEAR_TOP); + cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(5)); + cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_SALAH); + + Assertions.assertEquals("␁␂␃CA␃␃␁JF␂␃␁", FourCornerUnicodeDisplay.raw().renderFromX06(cdc)); + } +}