Easter cleaning

This commit is contained in:
Willem Cazander 2025-05-07 21:46:32 +02:00
commit 9e36078b2e
1862 changed files with 270281 additions and 0 deletions

View file

@ -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());
}
}

View file

@ -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");
}
}

View file

@ -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));
}
}

View file

@ -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");
}
}

View file

@ -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));
}
}

View file

@ -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));
}
}