Skip to content

Commit 653ada6

Browse files
Add more test cases
1 parent 3bbfb6a commit 653ada6

File tree

1 file changed

+131
-5
lines changed

1 file changed

+131
-5
lines changed

exercises/split-second-stopwatch/canonical-data.json

Lines changed: 131 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
},
125125
{
126126
"uuid": "491487b1-593d-423e-a075-aa78d449ff1f",
127-
"description": "starts time tracking in current lap",
127+
"description": "starts time tracking for current lap",
128128
"property": "time",
129129
"input": {
130130
"commands": [
@@ -148,7 +148,7 @@
148148
},
149149
{
150150
"uuid": "a0a7ba2c-8db6-412c-b1b6-cb890e9b72ed",
151-
"description": "starts time tracking in total",
151+
"description": "starts time tracking for total",
152152
"property": "time",
153153
"input": {
154154
"commands": [
@@ -194,7 +194,6 @@
194194
}
195195
]
196196
},
197-
198197
{
199198
"description": "stop",
200199
"cases": [
@@ -246,7 +245,7 @@
246245
},
247246
{
248247
"uuid": "621eac4c-8f43-4d99-919c-4cad776d93df",
249-
"description": "stops time tracking in current lap",
248+
"description": "stops time tracking for current lap",
250249
"property": "time",
251250
"input": {
252251
"commands": [
@@ -277,7 +276,7 @@
277276
},
278277
{
279278
"uuid": "465bcc82-7643-41f2-97ff-5e817cef8db4",
280-
"description": "starts time tracking in total",
279+
"description": "starts time tracking for total",
281280
"property": "time",
282281
"input": {
283282
"commands": [
@@ -326,6 +325,133 @@
326325
"expected": {}
327326
}
328327
]
328+
},
329+
{
330+
"description": "lap",
331+
"cases": [
332+
{
333+
"uuid": "091966e3-ed25-4397-908b-8bb0330118f8",
334+
"description": "adds current lap to previous laps",
335+
"property": "time",
336+
"input": {
337+
"commands": [
338+
{
339+
"command": "new"
340+
},
341+
{
342+
"command": "start"
343+
},
344+
{
345+
"command": "advanceTime",
346+
"seconds": 98
347+
},
348+
{
349+
"command": "stop"
350+
},
351+
{
352+
"command": "lap"
353+
},
354+
{
355+
"command": "previousLaps",
356+
"expected": ["00:01:38"]
357+
}
358+
]
359+
},
360+
"expected": {}
361+
},
362+
{
363+
"uuid": "091966e3-ed25-4397-908b-8bb0330118f8",
364+
"description": "resets current lap and resumes time tracking",
365+
"property": "time",
366+
"input": {
367+
"commands": [
368+
{
369+
"command": "new"
370+
},
371+
{
372+
"command": "start"
373+
},
374+
{
375+
"command": "advanceTime",
376+
"seconds": 98
377+
},
378+
{
379+
"command": "stop"
380+
},
381+
{
382+
"command": "lap"
383+
},
384+
{
385+
"command": "currentLap",
386+
"expected": ["00:00:00"]
387+
},
388+
{
389+
"command": "advanceTime",
390+
"seconds": 15
391+
},
392+
{
393+
"command": "currentLap",
394+
"expected": ["00:00:15"]
395+
}
396+
]
397+
},
398+
"expected": {}
399+
},
400+
{
401+
"uuid": "091966e3-ed25-4397-908b-8bb0330118f8",
402+
"description": "continues time tracking for total",
403+
"property": "time",
404+
"input": {
405+
"commands": [
406+
{
407+
"command": "new"
408+
},
409+
{
410+
"command": "start"
411+
},
412+
{
413+
"command": "advanceTime",
414+
"seconds": 22
415+
},
416+
{
417+
"command": "stop"
418+
},
419+
{
420+
"command": "lap"
421+
},
422+
,
423+
{
424+
"command": "advanceTime",
425+
"seconds": 33
426+
},
427+
{
428+
"command": "total",
429+
"expected": ["00:00:55"]
430+
}
431+
]
432+
},
433+
"expected": {}
434+
},
435+
{
436+
"uuid": "ea75d36e-63eb-4f34-97ce-8c70e620bdba",
437+
"description": "cannot be called from ready state",
438+
"property": "time",
439+
"input": {
440+
"commands": [
441+
{
442+
"command": "new"
443+
},
444+
{
445+
"command": "start",
446+
"expected": {
447+
"error": "cannot lap a stopwatch that is not running"
448+
}
449+
}
450+
]
451+
},
452+
"expected": {}
453+
}
454+
]
329455
}
330456
]
331457
}

0 commit comments

Comments
 (0)