FC18: Added raw impl of 144 bit numbers
This commit is contained in:
parent
d41af20079
commit
46d305b5aa
9 changed files with 345 additions and 106 deletions
|
|
@ -64,15 +64,37 @@ public class StenoGrapherTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDozegerValues() throws Exception {
|
||||
public void testINT144Values() throws Exception {
|
||||
List<Integer> outX18 = new ArrayList<>();
|
||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
||||
writerX18.strobeNumberDozeger(BigInteger.valueOf(123));
|
||||
writerX18.strobeNumberINT144(BigInteger.valueOf(123));
|
||||
writerX18.strobeWord(FCDotCDC1604DashP6.NY19_MINUS.ordinal());
|
||||
writerX18.strobeNumberDozeger(FourCornerZion7Petroglyphs.DOZEGER192_VALUE_MAX);
|
||||
writerX18.strobeNumberDozeger(BigInteger.valueOf(-123));
|
||||
writerX18.strobeNumberINT144(FourCornerZion7Petroglyphs.INT144_VALUE_MAX);
|
||||
writerX18.strobeNumberINT144(BigInteger.valueOf(-123));
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
||||
Assertions.assertEquals("123-3138550867693340381917894711603833208051177722232017256447-123", resX18);
|
||||
Assertions.assertEquals("123-11150372599265311570767859136324180752990207-123", resX18);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDEC144Values() throws Exception {
|
||||
List<Integer> outX18 = new ArrayList<>();
|
||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
||||
writerX18.strobeNumberDEC144(BigInteger.valueOf(123), 456);
|
||||
writerX18.strobeWord(FCDotCDC1604DashP6.NY09_EQUALS.ordinal());
|
||||
writerX18.strobeNumberDEC144(FourCornerZion7Petroglyphs.DEC144_COEFFICIENT_MAX, FourCornerZion7Petroglyphs.DEC144_EXPONENT_MAX);
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
||||
Assertions.assertEquals("123*10⁴⁵⁶=42535295865117307932921825928971026431*10¹³¹⁰⁷¹", resX18);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFP144Values() throws Exception {
|
||||
List<Integer> outX18 = new ArrayList<>();
|
||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
||||
writerX18.strobeNumberFP144(true, 456, BigInteger.valueOf(123));
|
||||
writerX18.strobeWord(FCDotCDC1604DashP6.NY09_EQUALS.ordinal());
|
||||
writerX18.strobeNumberFP144(false, FourCornerZion7Petroglyphs.FP144_EXPONENT_MAX, FourCornerZion7Petroglyphs.FP144_SIGNIFICAND_MAX);
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
||||
Assertions.assertEquals("(-1)¹*2⁴⁵⁶⁻¹²⁷*1.123=(-1)⁰*2¹³¹⁰⁷¹⁻¹²⁷*1.85070591730234615865843651857942052863", resX18);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -82,14 +104,14 @@ public class StenoGrapherTest {
|
|||
FourCornerZion7Candlelier writerX06 = FourCornerZionStenoGrapher.writerX06(outX06);
|
||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
||||
BigInteger v1 = BigInteger.valueOf(123);
|
||||
writerX06.strobeNCR1632(BigInteger.ONE, v1);
|
||||
writerX18.strobeNCR1632(BigInteger.ONE, v1);
|
||||
writerX06.strobeNumberNCR1632(BigInteger.ONE, v1);
|
||||
writerX18.strobeNumberNCR1632(BigInteger.ONE, v1);
|
||||
BigInteger v2 = BigInteger.valueOf(12345);
|
||||
writerX06.strobeNCR1632(BigInteger.ONE, v2);
|
||||
writerX18.strobeNCR1632(BigInteger.ONE, v2);
|
||||
writerX06.strobeNumberNCR1632(BigInteger.ONE, v2);
|
||||
writerX18.strobeNumberNCR1632(BigInteger.ONE, v2);
|
||||
BigInteger v3 = BigInteger.valueOf(-5432);
|
||||
writerX06.strobeNCR1632(v3, v3);
|
||||
writerX18.strobeNCR1632(v3, v3);
|
||||
writerX06.strobeNumberNCR1632(v3, v3);
|
||||
writerX18.strobeNumberNCR1632(v3, v3);
|
||||
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(outX06);
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
||||
Assertions.assertEquals(resX18, resX06);
|
||||
|
|
@ -106,7 +128,7 @@ public class StenoGrapherTest {
|
|||
writerX18.strobeDocumentAlpha();
|
||||
for (int x = 1; x <= 1025 /*_999999*/; x++) {
|
||||
BigInteger v = BigInteger.valueOf(x);
|
||||
writerX18.strobeNCR1632(BigInteger.ONE, v);
|
||||
writerX18.strobeNumberNCR1632(BigInteger.ONE, v);
|
||||
writerX18.strobeWord(FCDotF4TTY0001DashNL.NETHER_LINE.cakePointDotIndex());
|
||||
}
|
||||
writerX18.strobeDocumentOmega();
|
||||
|
|
@ -133,8 +155,8 @@ public class StenoGrapherTest {
|
|||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
||||
for (int x = 1; x <= 1025; x++) {
|
||||
BigInteger v = BigInteger.valueOf(x);
|
||||
writerX06.strobeNCR1632(BigInteger.ONE, v);
|
||||
writerX18.strobeNCR1632(BigInteger.ONE, v);
|
||||
writerX06.strobeNumberNCR1632(BigInteger.ONE, v);
|
||||
writerX18.strobeNumberNCR1632(BigInteger.ONE, v);
|
||||
}
|
||||
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(outX06);
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
||||
|
|
@ -154,19 +176,19 @@ public class StenoGrapherTest {
|
|||
FourCornerZion7Candlelier writerX06 = FourCornerZionStenoGrapher.writerX06(outX06);
|
||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
||||
BigInteger maxValue = new BigInteger("7FFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
|
||||
writerX06.strobeNCR1632(maxValue, maxValue);
|
||||
writerX06.strobeNumberNCR1632(maxValue, maxValue);
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writerX06.strobeNCR1632(maxValue, maxValue.add(BigInteger.ONE));
|
||||
writerX06.strobeNumberNCR1632(maxValue, maxValue.add(BigInteger.ONE));
|
||||
});
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writerX06.strobeNCR1632(maxValue.add(BigInteger.ONE), maxValue);
|
||||
writerX06.strobeNumberNCR1632(maxValue.add(BigInteger.ONE), maxValue);
|
||||
});
|
||||
writerX18.strobeNCR1632(maxValue, maxValue);
|
||||
writerX18.strobeNumberNCR1632(maxValue, maxValue);
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writerX18.strobeNCR1632(maxValue, maxValue.add(BigInteger.ONE));
|
||||
writerX18.strobeNumberNCR1632(maxValue, maxValue.add(BigInteger.ONE));
|
||||
});
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writerX18.strobeNCR1632(maxValue.add(BigInteger.ONE), maxValue);
|
||||
writerX18.strobeNumberNCR1632(maxValue.add(BigInteger.ONE), maxValue);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class StenoLexerNCRTest {
|
|||
Assertions.assertEquals(0, smokeReader.pipeSmokeClouds);
|
||||
lexer.read(cdc);
|
||||
Assertions.assertEquals(1, smokeReader.pipeSmokeClouds);
|
||||
Assertions.assertEquals("burnNCR1632MissingSparkler", smokeReader.pipeError);
|
||||
Assertions.assertEquals("burnNumberNCR1632MissingSparkler", smokeReader.pipeError);
|
||||
|
||||
cdc.addAll(FCDotDEC2701DashPX0.ESC_STOP.baklavaPointSequence()); // the print above auto value + next test
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() - 1 + 123); // normal NXX_123
|
||||
|
|
@ -69,7 +69,7 @@ public class StenoLexerNCRTest {
|
|||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 123); // normal NXX_123
|
||||
smokeReader.reset();
|
||||
lexer.read(cdc);
|
||||
String res = "[0:1:burnNCR1632MissingSparkler][0:8:burnNCR1632MissingSparkler]¹³⁷⁴³⁸⁹⁵³⁵⁹⁴/₁₃₄₂₁₇₇₃₉[0:16:burnNCR1632MissingSparkler]";
|
||||
String res = "[0:1:burnNumberNCR1632MissingSparkler][0:8:burnNumberNCR1632MissingSparkler]¹³⁷⁴³⁸⁹⁵³⁵⁹⁴/₁₃₄₂₁₇₇₃₉[0:16:burnNumberNCR1632MissingSparkler]";
|
||||
Assertions.assertEquals(res, FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue