-
-
Notifications
You must be signed in to change notification settings - Fork 546
/
canonical-data.json
79 lines (79 loc) · 2.07 KB
/
canonical-data.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
"exercise": "satellite",
"cases": [
{
"uuid": "8df3fa26-811a-4165-9286-ff9ac0850d19",
"description": "Empty tree",
"property": "treeFromTraversals",
"input": {
"preorder": [],
"inorder": []
},
"expected": {}
},
{
"uuid": "f945ccfc-05e3-47d7-825b-0270559d43ad",
"description": "Tree with one item",
"property": "treeFromTraversals",
"input": {
"preorder": ["a"],
"inorder": ["a"]
},
"expected": { "v": "a", "l": {}, "r": {} }
},
{
"uuid": "a0121d5f-37b0-48dd-9c64-cba4c4464135",
"description": "Tree with many items",
"property": "treeFromTraversals",
"input": {
"preorder": ["a", "i", "x", "f", "r"],
"inorder": ["i", "a", "f", "x", "r"]
},
"expected": {
"v": "a",
"l": { "v": "i", "l": {}, "r": {} },
"r": {
"v": "x",
"l": { "v": "f", "l": {}, "r": {} },
"r": { "v": "r", "l": {}, "r": {} }
}
}
},
{
"uuid": "6074041f-4891-4d81-a128-401050c2a3b0",
"description": "Reject traversals of different length",
"property": "treeFromTraversals",
"input": {
"preorder": ["a", "b"],
"inorder": ["b", "a", "r"]
},
"expected": {
"error": "traversals must have the same length"
}
},
{
"uuid": "27916ce4-45f3-4d8b-8528-496fedc157ca",
"description": "Reject inconsistent traversals of same length",
"property": "treeFromTraversals",
"input": {
"preorder": ["x", "y", "z"],
"inorder": ["a", "b", "c"]
},
"expected": {
"error": "traversals must have the same elements"
}
},
{
"uuid": "d86a3d72-76a9-43b5-9d3a-e64cb1216035",
"description": "Reject traversals with repeated items",
"property": "treeFromTraversals",
"input": {
"preorder": ["a", "b", "a"],
"inorder": ["b", "a", "a"]
},
"expected": {
"error": "traversals must contain unique items"
}
}
]
}