Skip to content

Commit f99e02f

Browse files
authored
Better exercise arbitrary precision capabilities of XML Schema schemas (#59)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent 3ee85ee commit f99e02f

17 files changed

+372
-0
lines changed

test/w3c/xmlschema/2001/decimal.test.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,41 @@
7777
"data": 1e-06,
7878
"valid": true
7979
},
80+
{
81+
"description": "Valid - arbitrary precision 18 digits integer",
82+
"data": 123456789012345678,
83+
"valid": true
84+
},
85+
{
86+
"description": "Valid - arbitrary precision 19 digits integer",
87+
"data": 1234567890123456789,
88+
"valid": true
89+
},
90+
{
91+
"description": "Valid - arbitrary precision 20 digits integer",
92+
"data": 12345678901234567890,
93+
"valid": true
94+
},
95+
{
96+
"description": "Valid - arbitrary precision large negative",
97+
"data": -12345678901234567890,
98+
"valid": true
99+
},
100+
{
101+
"description": "Valid - arbitrary precision 25 digits",
102+
"data": 1234567890123456789012345,
103+
"valid": true
104+
},
105+
{
106+
"description": "Valid - arbitrary precision with decimals",
107+
"data": 123456789012345680.0,
108+
"valid": true
109+
},
110+
{
111+
"description": "Valid - arbitrary precision negative with decimals",
112+
"data": -123456789012345680.0,
113+
"valid": true
114+
},
80115
{
81116
"description": "Invalid - string type",
82117
"data": "123.45",

test/w3c/xmlschema/2001/integer.test.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,36 @@
4747
"data": -1000000,
4848
"valid": true
4949
},
50+
{
51+
"description": "Valid - arbitrary precision beyond int64",
52+
"data": 12345678901234567890,
53+
"valid": true
54+
},
55+
{
56+
"description": "Valid - arbitrary precision large positive",
57+
"data": 99999999999999999999,
58+
"valid": true
59+
},
60+
{
61+
"description": "Valid - arbitrary precision large negative",
62+
"data": -99999999999999999999,
63+
"valid": true
64+
},
65+
{
66+
"description": "Valid - arbitrary precision 25 digits positive",
67+
"data": 1234567890123456789012345,
68+
"valid": true
69+
},
70+
{
71+
"description": "Valid - arbitrary precision 25 digits negative",
72+
"data": -1234567890123456789012345,
73+
"valid": true
74+
},
75+
{
76+
"description": "Valid - arbitrary precision 30 digits",
77+
"data": 123456789012345678901234567890,
78+
"valid": true
79+
},
5080
{
5181
"description": "Invalid - decimal number",
5282
"data": 123.45,

test/w3c/xmlschema/2001/negative-integer.test.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,26 @@
2727
"data": -1000,
2828
"valid": true
2929
},
30+
{
31+
"description": "Valid - arbitrary precision beyond int64",
32+
"data": -12345678901234567890,
33+
"valid": true
34+
},
35+
{
36+
"description": "Valid - arbitrary precision large negative",
37+
"data": -99999999999999999999,
38+
"valid": true
39+
},
40+
{
41+
"description": "Valid - arbitrary precision 25 digits negative",
42+
"data": -1234567890123456789012345,
43+
"valid": true
44+
},
45+
{
46+
"description": "Valid - arbitrary precision 30 digits negative",
47+
"data": -123456789012345678901234567890,
48+
"valid": true
49+
},
3050
{
3151
"description": "Invalid - zero",
3252
"data": 0,

test/w3c/xmlschema/2001/non-negative-integer.test.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,26 @@
2727
"data": 1000,
2828
"valid": true
2929
},
30+
{
31+
"description": "Valid - arbitrary precision beyond uint64",
32+
"data": 18446744073709551616,
33+
"valid": true
34+
},
35+
{
36+
"description": "Valid - arbitrary precision large positive",
37+
"data": 99999999999999999999,
38+
"valid": true
39+
},
40+
{
41+
"description": "Valid - arbitrary precision 25 digits",
42+
"data": 1234567890123456789012345,
43+
"valid": true
44+
},
45+
{
46+
"description": "Valid - arbitrary precision 30 digits",
47+
"data": 123456789012345678901234567890,
48+
"valid": true
49+
},
3050
{
3151
"description": "Invalid - negative one",
3252
"data": -1,

test/w3c/xmlschema/2001/non-positive-integer.test.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,26 @@
2727
"data": -1000,
2828
"valid": true
2929
},
30+
{
31+
"description": "Valid - arbitrary precision beyond int64",
32+
"data": -12345678901234567890,
33+
"valid": true
34+
},
35+
{
36+
"description": "Valid - arbitrary precision large negative",
37+
"data": -99999999999999999999,
38+
"valid": true
39+
},
40+
{
41+
"description": "Valid - arbitrary precision 25 digits negative",
42+
"data": -1234567890123456789012345,
43+
"valid": true
44+
},
45+
{
46+
"description": "Valid - arbitrary precision 30 digits negative",
47+
"data": -123456789012345678901234567890,
48+
"valid": true
49+
},
3050
{
3151
"description": "Invalid - positive one",
3252
"data": 1,

test/w3c/xmlschema/2001/positive-integer.test.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,26 @@
2727
"data": 1000,
2828
"valid": true
2929
},
30+
{
31+
"description": "Valid - arbitrary precision beyond uint64",
32+
"data": 18446744073709551616,
33+
"valid": true
34+
},
35+
{
36+
"description": "Valid - arbitrary precision large positive",
37+
"data": 99999999999999999999,
38+
"valid": true
39+
},
40+
{
41+
"description": "Valid - arbitrary precision 25 digits",
42+
"data": 1234567890123456789012345,
43+
"valid": true
44+
},
45+
{
46+
"description": "Valid - arbitrary precision 30 digits",
47+
"data": 123456789012345678901234567890,
48+
"valid": true
49+
},
3050
{
3151
"description": "Invalid - zero",
3252
"data": 0,

test/w3c/xmlschema/2001/unsigned-long.test.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,36 @@
3232
"data": 123456789012345,
3333
"valid": true
3434
},
35+
{
36+
"description": "Valid - uint64 maximum",
37+
"data": 18446744073709551615,
38+
"valid": true
39+
},
40+
{
41+
"description": "Valid - just above int64 max",
42+
"data": 9223372036854775808,
43+
"valid": true
44+
},
45+
{
46+
"description": "Valid - near uint64 maximum",
47+
"data": 18446744073709551614,
48+
"valid": true
49+
},
50+
{
51+
"description": "Valid - large mid-range value",
52+
"data": 10000000000000000000,
53+
"valid": true
54+
},
55+
{
56+
"description": "Invalid - above uint64 maximum",
57+
"data": 18446744073709551616,
58+
"valid": false
59+
},
60+
{
61+
"description": "Invalid - large above maximum",
62+
"data": 20000000000000000000,
63+
"valid": false
64+
},
3565
{
3666
"description": "Invalid - negative one",
3767
"data": -1,

test/xbrl/instance/2003/decimal-item-type.test.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,26 @@
2222
"data": 3.14159,
2323
"valid": true
2424
},
25+
{
26+
"description": "Valid - arbitrary precision 20 digit integer",
27+
"data": 12345678901234567890,
28+
"valid": true
29+
},
30+
{
31+
"description": "Valid - arbitrary precision 25 digits",
32+
"data": 1234567890123456789012345,
33+
"valid": true
34+
},
35+
{
36+
"description": "Valid - arbitrary precision with decimals",
37+
"data": 123456789012345680.0,
38+
"valid": true
39+
},
40+
{
41+
"description": "Valid - arbitrary precision negative",
42+
"data": -12345678901234567890,
43+
"valid": true
44+
},
2545
{
2646
"description": "Invalid - string type",
2747
"data": "123.45",

test/xbrl/instance/2003/fraction-item-type.test.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,36 @@
6262
"data": [ 100, -0.001 ],
6363
"valid": true
6464
},
65+
{
66+
"description": "Valid - arbitrary precision numerator 20 digits",
67+
"data": [ 12345678901234567890, 1 ],
68+
"valid": true
69+
},
70+
{
71+
"description": "Valid - arbitrary precision denominator 20 digits",
72+
"data": [ 1, 12345678901234567890 ],
73+
"valid": true
74+
},
75+
{
76+
"description": "Valid - arbitrary precision both values 25 digits",
77+
"data": [ 1234567890123456789012345, 9876543210987654321098765 ],
78+
"valid": true
79+
},
80+
{
81+
"description": "Valid - arbitrary precision numerator with decimals",
82+
"data": [ 123456789012345680.0, 1 ],
83+
"valid": true
84+
},
85+
{
86+
"description": "Valid - arbitrary precision denominator with decimals",
87+
"data": [ 1, 123456789012345680.0 ],
88+
"valid": true
89+
},
90+
{
91+
"description": "Valid - arbitrary precision negative numerator",
92+
"data": [ -12345678901234567890, 1 ],
93+
"valid": true
94+
},
6595
{
6696
"description": "Invalid - zero denominator",
6797
"data": [ 1, 0 ],

test/xbrl/instance/2003/integer-item-type.test.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,31 @@
2222
"data": 999999999999999,
2323
"valid": true
2424
},
25+
{
26+
"description": "Valid - arbitrary precision beyond int64",
27+
"data": 12345678901234567890,
28+
"valid": true
29+
},
30+
{
31+
"description": "Valid - arbitrary precision large positive",
32+
"data": 99999999999999999999,
33+
"valid": true
34+
},
35+
{
36+
"description": "Valid - arbitrary precision large negative",
37+
"data": -99999999999999999999,
38+
"valid": true
39+
},
40+
{
41+
"description": "Valid - arbitrary precision 25 digits positive",
42+
"data": 1234567890123456789012345,
43+
"valid": true
44+
},
45+
{
46+
"description": "Valid - arbitrary precision 25 digits negative",
47+
"data": -1234567890123456789012345,
48+
"valid": true
49+
},
2550
{
2651
"description": "Invalid - decimal value",
2752
"data": 123.45,

0 commit comments

Comments
 (0)