-
-
Notifications
You must be signed in to change notification settings - Fork 546
/
canonical-data.json
343 lines (343 loc) · 11.3 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
{
"exercise": "bowling",
"comments": [
"Students should implement roll and score methods.",
"Roll should accept a single integer.",
"Score should return the game's final score, when possible",
"For brevity the tests display all the previous rolls in an array;",
"each element of the previousRolls array should be passed to the roll method",
"and each of those previous rolls is expected to succeed.",
"",
"Two properties are tested:",
"",
"`score`: All rolls succeed, and taking the score gives the expected result.",
"The expected result may be an integer score or an error.",
"",
"`roll`: All previousRolls succeed, and rolling the number of pins in `roll` produces the expected result.",
"Currently, all cases of this type result in errors.",
"",
"In all error cases you should expect an error as is idiomatic for your language",
"whether that be via exceptions, optional values, or otherwise."
],
"cases": [
{
"uuid": "656ae006-25c2-438c-a549-f338e7ec7441",
"description": "should be able to score a game with all zeros",
"property": "score",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},
"expected": 0
},
{
"uuid": "f85dcc56-cd6b-4875-81b3-e50921e3597b",
"description": "should be able to score a game with no strikes or spares",
"property": "score",
"input": {
"previousRolls": [3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6]
},
"expected": 90
},
{
"uuid": "d1f56305-3ac2-4fe0-8645-0b37e3073e20",
"description": "a spare followed by zeros is worth ten points",
"property": "score",
"input": {
"previousRolls": [6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},
"expected": 10
},
{
"uuid": "0b8c8bb7-764a-4287-801a-f9e9012f8be4",
"description": "points scored in the roll after a spare are counted twice",
"property": "score",
"input": {
"previousRolls": [6, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},
"expected": 16
},
{
"uuid": "4d54d502-1565-4691-84cd-f29a09c65bea",
"description": "consecutive spares each get a one roll bonus",
"property": "score",
"input": {
"previousRolls": [5, 5, 3, 7, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},
"expected": 31
},
{
"uuid": "e5c9cf3d-abbe-4b74-ad48-34051b2b08c0",
"description": "a spare in the last frame gets a one roll bonus that is counted once",
"property": "score",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 7]
},
"expected": 17
},
{
"uuid": "75269642-2b34-4b72-95a4-9be28ab16902",
"description": "a strike earns ten points in a frame with a single roll",
"property": "score",
"input": {
"previousRolls": [10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},
"expected": 10
},
{
"uuid": "037f978c-5d01-4e49-bdeb-9e20a2e6f9a6",
"description": "points scored in the two rolls after a strike are counted twice as a bonus",
"property": "score",
"input": {
"previousRolls": [10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},
"expected": 26
},
{
"uuid": "1635e82b-14ec-4cd1-bce4-4ea14bd13a49",
"description": "consecutive strikes each get the two roll bonus",
"property": "score",
"input": {
"previousRolls": [10, 10, 10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},
"expected": 81
},
{
"uuid": "e483e8b6-cb4b-4959-b310-e3982030d766",
"description": "a strike in the last frame gets a two roll bonus that is counted once",
"property": "score",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 1]
},
"expected": 18
},
{
"uuid": "9d5c87db-84bc-4e01-8e95-53350c8af1f8",
"description": "rolling a spare with the two roll bonus does not get a bonus roll",
"property": "score",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 3]
},
"expected": 20
},
{
"uuid": "576faac1-7cff-4029-ad72-c16bcada79b5",
"description": "strikes with the two roll bonus do not get bonus rolls",
"property": "score",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10]
},
"expected": 30
},
{
"uuid": "efb426ec-7e15-42e6-9b96-b4fca3ec2359",
"description": "last two strikes followed by only last bonus with non strike points",
"property": "score",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 1]
},
"expected": 31
},
{
"uuid": "72e24404-b6c6-46af-b188-875514c0377b",
"description": "a strike with the one roll bonus after a spare in the last frame does not get a bonus",
"property": "score",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 10]
},
"expected": 20
},
{
"uuid": "62ee4c72-8ee8-4250-b794-234f1fec17b1",
"description": "all strikes is a perfect game",
"property": "score",
"input": {
"previousRolls": [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
},
"expected": 300
},
{
"uuid": "1245216b-19c6-422c-b34b-6e4012d7459f",
"description": "rolls cannot score negative points",
"property": "roll",
"input": {
"previousRolls": [],
"roll": -1
},
"expected": {
"error": "Negative roll is invalid"
}
},
{
"uuid": "5fcbd206-782c-4faa-8f3a-be5c538ba841",
"description": "a roll cannot score more than 10 points",
"property": "roll",
"input": {
"previousRolls": [],
"roll": 11
},
"expected": {
"error": "Pin count exceeds pins on the lane"
}
},
{
"uuid": "fb023c31-d842-422d-ad7e-79ce1db23c21",
"description": "two rolls in a frame cannot score more than 10 points",
"property": "roll",
"input": {
"previousRolls": [5],
"roll": 6
},
"expected": {
"error": "Pin count exceeds pins on the lane"
}
},
{
"uuid": "6082d689-d677-4214-80d7-99940189381b",
"description": "bonus roll after a strike in the last frame cannot score more than 10 points",
"property": "roll",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10],
"roll": 11
},
"expected": {
"error": "Pin count exceeds pins on the lane"
}
},
{
"uuid": "e9565fe6-510a-4675-ba6b-733a56767a45",
"description": "two bonus rolls after a strike in the last frame cannot score more than 10 points",
"property": "roll",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5],
"roll": 6
},
"expected": {
"error": "Pin count exceeds pins on the lane"
}
},
{
"uuid": "2f6acf99-448e-4282-8103-0b9c7df99c3d",
"description": "two bonus rolls after a strike in the last frame can score more than 10 points if one is a strike",
"property": "score",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6]
},
"expected": 26
},
{
"uuid": "6380495a-8bc4-4cdb-a59f-5f0212dbed01",
"description": "the second bonus rolls after a strike in the last frame cannot be a strike if the first one is not a strike",
"property": "roll",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6],
"roll": 10
},
"expected": {
"error": "Pin count exceeds pins on the lane"
}
},
{
"uuid": "2b2976ea-446c-47a3-9817-42777f09fe7e",
"description": "second bonus roll after a strike in the last frame cannot score more than 10 points",
"property": "roll",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10],
"roll": 11
},
"expected": {
"error": "Pin count exceeds pins on the lane"
}
},
{
"uuid": "29220245-ac8d-463d-bc19-98a94cfada8a",
"description": "an unstarted game cannot be scored",
"property": "score",
"input": {
"previousRolls": []
},
"expected": {
"error": "Score cannot be taken until the end of the game"
}
},
{
"uuid": "4473dc5d-1f86-486f-bf79-426a52ddc955",
"description": "an incomplete game cannot be scored",
"property": "score",
"input": {
"previousRolls": [0, 0]
},
"expected": {
"error": "Score cannot be taken until the end of the game"
}
},
{
"uuid": "2ccb8980-1b37-4988-b7d1-e5701c317df3",
"description": "cannot roll if game already has ten frames",
"property": "roll",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"roll": 0
},
"expected": {
"error": "Cannot roll after game is over"
}
},
{
"uuid": "4864f09b-9df3-4b65-9924-c595ed236f1b",
"description": "bonus rolls for a strike in the last frame must be rolled before score can be calculated",
"property": "score",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10]
},
"expected": {
"error": "Score cannot be taken until the end of the game"
}
},
{
"uuid": "537f4e37-4b51-4d1c-97e2-986eb37b2ac1",
"description": "both bonus rolls for a strike in the last frame must be rolled before score can be calculated",
"property": "score",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10]
},
"expected": {
"error": "Score cannot be taken until the end of the game"
}
},
{
"uuid": "8134e8c1-4201-4197-bf9f-1431afcde4b9",
"description": "bonus roll for a spare in the last frame must be rolled before score can be calculated",
"property": "score",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3]
},
"expected": {
"error": "Score cannot be taken until the end of the game"
}
},
{
"uuid": "9d4a9a55-134a-4bad-bae8-3babf84bd570",
"description": "cannot roll after bonus roll for spare",
"property": "roll",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 2],
"roll": 2
},
"expected": {
"error": "Cannot roll after game is over"
}
},
{
"uuid": "d3e02652-a799-4ae3-b53b-68582cc604be",
"description": "cannot roll after bonus rolls for strike",
"property": "roll",
"input": {
"previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 3, 2],
"roll": 2
},
"expected": {
"error": "Cannot roll after game is over"
}
}
]
}