Skip to content

Commit 49c2460

Browse files
authored
sgf-parsing: add canonical-data.json (#1269)
Resolves #585
1 parent d5238bd commit 49c2460

File tree

1 file changed

+161
-0
lines changed

1 file changed

+161
-0
lines changed
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
{
2+
"exercise": "sgf-parsing",
3+
"version": "1.0.0",
4+
"cases": [
5+
{
6+
"description": "empty input",
7+
"property": "parse",
8+
"input": {
9+
"encoded": ""
10+
},
11+
"expected": {
12+
"error": "tree missing"
13+
}
14+
},
15+
{
16+
"description": "tree with no nodes",
17+
"property": "parse",
18+
"input": {
19+
"encoded": "()"
20+
},
21+
"expected": {
22+
"error": "tree with no nodes"
23+
}
24+
},
25+
{
26+
"description": "node without tree",
27+
"property": "parse",
28+
"input": {
29+
"encoded": ";"
30+
},
31+
"expected": {
32+
"error": "tree missing"
33+
}
34+
},
35+
{
36+
"description": "node without properties",
37+
"property": "parse",
38+
"input": {
39+
"encoded": "(;)"
40+
},
41+
"expected": {
42+
"properties": {}
43+
}
44+
},
45+
{
46+
"description": "single node tree",
47+
"property": "parse",
48+
"input": {
49+
"encoded": "(;A[B])"
50+
},
51+
"expected": {
52+
"properties": {
53+
"A": ["B"]
54+
},
55+
"children": []
56+
}
57+
},
58+
{
59+
"description": "properties without delimiter",
60+
"property": "parse",
61+
"input": {
62+
"encoded": "(;A)"
63+
},
64+
"expected": {
65+
"error": "properties without delimiter"
66+
}
67+
},
68+
{
69+
"description": "all lowercase property",
70+
"property": "parse",
71+
"input": {
72+
"encoded": "(;a[b])"
73+
},
74+
"expected": {
75+
"error": "property must be in uppercase"
76+
}
77+
},
78+
{
79+
"description": "upper and lowercase property",
80+
"property": "parse",
81+
"input": {
82+
"encoded": "(;Aa[b])"
83+
},
84+
"expected": {
85+
"error": "property must be in uppercase"
86+
}
87+
},
88+
{
89+
"description": "two nodes",
90+
"property": "parse",
91+
"input": {
92+
"encoded": "(;A[B];B[C])"
93+
},
94+
"expected": {
95+
"properties": {
96+
"A": ["B"]
97+
},
98+
"children": [
99+
{
100+
"properties": {
101+
"B": ["C"]
102+
},
103+
"children": []
104+
}
105+
]
106+
}
107+
},
108+
{
109+
"description": "two child trees",
110+
"property": "parse",
111+
"input": {
112+
"encoded": "(;A[B](;B[C])(;C[D]))"
113+
},
114+
"expected": {
115+
"properties": {
116+
"A": ["B"]
117+
},
118+
"children": [
119+
{
120+
"properties": {
121+
"B": ["C"]
122+
},
123+
"children": []
124+
},
125+
{
126+
"properties": {
127+
"C": ["D"]
128+
},
129+
"children": []
130+
}
131+
]
132+
}
133+
},
134+
{
135+
"description": "multiple property values",
136+
"property": "parse",
137+
"input": {
138+
"encoded": "(;A[b][c][d])"
139+
},
140+
"expected": {
141+
"properties": {
142+
"A": ["b", "c", "d"]
143+
},
144+
"children": []
145+
}
146+
},
147+
{
148+
"description": "escaped property",
149+
"property": "parse",
150+
"input": {
151+
"encoded": "(;A[\\]b\\nc\\nd\\t\\te \\n\\]])"
152+
},
153+
"expected": {
154+
"properties": {
155+
"A": ["]b\\nc\\nd e \\n]"]
156+
},
157+
"children": []
158+
}
159+
}
160+
]
161+
}

0 commit comments

Comments
 (0)