diff --git a/tests/invalid/exponent-leading-zero-neg.toml b/tests/invalid/exponent-leading-zero-neg.toml new file mode 100644 index 0000000..3bbadba --- /dev/null +++ b/tests/invalid/exponent-leading-zero-neg.toml @@ -0,0 +1 @@ +leading-zero = 3e-01 diff --git a/tests/invalid/exponent-leading-zero-pos.toml b/tests/invalid/exponent-leading-zero-pos.toml new file mode 100644 index 0000000..ee6e038 --- /dev/null +++ b/tests/invalid/exponent-leading-zero-pos.toml @@ -0,0 +1 @@ +leading-zero = 3e+01 diff --git a/tests/invalid/exponent-leading-zero.toml b/tests/invalid/exponent-leading-zero.toml new file mode 100644 index 0000000..bc9dafe --- /dev/null +++ b/tests/invalid/exponent-leading-zero.toml @@ -0,0 +1 @@ +leading-zero = 3e01 diff --git a/tests/invalid/float-leading-zero-neg.toml b/tests/invalid/float-leading-zero-neg.toml new file mode 100644 index 0000000..dbc16ff --- /dev/null +++ b/tests/invalid/float-leading-zero-neg.toml @@ -0,0 +1 @@ +leading-zero = -03.14 diff --git a/tests/invalid/float-leading-zero-pos.toml b/tests/invalid/float-leading-zero-pos.toml new file mode 100644 index 0000000..6de9634 --- /dev/null +++ b/tests/invalid/float-leading-zero-pos.toml @@ -0,0 +1 @@ +leading-zero = +03.14 diff --git a/tests/invalid/float-leading-zero.toml b/tests/invalid/float-leading-zero.toml new file mode 100644 index 0000000..551fb25 --- /dev/null +++ b/tests/invalid/float-leading-zero.toml @@ -0,0 +1 @@ +leading-zero = 03.14 diff --git a/tests/invalid/float-underscore-after-point.toml b/tests/invalid/float-underscore-after-point.toml new file mode 100644 index 0000000..fe2f2e2 --- /dev/null +++ b/tests/invalid/float-underscore-after-point.toml @@ -0,0 +1 @@ +bad = 1._2 diff --git a/tests/invalid/float-underscore-after.toml b/tests/invalid/float-underscore-after.toml new file mode 100644 index 0000000..33f2bae --- /dev/null +++ b/tests/invalid/float-underscore-after.toml @@ -0,0 +1 @@ +bad = 1.2_ diff --git a/tests/invalid/float-underscore-before-point.toml b/tests/invalid/float-underscore-before-point.toml new file mode 100644 index 0000000..0aa1722 --- /dev/null +++ b/tests/invalid/float-underscore-before-point.toml @@ -0,0 +1 @@ +bad = 1_.2 diff --git a/tests/invalid/float-underscore-before.toml b/tests/invalid/float-underscore-before.toml new file mode 100644 index 0000000..155de0f --- /dev/null +++ b/tests/invalid/float-underscore-before.toml @@ -0,0 +1 @@ +bad = _1.2 diff --git a/tests/invalid/integer-leading-zero-neg.toml b/tests/invalid/integer-leading-zero-neg.toml new file mode 100644 index 0000000..ff6836b --- /dev/null +++ b/tests/invalid/integer-leading-zero-neg.toml @@ -0,0 +1 @@ +leading-zero = -012 diff --git a/tests/invalid/integer-leading-zero-pos.toml b/tests/invalid/integer-leading-zero-pos.toml new file mode 100644 index 0000000..4e63542 --- /dev/null +++ b/tests/invalid/integer-leading-zero-pos.toml @@ -0,0 +1 @@ +leading-zero = +012 diff --git a/tests/invalid/integer-leading-zero.toml b/tests/invalid/integer-leading-zero.toml new file mode 100644 index 0000000..38b1ca4 --- /dev/null +++ b/tests/invalid/integer-leading-zero.toml @@ -0,0 +1 @@ +leading-zero = 012 diff --git a/tests/invalid/integer-underscore-after.toml b/tests/invalid/integer-underscore-after.toml new file mode 100644 index 0000000..b9ec0ee --- /dev/null +++ b/tests/invalid/integer-underscore-after.toml @@ -0,0 +1 @@ +bad = 123_ diff --git a/tests/invalid/integer-underscore-before.toml b/tests/invalid/integer-underscore-before.toml new file mode 100644 index 0000000..1f96c4a --- /dev/null +++ b/tests/invalid/integer-underscore-before.toml @@ -0,0 +1 @@ +bad = _123 diff --git a/tests/invalid/integer-underscore-double.toml b/tests/invalid/integer-underscore-double.toml new file mode 100644 index 0000000..490adb3 --- /dev/null +++ b/tests/invalid/integer-underscore-double.toml @@ -0,0 +1 @@ +bad = 1__23 diff --git a/tests/valid/float-exponent.json b/tests/valid/float-exponent.json new file mode 100644 index 0000000..b0d40bd --- /dev/null +++ b/tests/valid/float-exponent.json @@ -0,0 +1,9 @@ +{ + "lower": {"type": "float", "value": "300.0"}, + "upper": {"type": "float", "value": "300.0"}, + "neg": {"type": "float", "value": "0.03"}, + "pos": {"type": "float", "value": "300.0"}, + "zero": {"type": "float", "value": "3.0"}, + "pointlower": {"type": "float", "value": "310.0"}, + "pointupper": {"type": "float", "value": "310.0"} +} diff --git a/tests/valid/float-exponent.toml b/tests/valid/float-exponent.toml new file mode 100644 index 0000000..d0db16f --- /dev/null +++ b/tests/valid/float-exponent.toml @@ -0,0 +1,7 @@ +lower = 3e2 +upper = 3E2 +neg = 3e-2 +pos = 3E+2 +zero = 3e0 +pointlower = 3.1e2 +pointupper = 3.1E2 diff --git a/tests/valid/float-underscore.json b/tests/valid/float-underscore.json new file mode 100644 index 0000000..f86cdd7 --- /dev/null +++ b/tests/valid/float-underscore.json @@ -0,0 +1,5 @@ +{ + "before": {"type": "float", "value": "3141.5927"}, + "after": {"type": "float", "value": "3141.5927"}, + "exponent": {"type": "float", "value": "3e14"} +} diff --git a/tests/valid/float-underscore.toml b/tests/valid/float-underscore.toml new file mode 100644 index 0000000..343353a --- /dev/null +++ b/tests/valid/float-underscore.toml @@ -0,0 +1,3 @@ +before = 3_141.5927 +after = 3141.592_7 +exponent = 3e1_4 diff --git a/tests/valid/float.json b/tests/valid/float.json index b8a2e97..3f69b17 100644 --- a/tests/valid/float.json +++ b/tests/valid/float.json @@ -1,4 +1,6 @@ { "pi": {"type": "float", "value": "3.14"}, - "negpi": {"type": "float", "value": "-3.14"} + "pospi": {"type": "float", "value": "3.14"}, + "negpi": {"type": "float", "value": "-3.14"}, + "zero-intpart": {"type": "float", "value": "0.123"} } diff --git a/tests/valid/float.toml b/tests/valid/float.toml index 7c528d2..5f02322 100644 --- a/tests/valid/float.toml +++ b/tests/valid/float.toml @@ -1,2 +1,4 @@ pi = 3.14 +pospi = +3.14 negpi = -3.14 +zero-intpart = 0.123 diff --git a/tests/valid/integer-underscore.json b/tests/valid/integer-underscore.json new file mode 100644 index 0000000..bb6c3e7 --- /dev/null +++ b/tests/valid/integer-underscore.json @@ -0,0 +1,3 @@ +{ + "kilo": {"type": "integer", "value": "1000"} +} diff --git a/tests/valid/integer-underscore.toml b/tests/valid/integer-underscore.toml new file mode 100644 index 0000000..45eb4f7 --- /dev/null +++ b/tests/valid/integer-underscore.toml @@ -0,0 +1 @@ +kilo = 1_000 diff --git a/tests/valid/integer.json b/tests/valid/integer.json index 61985a1..ef3998a 100644 --- a/tests/valid/integer.json +++ b/tests/valid/integer.json @@ -1,4 +1,6 @@ { "answer": {"type": "integer", "value": "42"}, - "neganswer": {"type": "integer", "value": "-42"} + "posanswer": {"type": "integer", "value": "42"}, + "neganswer": {"type": "integer", "value": "-42"}, + "zero": {"type": "integer", "value": "0"} } diff --git a/tests/valid/integer.toml b/tests/valid/integer.toml index c4f6297..b62de30 100644 --- a/tests/valid/integer.toml +++ b/tests/valid/integer.toml @@ -1,2 +1,4 @@ answer = 42 +posanswer = +42 neganswer = -42 +zero = 0