diff options
author | Shevek <[email protected]> | 2014-01-18 22:01:28 -0800 |
---|---|---|
committer | Shevek <[email protected]> | 2014-01-18 22:01:28 -0800 |
commit | 1df1de70b8fc2a85848d2f21ce16851ab7f8f097 (patch) | |
tree | 49dd4f8ebbd6bce8f7c7eda9a5453cea16e04544 /src/test | |
parent | ffbe890c500a0fa57d26f40d1de3a464fe7938a2 (diff) |
Better numeric base handling. Fix typos in error messages.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/anarres/cpp/NumericValueTest.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/test/java/org/anarres/cpp/NumericValueTest.java b/src/test/java/org/anarres/cpp/NumericValueTest.java index f09d10d..7907457 100644 --- a/src/test/java/org/anarres/cpp/NumericValueTest.java +++ b/src/test/java/org/anarres/cpp/NumericValueTest.java @@ -29,10 +29,10 @@ public class NumericValueTest { Token tok = testNumericValue(in); assertEquals(in, tok.getText()); NumericValue value = (NumericValue) tok.getValue(); - assertEquals(out, value.doubleValue(), 0.01d); - assertEquals((float) out, value.floatValue(), 0.01f); - assertEquals((long) out, value.longValue()); - assertEquals((int) out, value.intValue()); + assertEquals("Double mismatch", out, value.doubleValue(), 0.01d); + assertEquals("Float mismatch", (float) out, value.floatValue(), 0.01f); + assertEquals("Long mismatch", (long) out, value.longValue()); + assertEquals("Integer mismatch", (int) out, value.intValue()); } @Test @@ -73,9 +73,18 @@ public class NumericValueTest { testNumericValue("00.0", 0); testNumericValue("00.", 0); + // Sign on exponents testNumericValue("1e1", 1e1); testNumericValue("-1e1", -1e1); testNumericValue("1e-1", 1e-1); + // Based numbers with exponents + // testNumericValue("012e3", 012e3); // Fails + testNumericValue("0x12e3", 0x12e3); + testNumericValue("0x12p3", 0x12p3); + + // Octal prefix with decimal suffix + // testNumericValue("067e8", 067e8); // Fails + } } |