summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--site/spec.html16
-rw-r--r--tests/interpretation/README.md11
-rw-r--r--tests/interpretation/int.pom47
-rw-r--r--tests/interpretation/uint.pom38
4 files changed, 108 insertions, 4 deletions
diff --git a/site/spec.html b/site/spec.html
index 7dcc957..f3178fd 100644
--- a/site/spec.html
+++ b/site/spec.html
@@ -471,18 +471,26 @@ and for my.nephews.car.id is String (no schema key matches, so the default of St
<li><code>None</code> — accepts an unset value (special—see below)</li>
<li><code>Empty</code> — accepts an empty value</li>
<li><code>Bool</code> — accepts <code>true</code>, <code>on</code>, <code>yes</code>,
- <code>false</code>, <code>off</code>, <code>no</code> (case-sensitive).</li>
- <li><code>UInt</code> — accepts any unsigned integer that fits in 63 [sic] bits,
- written in decimal or <code>0x</code> or <code>0X</code>-prefixed hexadecimal.
+ <code>false</code>, <code>off</code>, <code>no</code> (case- and white space- sensitive).</li>
+ <li><code>UInt</code> — accepts any unsigned integer strictly less than 2<sup>63</sup>,
+ written in decimal or <code>0x</code> or <code>0X</code>-prefixed hexadecimal.
A leading <code>+</code> is permitted, but <code>-0</code> is not.
+ Leading zeroes are not permitted for decimal integers.
+ White space around the integer is not permitted.
Only 63 bits are allowed to support languages (Java) with no 64-bit unsigned integers.</li>
- <li><code>Int</code> — accepts any (two’s complement) signed integer that fits in 64 bits,
+ <li><code>Int</code> — accepts any (two’s complement) signed integer whose absolute value
+ is strictly less than 2<sup>63</sup>
+ (NB: <code>INT64_MIN</code>/−2<sup>63</sup> is not allowed),
written in decimal or <code>0x</code> or <code>0X</code>-prefixed hexadecimal.
+ Leading zeroes are not permitted for decimal integers.
+ White space around the integer is not permitted.
A leading <code>+</code> (or, of course, <code>-</code>) is permitted.</li>
<li><code>Float</code> —
A floating-point number, written in ordinary decimal
(e.g. <code>-1.234</code>, <code>7.</code>, <code>265</code>) or in scientific notation
(e.g. <code>3e5</code>, <code>3.E-5</code>, <code>-3.7e+5</code>).
+ Excessive leading zeroes are not permitted (<code>0.0</code> is allowed, but not <code>00.0</code>).
+ White space around the number is not permitted.
A leading <code>+</code> (or, of course, <code>-</code>) is permitted.
<li>
<code>'</code><i>value</i><code>'</code> —
diff --git a/tests/interpretation/README.md b/tests/interpretation/README.md
index ad18e09..b263e05 100644
--- a/tests/interpretation/README.md
+++ b/tests/interpretation/README.md
@@ -1,3 +1,14 @@
# Interpretation tests
These tests check that booleans, numbers, floats, and lists are interpreted correctly.
+
+`int.pom`, `uint.pom`, `float.pom`, `boolean.pom` — These files contain two sections,
+`[good]` and `[bad]`. The keys in `good` are in pairs `k.a` and `k.b`. Their values must
+parse to the same int/uint/float/boolean as each other.
+The values in `bad` are all invalid int/uint/float/booleans, and parsing them should
+return an error.
+
+`list.pom` — The keys in this file are in pairs `k.list` and `k.sep`.
+`k.list` is a POM list, and `k.sep` is the concatenation of `x;` for each entry
+`x` in the list (none of the entries have `;` in them, so this representation is
+unambiguous).
diff --git a/tests/interpretation/int.pom b/tests/interpretation/int.pom
new file mode 100644
index 0000000..7158dc2
--- /dev/null
+++ b/tests/interpretation/int.pom
@@ -0,0 +1,47 @@
+[good]
+
+three.a = 3
+three.b = 0x3
+
+quote_three.a = "3"
+quote_three.b = `3`
+
+plus_three.a = +3
+plus_three.b = +0x3
+
+negative_three.a = -3
+negative_three.b = -0x3
+
+zero.a = 0
+zero.b = 0x0000000000000000000000000000
+
+sign_zero.a = +0
+sign_zero.b = -0
+
+hex.a = 0x0123fF
+hex.b = 74751
+
+negative_hex.a = -0Xfade
+negative_hex.b = -64222
+
+largest.a = 9223372036854775807
+largest.b = 0x7fffffffffffffff
+
+smallest.a = -9223372036854775807
+smallest.b = -0x7fffffffffffffff
+
+[bad]
+space_three = " 3"
+leading_zero = 03
+negative_leading_zero = -03
+trailing_dec = 35a
+trailing_hex = 0x35g
+decimal = 3.0
+multi_sign = -+3
+multi_sign2 = +-3
+multi_sign3 = ++3
+multi_sign4 = --3
+too_large = 9223372036854775808
+too_large_hex = 0x8000000000000000
+too_small = -9223372036854775808
+too_small_hex = -0x8000000000000000
diff --git a/tests/interpretation/uint.pom b/tests/interpretation/uint.pom
new file mode 100644
index 0000000..be15211
--- /dev/null
+++ b/tests/interpretation/uint.pom
@@ -0,0 +1,38 @@
+[good]
+
+three.a = 3
+three.b = 0x3
+
+quote_three.a = "3"
+quote_three.b = `3`
+
+plus_three.a = +3
+plus_three.b = +0x3
+
+zero.a = 0
+zero.b = 0x0000000000000000000000000000
+
+sign_zero.a = +0
+sign_zero.b = 0
+
+hex.a = 0x0123fF
+hex.b = 74751
+
+hex2.a = 0Xfade
+hex2.b = 64222
+
+largest.a = 9223372036854775807
+largest.b = 0x7fffffffffffffff
+
+[bad]
+space_three = " 3"
+leading_zero = 03
+negative = -3
+negative_hex = -0x3
+trailing_dec = 35a
+trailing_hex = 0x35g
+decimal = 3.0
+multi_sign = ++3
+too_large = 9223372036854775808
+too_large_hex = 0x8000000000000000
+negative_zero = -0