mbeckerle commented on code in PR #1149:
URL: https://github.com/apache/daffodil/pull/1149#discussion_r1460004762
##########
daffodil-lib/src/test/scala/org/apache/daffodil/lib/util/TestDecimalUtils.scala:
##########
@@ -1846,733 +1989,1620 @@ class TestDecimalUtils {
@Test def zonedIntAsciiStandardAllDigits(): Unit = {
assertEquals(
- zonedToNumber("0", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("0", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"0",
)
assertEquals(
- zonedFromNumber("0", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("0", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"0",
)
assertEquals(
- zonedToNumber("1", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("1", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"1",
)
assertEquals(
- zonedFromNumber("1", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("1", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"1",
)
assertEquals(
- zonedToNumber("2", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("2", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"2",
)
assertEquals(
- zonedFromNumber("2", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("2", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"2",
)
assertEquals(
- zonedToNumber("3", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("3", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"3",
)
assertEquals(
- zonedFromNumber("3", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("3", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"3",
)
assertEquals(
- zonedToNumber("4", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("4", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"4",
)
assertEquals(
- zonedFromNumber("4", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("4", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"4",
)
assertEquals(
- zonedToNumber("5", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("5", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"5",
)
assertEquals(
- zonedFromNumber("5", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("5", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"5",
)
assertEquals(
- zonedToNumber("6", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("6", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"6",
)
assertEquals(
- zonedFromNumber("6", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("6", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"6",
)
assertEquals(
- zonedToNumber("7", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("7", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"7",
)
assertEquals(
- zonedFromNumber("7", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("7", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"7",
)
assertEquals(
- zonedToNumber("8", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("8", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"8",
)
assertEquals(
- zonedFromNumber("8", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("8", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"8",
)
assertEquals(
- zonedToNumber("9", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("9", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"9",
)
assertEquals(
- zonedFromNumber("9", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("9", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"9",
)
assertEquals(
- zonedToNumber("1p", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.End),
+ zonedToNumber("1p", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.End),
"-10",
)
assertEquals(
- zonedFromNumber("-10", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.End),
+ zonedFromNumber("-10", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.End),
"1p",
)
assertEquals(
- zonedToNumber("q", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("q", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"-1",
)
assertEquals(
- zonedFromNumber("-1", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("-1", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"q",
)
assertEquals(
- zonedToNumber("r", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("r", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"-2",
)
assertEquals(
- zonedFromNumber("-2", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("-2", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"r",
)
assertEquals(
- zonedToNumber("s", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("s", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"-3",
)
assertEquals(
- zonedFromNumber("-3", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("-3", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"s",
)
assertEquals(
- zonedToNumber("t", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("t", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"-4",
)
assertEquals(
- zonedFromNumber("-4", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("-4", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"t",
)
assertEquals(
- zonedToNumber("u", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("u", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"-5",
)
assertEquals(
- zonedFromNumber("-5", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("-5", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"u",
)
assertEquals(
- zonedToNumber("v", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("v", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"-6",
)
assertEquals(
- zonedFromNumber("-6", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("-6", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"v",
)
assertEquals(
- zonedToNumber("w", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("w", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"-7",
)
assertEquals(
- zonedFromNumber("-7", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("-7", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"w",
)
assertEquals(
- zonedToNumber("x", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("x", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"-8",
)
assertEquals(
- zonedFromNumber("-8", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("-8", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"x",
)
assertEquals(
- zonedToNumber("y", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedToNumber("y", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"-9",
)
assertEquals(
- zonedFromNumber("-9", TextZonedSignStyle.AsciiStandard,
OverpunchLocation.Start),
+ zonedFromNumber("-9", Some(TextZonedSignStyle.AsciiStandard),
OverpunchLocation.Start),
"y",
)
}
@Test def zonedIntAsciiTranslatedEBCDICAllDigits(): Unit = {
assertEquals(
- zonedToNumber("0", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedToNumber(
+ "0",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"0",
)
assertEquals(
- zonedFromNumber("0", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedFromNumber(
+ "0",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"0",
)
assertEquals(
- zonedToNumber("1", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedToNumber(
+ "1",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"1",
)
assertEquals(
- zonedFromNumber("1", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedFromNumber(
+ "1",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"1",
)
assertEquals(
- zonedToNumber("2", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedToNumber(
+ "2",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"2",
)
assertEquals(
- zonedFromNumber("2", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedFromNumber(
+ "2",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"2",
)
assertEquals(
- zonedToNumber("3", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedToNumber(
+ "3",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"3",
)
assertEquals(
- zonedFromNumber("3", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedFromNumber(
+ "3",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"3",
)
assertEquals(
- zonedToNumber("4", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedToNumber(
+ "4",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"4",
)
assertEquals(
- zonedFromNumber("4", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedFromNumber(
+ "4",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"4",
)
assertEquals(
- zonedToNumber("5", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedToNumber(
+ "5",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"5",
)
assertEquals(
- zonedFromNumber("5", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedFromNumber(
+ "5",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"5",
)
assertEquals(
- zonedToNumber("6", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedToNumber(
+ "6",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"6",
)
assertEquals(
- zonedFromNumber("6", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedFromNumber(
+ "6",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"6",
)
assertEquals(
- zonedToNumber("7", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedToNumber(
+ "7",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"7",
)
assertEquals(
- zonedFromNumber("7", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedFromNumber(
+ "7",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"7",
)
assertEquals(
- zonedToNumber("8", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedToNumber(
+ "8",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"8",
)
assertEquals(
- zonedFromNumber("8", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedFromNumber(
+ "8",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"8",
)
assertEquals(
- zonedToNumber("9", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedToNumber(
+ "9",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"9",
)
assertEquals(
- zonedFromNumber("9", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.None),
+ zonedFromNumber(
+ "9",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.None,
+ ),
"9",
)
assertEquals(
- zonedToNumber("{", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "{",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"0",
)
assertEquals(
- zonedFromNumber("0", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "0",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"{",
)
assertEquals(
- zonedToNumber("A", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "A",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"1",
)
assertEquals(
- zonedFromNumber("1", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "1",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"A",
)
assertEquals(
- zonedToNumber("B", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "B",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"2",
)
assertEquals(
- zonedFromNumber("2", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "2",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"B",
)
assertEquals(
- zonedToNumber("C", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "C",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"3",
)
assertEquals(
- zonedFromNumber("3", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "3",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"C",
)
assertEquals(
- zonedToNumber("D", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "D",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"4",
)
assertEquals(
- zonedFromNumber("4", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "4",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"D",
)
assertEquals(
- zonedToNumber("E", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "E",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"5",
)
assertEquals(
- zonedFromNumber("5", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "5",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"E",
)
assertEquals(
- zonedToNumber("F", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "F",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"6",
)
assertEquals(
- zonedFromNumber("6", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "6",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"F",
)
assertEquals(
- zonedToNumber("G", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "G",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"7",
)
assertEquals(
- zonedFromNumber("7", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "7",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"G",
)
assertEquals(
- zonedToNumber("H", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "H",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"8",
)
assertEquals(
- zonedFromNumber("8", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "8",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"H",
)
assertEquals(
- zonedToNumber("I", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "I",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"9",
)
assertEquals(
- zonedFromNumber("9", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "9",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"I",
)
assertEquals(
- zonedToNumber("1}", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.End),
+ zonedToNumber(
+ "1}",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.End,
+ ),
"-10",
)
assertEquals(
- zonedFromNumber("-10", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.End),
+ zonedFromNumber(
+ "-10",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.End,
+ ),
"1}",
)
assertEquals(
- zonedToNumber("J", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "J",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"-1",
)
assertEquals(
- zonedFromNumber("-1", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-1",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"J",
)
assertEquals(
- zonedToNumber("K", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "K",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"-2",
)
assertEquals(
- zonedFromNumber("-2", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-2",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"K",
)
assertEquals(
- zonedToNumber("L", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "L",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"-3",
)
assertEquals(
- zonedFromNumber("-3", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-3",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"L",
)
assertEquals(
- zonedToNumber("M", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "M",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"-4",
)
assertEquals(
- zonedFromNumber("-4", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-4",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"M",
)
assertEquals(
- zonedToNumber("N", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "N",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"-5",
)
assertEquals(
- zonedFromNumber("-5", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-5",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"N",
)
assertEquals(
- zonedToNumber("O", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "O",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"-6",
)
assertEquals(
- zonedFromNumber("-6", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-6",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"O",
)
assertEquals(
- zonedToNumber("P", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "P",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"-7",
)
assertEquals(
- zonedFromNumber("-7", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-7",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"P",
)
assertEquals(
- zonedToNumber("Q", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "Q",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"-8",
)
assertEquals(
- zonedFromNumber("-8", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-8",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"Q",
)
assertEquals(
- zonedToNumber("R", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedToNumber(
+ "R",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"-9",
)
assertEquals(
- zonedFromNumber("-9", TextZonedSignStyle.AsciiTranslatedEBCDIC,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-9",
+ Some(TextZonedSignStyle.AsciiTranslatedEBCDIC),
+ OverpunchLocation.Start,
+ ),
"R",
)
}
@Test def zonedIntAsciiCARealiaModifiedAllDigits(): Unit = {
assertEquals(
- zonedToNumber("0", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "0",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"0",
)
assertEquals(
- zonedFromNumber("0", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "0",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"0",
)
assertEquals(
- zonedToNumber("1", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "1",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"1",
)
assertEquals(
- zonedFromNumber("1", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "1",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"1",
)
assertEquals(
- zonedToNumber("2", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "2",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"2",
)
assertEquals(
- zonedFromNumber("2", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "2",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"2",
)
assertEquals(
- zonedToNumber("3", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "3",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"3",
)
assertEquals(
- zonedFromNumber("3", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "3",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"3",
)
assertEquals(
- zonedToNumber("4", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "4",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"4",
)
assertEquals(
- zonedFromNumber("4", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "4",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"4",
)
assertEquals(
- zonedToNumber("5", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "5",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"5",
)
assertEquals(
- zonedFromNumber("5", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "5",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"5",
)
assertEquals(
- zonedToNumber("6", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "6",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"6",
)
assertEquals(
- zonedFromNumber("6", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "6",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"6",
)
assertEquals(
- zonedToNumber("7", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "7",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"7",
)
assertEquals(
- zonedFromNumber("7", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "7",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"7",
)
assertEquals(
- zonedToNumber("8", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "8",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"8",
)
assertEquals(
- zonedFromNumber("8", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "8",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"8",
)
assertEquals(
- zonedToNumber("9", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "9",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"9",
)
assertEquals(
- zonedFromNumber("9", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "9",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"9",
)
assertEquals(
- zonedToNumber("1 ", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.End),
+ zonedToNumber(
+ "1 ",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.End,
+ ),
"-10",
)
assertEquals(
- zonedFromNumber("-10", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.End),
+ zonedFromNumber(
+ "-10",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.End,
+ ),
"1 ",
)
assertEquals(
- zonedToNumber("!", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "!",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"-1",
)
assertEquals(
- zonedFromNumber("-1", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-1",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"!",
)
assertEquals(
- zonedToNumber("\"", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "\"",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"-2",
)
assertEquals(
- zonedFromNumber("-2", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-2",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"\"",
)
assertEquals(
- zonedToNumber("#", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "#",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"-3",
)
assertEquals(
- zonedFromNumber("-3", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-3",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"#",
)
assertEquals(
- zonedToNumber("$", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "$",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"-4",
)
assertEquals(
- zonedFromNumber("-4", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-4",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"$",
)
assertEquals(
- zonedToNumber("%", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "%",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"-5",
)
assertEquals(
- zonedFromNumber("-5", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-5",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"%",
)
assertEquals(
- zonedToNumber("&", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "&",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"-6",
)
assertEquals(
- zonedFromNumber("-6", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-6",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"&",
)
assertEquals(
- zonedToNumber("'", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "'",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"-7",
)
assertEquals(
- zonedFromNumber("-7", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-7",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"'",
)
assertEquals(
- zonedToNumber("(", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ "(",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"-8",
)
assertEquals(
- zonedFromNumber("-8", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-8",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"(",
)
assertEquals(
- zonedToNumber(")", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedToNumber(
+ ")",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
"-9",
)
assertEquals(
- zonedFromNumber("-9", TextZonedSignStyle.AsciiCARealiaModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-9",
+ Some(TextZonedSignStyle.AsciiCARealiaModified),
+ OverpunchLocation.Start,
+ ),
")",
)
}
@Test def zonedIntAsciiTandemModifiedAllDigits(): Unit = {
assertEquals(
- zonedToNumber("0", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("0", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"0",
)
assertEquals(
- zonedFromNumber("0", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "0",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"0",
)
assertEquals(
- zonedToNumber("1", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("1", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"1",
)
assertEquals(
- zonedFromNumber("1", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "1",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"1",
)
assertEquals(
- zonedToNumber("2", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("2", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"2",
)
assertEquals(
- zonedFromNumber("2", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "2",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"2",
)
assertEquals(
- zonedToNumber("3", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("3", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"3",
)
assertEquals(
- zonedFromNumber("3", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "3",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"3",
)
assertEquals(
- zonedToNumber("4", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("4", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"4",
)
assertEquals(
- zonedFromNumber("4", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "4",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"4",
)
assertEquals(
- zonedToNumber("5", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("5", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"5",
)
assertEquals(
- zonedFromNumber("5", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "5",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"5",
)
assertEquals(
- zonedToNumber("6", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("6", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"6",
)
assertEquals(
- zonedFromNumber("6", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "6",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"6",
)
assertEquals(
- zonedToNumber("7", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("7", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"7",
)
assertEquals(
- zonedFromNumber("7", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "7",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"7",
)
assertEquals(
- zonedToNumber("8", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("8", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"8",
)
assertEquals(
- zonedFromNumber("8", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "8",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"8",
)
assertEquals(
- zonedToNumber("9", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("9", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"9",
)
assertEquals(
- zonedFromNumber("9", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "9",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"9",
)
assertEquals(
- zonedToNumber("1", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.End),
+ zonedToNumber("1", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.End),
"-10",
)
assertEquals(
- zonedFromNumber("-10", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.End),
+ zonedFromNumber(
+ "-10",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.End,
+ ),
"1",
)
assertEquals(
- zonedToNumber("", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"-1",
)
assertEquals(
- zonedFromNumber("-1", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-1",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"",
)
assertEquals(
- zonedToNumber("", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"-2",
)
assertEquals(
- zonedFromNumber("-2", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-2",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"",
)
assertEquals(
- zonedToNumber("", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"-3",
)
assertEquals(
- zonedFromNumber("-3", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-3",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"",
)
assertEquals(
- zonedToNumber("", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"-4",
)
assertEquals(
- zonedFromNumber("-4", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-4",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"",
)
assertEquals(
- zonedToNumber("
", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("
", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"-5",
)
assertEquals(
- zonedFromNumber("-5", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-5",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"
",
)
assertEquals(
- zonedToNumber("", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"-6",
)
assertEquals(
- zonedFromNumber("-6", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-6",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"",
)
assertEquals(
- zonedToNumber("", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"-7",
)
assertEquals(
- zonedFromNumber("-7", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-7",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"",
)
assertEquals(
- zonedToNumber("", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"-8",
)
assertEquals(
- zonedFromNumber("-8", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-8",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"",
)
assertEquals(
- zonedToNumber("", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedToNumber("", Some(TextZonedSignStyle.AsciiTandemModified),
OverpunchLocation.Start),
"-9",
)
assertEquals(
- zonedFromNumber("-9", TextZonedSignStyle.AsciiTandemModified,
OverpunchLocation.Start),
+ zonedFromNumber(
+ "-9",
+ Some(TextZonedSignStyle.AsciiTandemModified),
+ OverpunchLocation.Start,
+ ),
"",
)
}
+
Review Comment:
You are correct. Fixed and tests added.
##########
daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/DecimalUtils.scala:
##########
@@ -386,6 +386,25 @@ object DecimalUtils {
outArray
}
+ /**
+ * Despite the name, this does not actually convert the digit from EBCDIC
encoding.
+ * The characters have already been decoded from whatever charset into
Unicode code points.
+ * What this does is deal with overpunched negative sign character mappings.
+ * In this case "}JKLMNOPQR" are negative 0 to 9.
+ * @param digit
+ * @return A pair of the integer the digit represents, and a boolean
indicating if negative.
+ */
+ def convertFromZonedEBCDIC(digit: Char): (Int, Boolean) = {
+ if ((digit >= '0') && (digit <= '9')) // positive 0-9
+ (digit - 48, false)
+ else if (digit == '}') // negative 0
+ (0, true)
+ else if ((digit >= 'J') && (digit <= 'R')) // negative 1-9
+ (digit - 'J' + 1, true)
+ else
+ throw new NumberFormatException("Invalid zoned digit: " + digit)
Review Comment:
Correct. Fixed.
##########
daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/ElementBaseGrammarMixin.scala:
##########
@@ -700,6 +701,30 @@ trait ElementBaseGrammarMixin
ConvertZonedCombinator(this, stringValue, textZonedConverter)
}
+ /**
+ * True if the encoding is known to be an EBCDIC one, as in the encoding is
not a runtime expression
+ * and it's some ebcdic flavor. If it's any ascii flavor or a runtime
expression this is false.
+ */
+ lazy val isKnownEBCDICEncoding: Boolean = {
+ charsetEv.optConstant
+ .map { bcs: BitsCharset =>
+ val nom = bcs.name.toUpperCase()
+ val res = (nom == "IBM037") ||
+ nom.startsWith("EBCDIC")
Review Comment:
Good idea. Added/
##########
daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/DecimalUtils.scala:
##########
@@ -417,6 +436,25 @@ object DecimalUtils {
throw new NumberFormatException("Invalid zoned digit: " + digit)
}
+ /**
+ * Does not encode to the EBCDIC charset, but converts negative digits
+ * to their EBCDIC Zoned overpunched representation where negative 0 to 9
+ * are mapped to "}JKLMNOPQR".
+ * @param digit - the digit, as a char '0' to '9'
+ * @param positive - true if positive, false if negative
+ * @return the character needed to represent this character as an
overpunched sign digit.
Review Comment:
You are correct. Fixed.
##########
daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/ElementBaseGrammarMixin.scala:
##########
@@ -700,6 +701,30 @@ trait ElementBaseGrammarMixin
ConvertZonedCombinator(this, stringValue, textZonedConverter)
}
+ /**
+ * True if the encoding is known to be an EBCDIC one, as in the encoding is
not a runtime expression
+ * and it's some ebcdic flavor. If it's any ascii flavor or a runtime
expression this is false.
+ */
+ lazy val isKnownEBCDICEncoding: Boolean = {
+ charsetEv.optConstant
+ .map { bcs: BitsCharset =>
+ val nom = bcs.name.toUpperCase()
+ val res = (nom == "IBM037") ||
+ nom.startsWith("EBCDIC")
+ res
+ }
+ .getOrElse(false)
+ }
+
+ /**
+ * Avoids requesting the textZonedSignStyle property if we know the encoding
+ * is an EBCDIC flavor.
+ */
+ lazy val optTextZonedSignStyle = {
+ if (isKnownEBCDICEncoding) None
+ else Some(textZonedSignStyle)
+ }
Review Comment:
The purpose of this is just to avoid requiring the textZonedSignStyle
property when it is known not to be needed. If the charset evaluates to EBCDIC
at runtime we'lll require this property because it *could* have evaluated to
ascii-based. So I think there is no downside to this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]