Skip to content

Commit 3bbfb6a

Browse files
Add stop state
1 parent c325d0f commit 3bbfb6a

File tree

1 file changed

+133
-0
lines changed

1 file changed

+133
-0
lines changed

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

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,139 @@
193193
"expected": {}
194194
}
195195
]
196+
},
197+
198+
{
199+
"description": "stop",
200+
"cases": [
201+
{
202+
"uuid": "32466eef-b2be-4d60-a927-e24fce52dab9",
203+
"description": "changes state to ready",
204+
"property": "time",
205+
"input": {
206+
"commands": [
207+
{
208+
"command": "new"
209+
},
210+
{
211+
"command": "start"
212+
},
213+
{
214+
"command": "stop"
215+
},
216+
{
217+
"command": "state",
218+
"expected": "ready"
219+
}
220+
]
221+
},
222+
"expected": {}
223+
},
224+
{
225+
"uuid": "e585ee15-3b3f-4785-976b-dd96e7cc978b",
226+
"description": "does not change previous laps",
227+
"property": "time",
228+
"input": {
229+
"commands": [
230+
{
231+
"command": "new"
232+
},
233+
{
234+
"command": "start"
235+
},
236+
{
237+
"command": "stop"
238+
},
239+
{
240+
"command": "previousLaps",
241+
"expected": []
242+
}
243+
]
244+
},
245+
"expected": {}
246+
},
247+
{
248+
"uuid": "621eac4c-8f43-4d99-919c-4cad776d93df",
249+
"description": "stops time tracking in current lap",
250+
"property": "time",
251+
"input": {
252+
"commands": [
253+
{
254+
"command": "new"
255+
},
256+
{
257+
"command": "start"
258+
},
259+
{
260+
"command": "advanceTime",
261+
"seconds": 5
262+
},
263+
{
264+
"command": "stop"
265+
},
266+
{
267+
"command": "advanceTime",
268+
"seconds": 8
269+
},
270+
{
271+
"command": "currentLap",
272+
"expected": "00:00:05"
273+
}
274+
]
275+
},
276+
"expected": {}
277+
},
278+
{
279+
"uuid": "465bcc82-7643-41f2-97ff-5e817cef8db4",
280+
"description": "starts time tracking in total",
281+
"property": "time",
282+
"input": {
283+
"commands": [
284+
{
285+
"command": "new"
286+
},
287+
{
288+
"command": "start"
289+
},
290+
{
291+
"command": "advanceTime",
292+
"seconds": 13
293+
},
294+
{
295+
"command": "stop"
296+
},
297+
{
298+
"command": "advanceTime",
299+
"seconds": 44
300+
},
301+
{
302+
"command": "total",
303+
"expected": "00:00:13"
304+
}
305+
]
306+
},
307+
"expected": {}
308+
},
309+
{
310+
"uuid": "b1ba7454-d627-41ee-a078-891b2ed266fc",
311+
"description": "cannot be called from ready state",
312+
"property": "time",
313+
"input": {
314+
"commands": [
315+
{
316+
"command": "new"
317+
},
318+
{
319+
"command": "stop",
320+
"expected": {
321+
"error": "cannot stop a stopwatch that is not running"
322+
}
323+
}
324+
]
325+
},
326+
"expected": {}
327+
}
328+
]
196329
}
197330
]
198331
}

0 commit comments

Comments
 (0)