FC18: Added number gram support to zion interfaces
This commit is contained in:
parent
dc0f9b2282
commit
8c43b8dd63
7 changed files with 239 additions and 13 deletions
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* 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.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.zion7.FourCornerZion7Candlelier;
|
||||
import org.x4o.fc18.zion7.FourCornerZion7NumberGram;
|
||||
import org.x4o.fc18.zion7.FourCornerZionStenoGrapher;
|
||||
|
||||
/**
|
||||
* Tests txt grams encoding.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 25, 2025
|
||||
*/
|
||||
public class FCNumberGramTest {
|
||||
|
||||
@Test
|
||||
public void testCut10Simple() throws Exception {
|
||||
List<Integer> out = new ArrayList<>();
|
||||
FourCornerZion7Candlelier writer = FourCornerZionStenoGrapher.writerX18(out);
|
||||
writer.strobeNumberGrams(FourCornerZion7NumberGram.CUT_10, List.of(0,1,2,3,4,5,6,7,8,9));
|
||||
String res = FourCornerUnicodeDisplay.text().renderFromInt18(out);
|
||||
Assertions.assertEquals("0123456789", res);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCutArguFail() throws Exception {
|
||||
List<Integer> out = new ArrayList<>();
|
||||
FourCornerZion7Candlelier writer = FourCornerZionStenoGrapher.writerX18(out);
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writer.strobeNumberGrams(FourCornerZion7NumberGram.CUT_10, List.of(11));
|
||||
});
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writer.strobeNumberGrams(FourCornerZion7NumberGram.CUT_10, List.of(-1));
|
||||
});
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writer.strobeNumberGrams(FourCornerZion7NumberGram.CUT_1, List.of(1));
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue