|
| 1 | +{ |
| 2 | + "exercise": "split-second-stopwatch", |
| 3 | + "comments": ["Times are formatted as 'HH:mm:ss'."], |
| 4 | + "cases": [ |
| 5 | + { |
| 6 | + "description": "new stopwatch", |
| 7 | + "cases": [ |
| 8 | + { |
| 9 | + "uuid": "ddb238ea-99d4-4eaa-a81d-3c917a525a23", |
| 10 | + "description": "starts in ready state", |
| 11 | + "property": "time", |
| 12 | + "input": { |
| 13 | + "commands": [ |
| 14 | + { |
| 15 | + "command": "new" |
| 16 | + }, |
| 17 | + { |
| 18 | + "command": "state", |
| 19 | + "expected": "ready" |
| 20 | + } |
| 21 | + ] |
| 22 | + }, |
| 23 | + "expected": {} |
| 24 | + }, |
| 25 | + { |
| 26 | + "uuid": "8a892c1e-9ef7-4690-894e-e155a1fe4484", |
| 27 | + "description": "new stopwatch does not have previous laps", |
| 28 | + "property": "time", |
| 29 | + "input": { |
| 30 | + "commands": [ |
| 31 | + { |
| 32 | + "command": "new" |
| 33 | + }, |
| 34 | + { |
| 35 | + "command": "previousLaps", |
| 36 | + "expected": [] |
| 37 | + } |
| 38 | + ] |
| 39 | + }, |
| 40 | + "expected": {} |
| 41 | + }, |
| 42 | + { |
| 43 | + "uuid": "b19635d4-08ad-4ac3-b87f-aca10e844071", |
| 44 | + "description": "current lap has no elapsed time", |
| 45 | + "property": "time", |
| 46 | + "input": { |
| 47 | + "commands": [ |
| 48 | + { |
| 49 | + "command": "new" |
| 50 | + }, |
| 51 | + { |
| 52 | + "command": "currentLap", |
| 53 | + "expected": "00:00:00" |
| 54 | + } |
| 55 | + ] |
| 56 | + }, |
| 57 | + "expected": {} |
| 58 | + }, |
| 59 | + { |
| 60 | + "uuid": "492eb532-268d-43ea-8a19-2a032067d335", |
| 61 | + "description": "total has no time elapsed", |
| 62 | + "property": "time", |
| 63 | + "input": { |
| 64 | + "commands": [ |
| 65 | + { |
| 66 | + "command": "new" |
| 67 | + }, |
| 68 | + { |
| 69 | + "command": "total", |
| 70 | + "expected": "00:00:00" |
| 71 | + } |
| 72 | + ] |
| 73 | + }, |
| 74 | + "expected": {} |
| 75 | + } |
| 76 | + ] |
| 77 | + }, |
| 78 | + { |
| 79 | + "description": "start", |
| 80 | + "cases": [ |
| 81 | + { |
| 82 | + "uuid": "5b2705b6-a584-4042-ba3a-4ab8d0ab0281", |
| 83 | + "description": "changes state to running", |
| 84 | + "property": "time", |
| 85 | + "input": { |
| 86 | + "commands": [ |
| 87 | + { |
| 88 | + "command": "new" |
| 89 | + }, |
| 90 | + { |
| 91 | + "command": "start" |
| 92 | + }, |
| 93 | + { |
| 94 | + "command": "state", |
| 95 | + "expected": "running" |
| 96 | + } |
| 97 | + ] |
| 98 | + }, |
| 99 | + "expected": {} |
| 100 | + }, |
| 101 | + { |
| 102 | + "uuid": "748235ce-1109-440b-9898-0a431ea179b6", |
| 103 | + "description": "does not change previous laps", |
| 104 | + "property": "time", |
| 105 | + "input": { |
| 106 | + "commands": [ |
| 107 | + { |
| 108 | + "command": "new" |
| 109 | + }, |
| 110 | + { |
| 111 | + "command": "start" |
| 112 | + }, |
| 113 | + { |
| 114 | + "command": "previousLaps", |
| 115 | + "expected": [] |
| 116 | + } |
| 117 | + ] |
| 118 | + }, |
| 119 | + "expected": {} |
| 120 | + }, |
| 121 | + { |
| 122 | + "uuid": "491487b1-593d-423e-a075-aa78d449ff1f", |
| 123 | + "description": "starts time tracking in current lap", |
| 124 | + "property": "time", |
| 125 | + "input": { |
| 126 | + "commands": [ |
| 127 | + { |
| 128 | + "command": "new" |
| 129 | + }, |
| 130 | + { |
| 131 | + "command": "start" |
| 132 | + }, |
| 133 | + { |
| 134 | + "command": "advanceTime", |
| 135 | + "seconds": 5 |
| 136 | + }, |
| 137 | + { |
| 138 | + "command": "currentLap", |
| 139 | + "expected": "00:00:05" |
| 140 | + } |
| 141 | + ] |
| 142 | + }, |
| 143 | + "expected": {} |
| 144 | + }, |
| 145 | + { |
| 146 | + "uuid": "a0a7ba2c-8db6-412c-b1b6-cb890e9b72ed", |
| 147 | + "description": "starts time tracking in total", |
| 148 | + "property": "time", |
| 149 | + "input": { |
| 150 | + "commands": [ |
| 151 | + { |
| 152 | + "command": "new" |
| 153 | + }, |
| 154 | + { |
| 155 | + "command": "start" |
| 156 | + }, |
| 157 | + { |
| 158 | + "command": "advanceTime", |
| 159 | + "seconds": 23 |
| 160 | + }, |
| 161 | + { |
| 162 | + "command": "total", |
| 163 | + "expected": "00:00:23" |
| 164 | + } |
| 165 | + ] |
| 166 | + }, |
| 167 | + "expected": {} |
| 168 | + }, |
| 169 | + { |
| 170 | + "uuid": "7f558a17-ef6d-4a5b-803a-f313af7c41d3", |
| 171 | + "description": "cannot be called from running state", |
| 172 | + "property": "time", |
| 173 | + "input": { |
| 174 | + "commands": [ |
| 175 | + { |
| 176 | + "command": "new" |
| 177 | + }, |
| 178 | + { |
| 179 | + "command": "start" |
| 180 | + }, |
| 181 | + { |
| 182 | + "command": "start", |
| 183 | + "expected": { |
| 184 | + "error": "cannot start an already running stopwatch" |
| 185 | + } |
| 186 | + } |
| 187 | + ] |
| 188 | + }, |
| 189 | + "expected": {} |
| 190 | + } |
| 191 | + ] |
| 192 | + } |
| 193 | + ] |
| 194 | +} |
0 commit comments