Skip to content

Commit 4e18617

Browse files
authored
More complex satellite tests (#2612)
* More complex satellite tests * with uuids * formatting
1 parent 5ef8b04 commit 4e18617

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

exercises/satellite/canonical-data.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,80 @@
7474
"expected": {
7575
"error": "traversals must contain unique items"
7676
}
77+
},
78+
{
79+
"uuid": "af31ae02-7e5b-4452-a990-bccb3fca9148",
80+
"description": "A degenerate binary tree",
81+
"property": "treeFromTraversals",
82+
"input": {
83+
"preorder": ["a", "b", "c", "d"],
84+
"inorder": ["d", "c", "b", "a"]
85+
},
86+
"expected": {
87+
"v": "a",
88+
"l": {
89+
"v": "b",
90+
"l": {
91+
"v": "c",
92+
"l": { "v": "d", "l": {}, "r": {} },
93+
"r": {}
94+
},
95+
"r": {}
96+
},
97+
"r": {}
98+
}
99+
},
100+
{
101+
"uuid": "ee54463d-a719-4aae-ade4-190d30ce7320",
102+
"description": "Another degenerate binary tree",
103+
"property": "treeFromTraversals",
104+
"input": {
105+
"preorder": ["a", "b", "c", "d"],
106+
"inorder": ["a", "b", "c", "d"]
107+
},
108+
"expected": {
109+
"v": "a",
110+
"l": {},
111+
"r": {
112+
"v": "b",
113+
"l": {},
114+
"r": {
115+
"v": "c",
116+
"l": {},
117+
"r": { "v": "d", "l": {}, "r": {} }
118+
}
119+
}
120+
}
121+
},
122+
{
123+
"uuid": "87123c08-c155-4486-90a4-e2f75b0f3e8f",
124+
"description": "Tree with many more items",
125+
"property": "treeFromTraversals",
126+
"input": {
127+
"preorder": ["a", "b", "d", "g", "h", "c", "e", "f", "i"],
128+
"inorder": ["g", "d", "h", "b", "a", "e", "c", "i", "f"]
129+
},
130+
"expected": {
131+
"v": "a",
132+
"l": {
133+
"v": "b",
134+
"l": {
135+
"v": "d",
136+
"l": { "v": "g", "l": {}, "r": {} },
137+
"r": { "v": "h", "l": {}, "r": {} }
138+
},
139+
"r": {}
140+
},
141+
"r": {
142+
"v": "c",
143+
"l": { "v": "e", "l": {}, "r": {} },
144+
"r": {
145+
"v": "f",
146+
"l": { "v": "i", "l": {}, "r": {} },
147+
"r": {}
148+
}
149+
}
150+
}
77151
}
78152
]
79153
}

0 commit comments

Comments
 (0)