Skip to content

Commit 08f6cda

Browse files
Merge pull request #400 from json-schema-org/ether/more-format-ipv6
some more tests for the "ipv6" format
2 parents 1f34d33 + d3064eb commit 08f6cda

File tree

5 files changed

+200
-0
lines changed

5 files changed

+200
-0
lines changed

tests/draft2019-09/optional/format/ipv6.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,46 @@
2222
"description": "an IPv6 address containing illegal characters",
2323
"data": "::laptop",
2424
"valid": false
25+
},
26+
{
27+
"description": "no digits is valid",
28+
"data": "::",
29+
"valid": true
30+
},
31+
{
32+
"description": "leading colons is valid",
33+
"data": "::42:ff:1",
34+
"valid": true
35+
},
36+
{
37+
"description": "trailing colons is valid",
38+
"data": "d6::",
39+
"valid": true
40+
},
41+
{
42+
"description": "two sets of double colons is invalid",
43+
"data": "1::d6::42",
44+
"valid": false
45+
},
46+
{
47+
"description": "mixed format with the ipv4 section as decimal octets",
48+
"data": "1::d6:192.168.0.1",
49+
"valid": true
50+
},
51+
{
52+
"description": "mixed format with double colons between the sections",
53+
"data": "1:2::192.168.0.1",
54+
"valid": true
55+
},
56+
{
57+
"description": "mixed format with ipv4 section with octet out of range",
58+
"data": "1::2:192.168.256.1",
59+
"valid": false
60+
},
61+
{
62+
"description": "mixed format with ipv4 section with a hex octet",
63+
"data": "1::2:192.168.ff.1",
64+
"valid": false
2565
}
2666
]
2767
}

tests/draft3/optional/format/ipv6.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,46 @@
2222
"description": "an IPv6 address containing illegal characters",
2323
"data": "::laptop",
2424
"valid": false
25+
},
26+
{
27+
"description": "no digits is valid",
28+
"data": "::",
29+
"valid": true
30+
},
31+
{
32+
"description": "leading colons is valid",
33+
"data": "::1",
34+
"valid": true
35+
},
36+
{
37+
"description": "trailing colons is valid",
38+
"data": "d6::",
39+
"valid": true
40+
},
41+
{
42+
"description": "two sets of double colons is invalid",
43+
"data": "1::d6::42",
44+
"valid": false
45+
},
46+
{
47+
"description": "mixed format with the ipv4 section as decimal octets",
48+
"data": "1::d6:192.168.0.1",
49+
"valid": true
50+
},
51+
{
52+
"description": "mixed format with double colons between the sections",
53+
"data": "1:2::192.168.0.1",
54+
"valid": true
55+
},
56+
{
57+
"description": "mixed format with ipv4 section with octet out of range",
58+
"data": "1::2:192.168.256.1",
59+
"valid": false
60+
},
61+
{
62+
"description": "mixed format with ipv4 section with a hex octet",
63+
"data": "1::2:192.168.ff.1",
64+
"valid": false
2565
}
2666
]
2767
}

tests/draft4/optional/format/ipv6.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,46 @@
2222
"description": "an IPv6 address containing illegal characters",
2323
"data": "::laptop",
2424
"valid": false
25+
},
26+
{
27+
"description": "no digits is valid",
28+
"data": "::",
29+
"valid": true
30+
},
31+
{
32+
"description": "leading colons is valid",
33+
"data": "::1",
34+
"valid": true
35+
},
36+
{
37+
"description": "trailing colons is valid",
38+
"data": "d6::",
39+
"valid": true
40+
},
41+
{
42+
"description": "two sets of double colons is invalid",
43+
"data": "1::d6::42",
44+
"valid": false
45+
},
46+
{
47+
"description": "mixed format with the ipv4 section as decimal octets",
48+
"data": "1::d6:192.168.0.1",
49+
"valid": true
50+
},
51+
{
52+
"description": "mixed format with double colons between the sections",
53+
"data": "1:2::192.168.0.1",
54+
"valid": true
55+
},
56+
{
57+
"description": "mixed format with ipv4 section with octet out of range",
58+
"data": "1::2:192.168.256.1",
59+
"valid": false
60+
},
61+
{
62+
"description": "mixed format with ipv4 section with a hex octet",
63+
"data": "1::2:192.168.ff.1",
64+
"valid": false
2565
}
2666
]
2767
}

tests/draft6/optional/format/ipv6.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,46 @@
2222
"description": "an IPv6 address containing illegal characters",
2323
"data": "::laptop",
2424
"valid": false
25+
},
26+
{
27+
"description": "no digits is valid",
28+
"data": "::",
29+
"valid": true
30+
},
31+
{
32+
"description": "leading colons is valid",
33+
"data": "::1",
34+
"valid": true
35+
},
36+
{
37+
"description": "trailing colons is valid",
38+
"data": "d6::",
39+
"valid": true
40+
},
41+
{
42+
"description": "two sets of double colons is invalid",
43+
"data": "1::d6::42",
44+
"valid": false
45+
},
46+
{
47+
"description": "mixed format with the ipv4 section as decimal octets",
48+
"data": "1::d6:192.168.0.1",
49+
"valid": true
50+
},
51+
{
52+
"description": "mixed format with double colons between the sections",
53+
"data": "1:2::192.168.0.1",
54+
"valid": true
55+
},
56+
{
57+
"description": "mixed format with ipv4 section with octet out of range",
58+
"data": "1::2:192.168.256.1",
59+
"valid": false
60+
},
61+
{
62+
"description": "mixed format with ipv4 section with a hex octet",
63+
"data": "1::2:192.168.ff.1",
64+
"valid": false
2565
}
2666
]
2767
}

tests/draft7/optional/format/ipv6.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,46 @@
2222
"description": "an IPv6 address containing illegal characters",
2323
"data": "::laptop",
2424
"valid": false
25+
},
26+
{
27+
"description": "no digits is valid",
28+
"data": "::",
29+
"valid": true
30+
},
31+
{
32+
"description": "leading colons is valid",
33+
"data": "::1",
34+
"valid": true
35+
},
36+
{
37+
"description": "trailing colons is valid",
38+
"data": "d6::",
39+
"valid": true
40+
},
41+
{
42+
"description": "two sets of double colons is invalid",
43+
"data": "1::d6::42",
44+
"valid": false
45+
},
46+
{
47+
"description": "mixed format with the ipv4 section as decimal octets",
48+
"data": "1::d6:192.168.0.1",
49+
"valid": true
50+
},
51+
{
52+
"description": "mixed format with double colons between the sections",
53+
"data": "1:2::192.168.0.1",
54+
"valid": true
55+
},
56+
{
57+
"description": "mixed format with ipv4 section with octet out of range",
58+
"data": "1::2:192.168.256.1",
59+
"valid": false
60+
},
61+
{
62+
"description": "mixed format with ipv4 section with a hex octet",
63+
"data": "1::2:192.168.ff.1",
64+
"valid": false
2565
}
2666
]
2767
}

0 commit comments

Comments
 (0)