-
-
Notifications
You must be signed in to change notification settings - Fork 549
/
Copy pathcanonical-data.json
636 lines (636 loc) · 15.5 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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
{
"exercise": "linked-list",
"comments": [
"In order to keep the interface for the exercise close or equal to the ",
"description.md and also satisfying the canonical-data schema, the only ",
"properties are pop, push, shift, unshift. Some tracks also implement ",
"delete and count, via Track-Inserted hints. ",
" ",
"It is hard to have interesting tests using the property based approach so",
"this canonical data uses the following approach: ",
"- Each test input is an array of { operation, value?, expected? } ",
"- If operation is push, unshift, delete, then value is given ",
"- If operation is pop, shift, count, the expected value can be given ",
" ",
"Encoding tests and operations using the same field is necessary to have ",
"tests that don't just initialize the list, and then have one operation. "
],
"cases": [
{
"uuid": "7f7e3987-b954-41b8-8084-99beca08752c",
"description": "pop gets element from the list",
"comments": [
"This test does not confirm that pop gets the last element from the ",
"list. The next test (push/pop respectively add/remove at the end of ",
"the list) does check that behaviour. This test provides a stepping ",
"stone."
],
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 7
},
{
"operation": "pop",
"expected": 7
}
]
},
"expected": {}
},
{
"uuid": "c3f67e5d-cfa2-4c3e-a18f-7ce999c3c885",
"description": "push/pop respectively add/remove at the end of the list",
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 11
},
{
"operation": "push",
"value": 13
},
{
"operation": "pop",
"expected": 13
},
{
"operation": "pop",
"expected": 11
}
]
},
"expected": {}
},
{
"uuid": "00ea24ce-4f5c-4432-abb4-cc6e85462657",
"description": "shift gets an element from the list",
"comments": [
"This test does not confirm that shift gets the first element from the",
"list. The next test (shift gets first element from the list) does ",
"check that behaviour. This test provides a stepping stone. "
],
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 17
},
{
"operation": "shift",
"expected": 17
}
]
},
"expected": {}
},
{
"uuid": "37962ee0-3324-4a29-b588-5a4c861e6564",
"description": "shift gets first element from the list",
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 23
},
{
"operation": "push",
"value": 5
},
{
"operation": "shift",
"expected": 23
},
{
"operation": "shift",
"expected": 5
}
]
},
"expected": {}
},
{
"uuid": "30a3586b-e9dc-43fb-9a73-2770cec2c718",
"description": "unshift adds element at start of the list",
"property": "list",
"input": {
"operations": [
{
"operation": "unshift",
"value": 23
},
{
"operation": "unshift",
"value": 5
},
{
"operation": "shift",
"expected": 5
},
{
"operation": "shift",
"expected": 23
}
]
},
"expected": {}
},
{
"uuid": "042f71e4-a8a7-4cf0-8953-7e4f3a21c42d",
"description": "pop, push, shift, and unshift can be used in any order",
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 1
},
{
"operation": "push",
"value": 2
},
{
"operation": "pop",
"expected": 2
},
{
"operation": "push",
"value": 3
},
{
"operation": "shift",
"expected": 1
},
{
"operation": "unshift",
"value": 4
},
{
"operation": "push",
"value": 5
},
{
"operation": "shift",
"expected": 4
},
{
"operation": "pop",
"expected": 5
},
{
"operation": "shift",
"expected": 3
}
]
},
"expected": {}
},
{
"uuid": "88f65c0c-4532-4093-8295-2384fb2f37df",
"description": "count an empty list",
"property": "list",
"input": {
"operations": [
{
"operation": "count",
"expected": 0
}
]
},
"expected": {}
},
{
"uuid": "fc055689-5cbe-4cd9-b994-02e2abbb40a5",
"description": "count a list with items",
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 37
},
{
"operation": "push",
"value": 1
},
{
"operation": "count",
"expected": 2
}
]
},
"expected": {}
},
{
"uuid": "8272cef5-130d-40ea-b7f6-5ffd0790d650",
"description": "count is correct after mutation",
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 31
},
{
"operation": "count",
"expected": 1
},
{
"operation": "unshift",
"value": 43
},
{
"operation": "count",
"expected": 2
},
{
"operation": "shift"
},
{
"operation": "count",
"expected": 1
},
{
"operation": "pop"
},
{
"operation": "count",
"expected": 0
}
]
},
"expected": {}
},
{
"uuid": "229b8f7a-bd8a-4798-b64f-0dc0bb356d95",
"description": "popping to empty doesn't break the list",
"comments": [
"When not implemented correctly, head/tail reference will break when ",
"the last item of the list is removed. This test adds an item after a ",
"list with at least two elements (different head than tail) has been ",
"emptied out. If done correctly, the list will still work."
],
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 41
},
{
"operation": "push",
"value": 59
},
{
"operation": "pop"
},
{
"operation": "pop"
},
{
"operation": "push",
"value": 47
},
{
"operation": "count",
"expected": 1
},
{
"operation": "pop",
"expected": 47
}
]
},
"expected": {}
},
{
"uuid": "4e1948b4-514e-424b-a3cf-a1ebbfa2d1ad",
"description": "shifting to empty doesn't break the list",
"comments": [
"When not implemented correctly, head/tail reference will break when ",
"the last item of the list is removed. This test adds an item after a ",
"list with at least two elements (different head than tail) has been ",
"emptied out. If done correctly, the list will still work."
],
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 41
},
{
"operation": "push",
"value": 59
},
{
"operation": "shift"
},
{
"operation": "shift"
},
{
"operation": "push",
"value": 47
},
{
"operation": "count",
"expected": 1
},
{
"operation": "shift",
"expected": 47
}
]
},
"expected": {}
},
{
"uuid": "e8f7c600-d597-4f79-949d-8ad8bae895a6",
"description": "deletes the only element",
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 61
},
{
"operation": "delete",
"value": 61
},
{
"operation": "count",
"expected": 0
}
]
},
"expected": {}
},
{
"uuid": "fd65e422-51f3-45c0-9fd0-c33da638f89b",
"description": "deletes the element with the specified value from the list",
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 71
},
{
"operation": "push",
"value": 83
},
{
"operation": "push",
"value": 79
},
{
"operation": "delete",
"value": 83
},
{
"operation": "count",
"expected": 2
},
{
"operation": "pop",
"expected": 79
},
{
"operation": "shift",
"expected": 71
}
]
},
"expected": {}
},
{
"uuid": "59db191a-b17f-4ab7-9c5c-60711ec1d013",
"description": "deletes the element with the specified value from the list, re-assigns tail",
"comments": [
"Depending on the implementation, a previous test (fd65e422) may pass ",
"if the tail is not correctly re-assigned. This test checks if the ",
"tail is correctly assigned. "
],
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 71
},
{
"operation": "push",
"value": 83
},
{
"operation": "push",
"value": 79
},
{
"operation": "delete",
"value": 83
},
{
"operation": "count",
"expected": 2
},
{
"operation": "pop",
"expected": 79
},
{
"operation": "pop",
"expected": 71
}
]
},
"expected": {}
},
{
"uuid": "58242222-5d39-415b-951d-8128247f8993",
"description": "deletes the element with the specified value from the list, re-assigns head",
"comments": [
"Depending on the implementation, a previous test (fd65e422) may pass ",
"if the head is not correctly re-assigned. This test checks if the ",
"head is correctly assigned. "
],
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 71
},
{
"operation": "push",
"value": 83
},
{
"operation": "push",
"value": 79
},
{
"operation": "delete",
"value": 83
},
{
"operation": "count",
"expected": 2
},
{
"operation": "shift",
"expected": 71
},
{
"operation": "shift",
"expected": 79
}
]
},
"expected": {}
},
{
"uuid": "ee3729ee-3405-4bd2-9bad-de0d4aa5d647",
"description": "deletes the first of two elements",
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 97
},
{
"operation": "push",
"value": 101
},
{
"operation": "delete",
"value": 97
},
{
"operation": "count",
"expected": 1
},
{
"operation": "pop",
"expected": 101
}
]
},
"expected": {}
},
{
"uuid": "47e3b3b4-b82c-4c23-8c1a-ceb9b17cb9fb",
"description": "deletes the second of two elements",
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 97
},
{
"operation": "push",
"value": 101
},
{
"operation": "delete",
"value": 101
},
{
"operation": "count",
"expected": 1
},
{
"operation": "pop",
"expected": 97
}
]
},
"expected": {}
},
{
"uuid": "7b420958-f285-4922-b8f9-10d9dcab5179",
"description": "delete does not modify the list if the element is not found",
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 89
},
{
"operation": "delete",
"value": 103
},
{
"operation": "count",
"expected": 1
}
]
},
"expected": {}
},
{
"uuid": "7e04828f-6082-44e3-a059-201c63252a76",
"description": "deletes only the first occurrence",
"comments": [
"It's not defined nor tested whether the element closer to the head or",
"to the tail should be deleted, because different languages have ",
"different standards of what is considered first or last. If a track ",
"wants to test that it's always the element closer to the head or tail",
"that is deleted, it is free to implement such a test. "
],
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 73
},
{
"operation": "push",
"value": 9
},
{
"operation": "push",
"value": 9
},
{
"operation": "push",
"value": 107
},
{
"operation": "delete",
"value": 9
},
{
"operation": "count",
"expected": 3
},
{
"operation": "pop",
"expected": 107
},
{
"operation": "pop",
"expected": 9
},
{
"operation": "pop",
"expected": 73
}
]
},
"expected": {}
}
]
}