Fixed terminator under range fire test

This commit is contained in:
Willem Cazander 2024-12-26 03:35:29 +01:00
parent 494556da06
commit 5d806130f2
2 changed files with 21 additions and 1 deletions

View file

@ -243,8 +243,13 @@ public enum CDC1604DashP6 {
break;
}
numberMode = cdc.next();
if (numberMode.ordinal() < CDC1604DashP6.NX01_A.ordinal()) {
cdcPoint = numberMode; // print char
numberMode = null; // illegal number mode
} else {
continue;
}
}
if (numberMode == null) {
buf.appendCodePoint(cdcPoint.asciiByte());
} else {

View file

@ -99,6 +99,21 @@ public class CDC1604DashP6Test {
Assertions.assertEquals("01201337", out);
}
@Test
public void testNumberTerminatorOutOfRange() throws Exception {
List<CDC1604DashP6> cdc = new ArrayList<>();
cdc.add(CDC1604DashP6.NX24_X); // = X
cdc.add(CDC1604DashP6.__PIE);
cdc.add(CDC1604DashP6._CARET); // ^
cdc.add(CDC1604DashP6._PERCENT); // = %
cdc.add(CDC1604DashP6.__PIE);
cdc.add(CDC1604DashP6._AT);
cdc.add(CDC1604DashP6.NX11_K); // = K
String out = CDC1604DashP6.convertToUnicode(cdc);
Assertions.assertEquals("X^%@K", out);
}
@Test
public void testNumberPieOutOfRange() throws Exception {
List<CDC1604DashP6> cdc = new ArrayList<>();