From 0f7f8916a07e82c9d1db4455ddc1a70bf0d4bb35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20B=20Nagy?= <20251272+BNAndras@users.noreply.github.com> Date: Sun, 1 Mar 2026 12:29:02 -0800 Subject: [PATCH 1/2] Add `split-second-stopwatch` --- config.json | 8 + .../.docs/instructions.md | 22 ++ .../.docs/introduction.md | 6 + .../split-second-stopwatch/.meta/config.json | 19 ++ .../.meta/example.coffee | 61 ++++++ .../split-second-stopwatch/.meta/tests.toml | 97 +++++++++ .../split-second-stopwatch.coffee | 22 ++ .../split-second-stopwatch.spec.coffee | 206 ++++++++++++++++++ 8 files changed, 441 insertions(+) create mode 100644 exercises/practice/split-second-stopwatch/.docs/instructions.md create mode 100644 exercises/practice/split-second-stopwatch/.docs/introduction.md create mode 100644 exercises/practice/split-second-stopwatch/.meta/config.json create mode 100644 exercises/practice/split-second-stopwatch/.meta/example.coffee create mode 100644 exercises/practice/split-second-stopwatch/.meta/tests.toml create mode 100644 exercises/practice/split-second-stopwatch/split-second-stopwatch.coffee create mode 100644 exercises/practice/split-second-stopwatch/split-second-stopwatch.spec.coffee diff --git a/config.json b/config.json index 3d5f583..419d26e 100644 --- a/config.json +++ b/config.json @@ -958,6 +958,14 @@ "practices": [], "prerequisites": [], "difficulty": 5 + }, + { + "slug": "split-second-stopwatch", + "name": "Split-Second Stopwatch", + "uuid": "f35052c7-02ff-4786-91d6-e1065a90847e", + "practices": [], + "prerequisites": [], + "difficulty": 5 } ] }, diff --git a/exercises/practice/split-second-stopwatch/.docs/instructions.md b/exercises/practice/split-second-stopwatch/.docs/instructions.md new file mode 100644 index 0000000..30bdc98 --- /dev/null +++ b/exercises/practice/split-second-stopwatch/.docs/instructions.md @@ -0,0 +1,22 @@ +# Instructions + +Your task is to build a stopwatch to keep precise track of lap times. + +The stopwatch uses four commands (start, stop, lap, and reset) to keep track of: + +1. The current lap's tracked time +2. Previously recorded lap times + +What commands can be used depends on which state the stopwatch is in: + +1. Ready: initial state +2. Running: tracking time +3. Stopped: not tracking time + +| Command | Begin state | End state | Effect | +| ------- | ----------- | --------- | -------------------------------------------------------- | +| Start | Ready | Running | Start tracking time | +| Start | Stopped | Running | Resume tracking time | +| Stop | Running | Stopped | Stop tracking time | +| Lap | Running | Running | Add current lap to previous laps, then reset current lap | +| Reset | Stopped | Ready | Reset current lap and clear previous laps | diff --git a/exercises/practice/split-second-stopwatch/.docs/introduction.md b/exercises/practice/split-second-stopwatch/.docs/introduction.md new file mode 100644 index 0000000..a843224 --- /dev/null +++ b/exercises/practice/split-second-stopwatch/.docs/introduction.md @@ -0,0 +1,6 @@ +# Introduction + +You've always run for the thrill of it — no schedules, no timers, just the sound of your feet on the pavement. +But now that you've joined a competitive running crew, things are getting serious. +Training sessions are timed to the second, and every split second counts. +To keep pace, you've picked up the _Split-Second Stopwatch_ — a sleek, high-tech gadget that's about to become your new best friend. diff --git a/exercises/practice/split-second-stopwatch/.meta/config.json b/exercises/practice/split-second-stopwatch/.meta/config.json new file mode 100644 index 0000000..ac9a5a4 --- /dev/null +++ b/exercises/practice/split-second-stopwatch/.meta/config.json @@ -0,0 +1,19 @@ +{ + "authors": [ + "BNAndras" + ], + "files": { + "solution": [ + "split-second-stopwatch.coffee" + ], + "test": [ + "split-second-stopwatch.spec.coffee" + ], + "example": [ + ".meta/example.coffee" + ] + }, + "blurb": "Keep track of time through a digital stopwatch.", + "source": "Erik Schierboom", + "source_url": "https://github.com/exercism/problem-specifications/pull/2547" +} diff --git a/exercises/practice/split-second-stopwatch/.meta/example.coffee b/exercises/practice/split-second-stopwatch/.meta/example.coffee new file mode 100644 index 0000000..f007890 --- /dev/null +++ b/exercises/practice/split-second-stopwatch/.meta/example.coffee @@ -0,0 +1,61 @@ +class SplitSecondStopwatch + constructor: -> + @_state = 'ready' + @_totalSeconds = 0 + @_currentLapSeconds = 0 + @_previousLaps = [] + + state: -> @_state + + currentLap: -> @_formatTime @_currentLapSeconds + + total: -> @_formatTime @_totalSeconds + + previousLaps: -> @_previousLaps.map (s) => @_formatTime s + + start: -> + if @_state is 'running' + throw new Error 'cannot start an already running stopwatch' + @_state = 'running' + + stop: -> + if @_state isnt 'running' + throw new Error 'cannot stop a stopwatch that is not running' + @_state = 'stopped' + + lap: -> + if @_state isnt 'running' + throw new Error 'cannot lap a stopwatch that is not running' + @_previousLaps.push @_currentLapSeconds + @_currentLapSeconds = 0 + + reset: -> + if @_state isnt 'stopped' + throw new Error 'cannot reset a stopwatch that is not stopped' + @_state = 'ready' + @_totalSeconds = 0 + @_currentLapSeconds = 0 + @_previousLaps = [] + + advanceTime: (amount) -> + seconds = @_parseTime(amount) + if @_state is 'running' + @_currentLapSeconds += seconds + @_totalSeconds += seconds + + _parseTime: (amount) -> + [h, m, s] = amount.split(':').map Number + h * 3600 + m * 60 + s + + _formatTime: (totalSeconds) -> + h = Math.floor totalSeconds / 3600 + m = Math.floor (totalSeconds % 3600) / 60 + s = totalSeconds % 60 + + cleaned = (num) -> + str = num.toString() + if str.length < 2 then "0#{str}" else str + + "#{cleaned h}:#{cleaned m}:#{cleaned s}" + +module.exports = SplitSecondStopwatch diff --git a/exercises/practice/split-second-stopwatch/.meta/tests.toml b/exercises/practice/split-second-stopwatch/.meta/tests.toml new file mode 100644 index 0000000..323cb7a --- /dev/null +++ b/exercises/practice/split-second-stopwatch/.meta/tests.toml @@ -0,0 +1,97 @@ +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. + +[ddb238ea-99d4-4eaa-a81d-3c917a525a23] +description = "new stopwatch starts in ready state" + +[b19635d4-08ad-4ac3-b87f-aca10e844071] +description = "new stopwatch's current lap has no elapsed time" + +[492eb532-268d-43ea-8a19-2a032067d335] +description = "new stopwatch's total has no elapsed time" + +[8a892c1e-9ef7-4690-894e-e155a1fe4484] +description = "new stopwatch does not have previous laps" + +[5b2705b6-a584-4042-ba3a-4ab8d0ab0281] +description = "start from ready state changes state to running" + +[748235ce-1109-440b-9898-0a431ea179b6] +description = "start does not change previous laps" + +[491487b1-593d-423e-a075-aa78d449ff1f] +description = "start initiates time tracking for current lap" + +[a0a7ba2c-8db6-412c-b1b6-cb890e9b72ed] +description = "start initiates time tracking for total" + +[7f558a17-ef6d-4a5b-803a-f313af7c41d3] +description = "start cannot be called from running state" + +[32466eef-b2be-4d60-a927-e24fce52dab9] +description = "stop from running state changes state to stopped" + +[621eac4c-8f43-4d99-919c-4cad776d93df] +description = "stop pauses time tracking for current lap" + +[465bcc82-7643-41f2-97ff-5e817cef8db4] +description = "stop pauses time tracking for total" + +[b1ba7454-d627-41ee-a078-891b2ed266fc] +description = "stop cannot be called from ready state" + +[5c041078-0898-44dc-9d5b-8ebb5352626c] +description = "stop cannot be called from stopped state" + +[3f32171d-8fbf-46b6-bc2b-0810e1ec53b7] +description = "start from stopped state changes state to running" + +[626997cb-78d5-4fe8-b501-29fdef804799] +description = "start from stopped state resumes time tracking for current lap" + +[58487c53-ab26-471c-a171-807ef6363319] +description = "start from stopped state resumes time tracking for total" + +[091966e3-ed25-4397-908b-8bb0330118f8] +description = "lap adds current lap to previous laps" + +[1aa4c5ee-a7d5-4d59-9679-419deef3c88f] +description = "lap resets current lap and resumes time tracking" + +[4b46b92e-1b3f-46f6-97d2-0082caf56e80] +description = "lap continues time tracking for total" + +[ea75d36e-63eb-4f34-97ce-8c70e620bdba] +description = "lap cannot be called from ready state" + +[63731154-a23a-412d-a13f-c562f208eb1e] +description = "lap cannot be called from stopped state" + +[e585ee15-3b3f-4785-976b-dd96e7cc978b] +description = "stop does not change previous laps" + +[fc3645e2-86cf-4d11-97c6-489f031103f6] +description = "reset from stopped state changes state to ready" + +[20fbfbf7-68ad-4310-975a-f5f132886c4e] +description = "reset resets current lap" + +[00a8f7bb-dd5c-43e5-8705-3ef124007662] +description = "reset clears previous laps" + +[76cea936-6214-4e95-b6d1-4d4edcf90499] +description = "reset cannot be called from ready state" + +[ba4d8e69-f200-4721-b59e-90d8cf615153] +description = "reset cannot be called from running state" + +[0b01751a-cb57-493f-bb86-409de6e84306] +description = "supports very long laps" diff --git a/exercises/practice/split-second-stopwatch/split-second-stopwatch.coffee b/exercises/practice/split-second-stopwatch/split-second-stopwatch.coffee new file mode 100644 index 0000000..5fa6dc7 --- /dev/null +++ b/exercises/practice/split-second-stopwatch/split-second-stopwatch.coffee @@ -0,0 +1,22 @@ +class SplitSecondStopwatch + constructor: -> + + state: -> + + currentLap: -> + + total: -> + + previousLaps: -> + + start: -> + + stop: -> + + lap: -> + + reset: -> + + advanceTime: (amount) -> + +module.exports = SplitSecondStopwatch diff --git a/exercises/practice/split-second-stopwatch/split-second-stopwatch.spec.coffee b/exercises/practice/split-second-stopwatch/split-second-stopwatch.spec.coffee new file mode 100644 index 0000000..e618bc4 --- /dev/null +++ b/exercises/practice/split-second-stopwatch/split-second-stopwatch.spec.coffee @@ -0,0 +1,206 @@ +SplitSecondStopwatch = require './split-second-stopwatch' + +describe 'SplitSecondStopwatch', -> + it 'new stopwatch starts in ready state', -> + stopwatch = new SplitSecondStopwatch + expect(stopwatch.state()).toEqual "ready" + + xit 'new stopwatch\'s current lap has no elapsed time', -> + stopwatch = new SplitSecondStopwatch + expect(stopwatch.currentLap()).toEqual "00:00:00" + + xit 'new stopwatch\'s total has no elapsed time', -> + stopwatch = new SplitSecondStopwatch + expect(stopwatch.total()).toEqual "00:00:00" + + xit 'new stopwatch does not have previous laps', -> + stopwatch = new SplitSecondStopwatch + expect(stopwatch.previousLaps()).toEqual [] + + xit 'start from ready state changes state to running', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + expect(stopwatch.state()).toEqual "running" + + xit 'start does not change previous laps', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + expect(stopwatch.previousLaps()).toEqual [] + + xit 'start initiates time tracking for current lap', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.advanceTime '00:00:05' + expect(stopwatch.currentLap()).toEqual "00:00:05" + + xit 'start initiates time tracking for total', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.advanceTime '00:00:23' + expect(stopwatch.total()).toEqual "00:00:23" + + xit 'start cannot be called from running state', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + expect(-> stopwatch.start()).toThrow 'cannot start an already running stopwatch' + + xit 'stop from running state changes state to stopped', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.stop() + expect(stopwatch.state()).toEqual "stopped" + + xit 'stop pauses time tracking for current lap', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.advanceTime '00:00:05' + stopwatch.stop() + stopwatch.advanceTime '00:00:08' + expect(stopwatch.currentLap()).toEqual "00:00:05" + + xit 'stop pauses time tracking for total', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.advanceTime '00:00:13' + stopwatch.stop() + stopwatch.advanceTime '00:00:44' + expect(stopwatch.total()).toEqual "00:00:13" + + xit 'stop cannot be called from ready state', -> + stopwatch = new SplitSecondStopwatch + expect(-> stopwatch.stop()).toThrow 'cannot stop a stopwatch that is not running' + + xit 'stop cannot be called from stopped state', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.stop() + expect(-> stopwatch.stop()).toThrow 'cannot stop a stopwatch that is not running' + + xit 'start from stopped state changes state to running', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.stop() + stopwatch.start() + expect(stopwatch.state()).toEqual "running" + + xit 'start from stopped state resumes time tracking for current lap', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.advanceTime '00:01:20' + stopwatch.stop() + stopwatch.advanceTime '00:00:20' + stopwatch.start() + stopwatch.advanceTime '00:00:08' + expect(stopwatch.currentLap()).toEqual "00:01:28" + + xit 'start from stopped state resumes time tracking for total', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.advanceTime '00:00:23' + stopwatch.stop() + stopwatch.advanceTime '00:00:44' + stopwatch.start() + stopwatch.advanceTime '00:00:09' + expect(stopwatch.total()).toEqual "00:00:32" + + xit 'lap adds current lap to previous laps', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.advanceTime '00:01:38' + stopwatch.lap() + expect(stopwatch.previousLaps()).toEqual ["00:01:38"] + stopwatch.advanceTime '00:00:44' + stopwatch.lap() + expect(stopwatch.previousLaps()).toEqual ["00:01:38","00:00:44"] + + xit 'lap resets current lap and resumes time tracking', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.advanceTime '00:08:22' + stopwatch.lap() + expect(stopwatch.currentLap()).toEqual "00:00:00" + stopwatch.advanceTime '00:00:15' + expect(stopwatch.currentLap()).toEqual "00:00:15" + + xit 'lap continues time tracking for total', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.advanceTime '00:00:22' + stopwatch.lap() + stopwatch.advanceTime '00:00:33' + expect(stopwatch.total()).toEqual "00:00:55" + + xit 'lap cannot be called from ready state', -> + stopwatch = new SplitSecondStopwatch + expect(-> stopwatch.lap()).toThrow 'cannot lap a stopwatch that is not running' + + xit 'lap cannot be called from stopped state', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.stop() + expect(-> stopwatch.lap()).toThrow 'cannot lap a stopwatch that is not running' + + xit 'stop does not change previous laps', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.advanceTime '00:11:22' + stopwatch.lap() + expect(stopwatch.previousLaps()).toEqual ["00:11:22"] + stopwatch.stop() + expect(stopwatch.previousLaps()).toEqual ["00:11:22"] + + xit 'reset from stopped state changes state to ready', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.stop() + stopwatch.reset() + expect(stopwatch.state()).toEqual "ready" + + xit 'reset resets current lap', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.advanceTime '00:00:10' + stopwatch.stop() + stopwatch.reset() + expect(stopwatch.currentLap()).toEqual "00:00:00" + + xit 'reset clears previous laps', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.advanceTime '00:00:10' + stopwatch.lap() + stopwatch.advanceTime '00:00:20' + stopwatch.lap() + expect(stopwatch.previousLaps()).toEqual ["00:00:10","00:00:20"] + stopwatch.stop() + stopwatch.reset() + expect(stopwatch.previousLaps()).toEqual [] + + xit 'reset cannot be called from ready state', -> + stopwatch = new SplitSecondStopwatch + expect(-> stopwatch.reset()).toThrow 'cannot reset a stopwatch that is not stopped' + + xit 'reset cannot be called from running state', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + expect(-> stopwatch.reset()).toThrow 'cannot reset a stopwatch that is not stopped' + + xit 'supports very long laps', -> + stopwatch = new SplitSecondStopwatch + stopwatch.start() + stopwatch.advanceTime '01:23:45' + expect(stopwatch.currentLap()).toEqual "01:23:45" + stopwatch.lap() + expect(stopwatch.previousLaps()).toEqual ["01:23:45"] + stopwatch.advanceTime '04:01:40' + expect(stopwatch.currentLap()).toEqual "04:01:40" + expect(stopwatch.total()).toEqual "05:25:25" + stopwatch.lap() + expect(stopwatch.previousLaps()).toEqual ["01:23:45","04:01:40"] + stopwatch.advanceTime '08:43:05' + expect(stopwatch.currentLap()).toEqual "08:43:05" + expect(stopwatch.total()).toEqual "14:08:30" + stopwatch.lap() + expect(stopwatch.previousLaps()).toEqual ["01:23:45","04:01:40","08:43:05"] + + From 1504da9b68b40251e00389b6dfff7424c7615454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20B=20Nagy?= <20251272+BNAndras@users.noreply.github.com> Date: Mon, 2 Mar 2026 07:18:34 -0800 Subject: [PATCH 2/2] single and double quotes --- .../split-second-stopwatch.spec.coffee | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/exercises/practice/split-second-stopwatch/split-second-stopwatch.spec.coffee b/exercises/practice/split-second-stopwatch/split-second-stopwatch.spec.coffee index e618bc4..12ad06e 100644 --- a/exercises/practice/split-second-stopwatch/split-second-stopwatch.spec.coffee +++ b/exercises/practice/split-second-stopwatch/split-second-stopwatch.spec.coffee @@ -3,15 +3,15 @@ SplitSecondStopwatch = require './split-second-stopwatch' describe 'SplitSecondStopwatch', -> it 'new stopwatch starts in ready state', -> stopwatch = new SplitSecondStopwatch - expect(stopwatch.state()).toEqual "ready" + expect(stopwatch.state()).toEqual 'ready' - xit 'new stopwatch\'s current lap has no elapsed time', -> + xit "new stopwatch's current lap has no elapsed time", -> stopwatch = new SplitSecondStopwatch - expect(stopwatch.currentLap()).toEqual "00:00:00" + expect(stopwatch.currentLap()).toEqual '00:00:00' - xit 'new stopwatch\'s total has no elapsed time', -> + xit "new stopwatch's total has no elapsed time", -> stopwatch = new SplitSecondStopwatch - expect(stopwatch.total()).toEqual "00:00:00" + expect(stopwatch.total()).toEqual '00:00:00' xit 'new stopwatch does not have previous laps', -> stopwatch = new SplitSecondStopwatch @@ -20,7 +20,7 @@ describe 'SplitSecondStopwatch', -> xit 'start from ready state changes state to running', -> stopwatch = new SplitSecondStopwatch stopwatch.start() - expect(stopwatch.state()).toEqual "running" + expect(stopwatch.state()).toEqual 'running' xit 'start does not change previous laps', -> stopwatch = new SplitSecondStopwatch @@ -31,13 +31,13 @@ describe 'SplitSecondStopwatch', -> stopwatch = new SplitSecondStopwatch stopwatch.start() stopwatch.advanceTime '00:00:05' - expect(stopwatch.currentLap()).toEqual "00:00:05" + expect(stopwatch.currentLap()).toEqual '00:00:05' xit 'start initiates time tracking for total', -> stopwatch = new SplitSecondStopwatch stopwatch.start() stopwatch.advanceTime '00:00:23' - expect(stopwatch.total()).toEqual "00:00:23" + expect(stopwatch.total()).toEqual '00:00:23' xit 'start cannot be called from running state', -> stopwatch = new SplitSecondStopwatch @@ -48,7 +48,7 @@ describe 'SplitSecondStopwatch', -> stopwatch = new SplitSecondStopwatch stopwatch.start() stopwatch.stop() - expect(stopwatch.state()).toEqual "stopped" + expect(stopwatch.state()).toEqual 'stopped' xit 'stop pauses time tracking for current lap', -> stopwatch = new SplitSecondStopwatch @@ -56,7 +56,7 @@ describe 'SplitSecondStopwatch', -> stopwatch.advanceTime '00:00:05' stopwatch.stop() stopwatch.advanceTime '00:00:08' - expect(stopwatch.currentLap()).toEqual "00:00:05" + expect(stopwatch.currentLap()).toEqual '00:00:05' xit 'stop pauses time tracking for total', -> stopwatch = new SplitSecondStopwatch @@ -64,7 +64,7 @@ describe 'SplitSecondStopwatch', -> stopwatch.advanceTime '00:00:13' stopwatch.stop() stopwatch.advanceTime '00:00:44' - expect(stopwatch.total()).toEqual "00:00:13" + expect(stopwatch.total()).toEqual '00:00:13' xit 'stop cannot be called from ready state', -> stopwatch = new SplitSecondStopwatch @@ -81,7 +81,7 @@ describe 'SplitSecondStopwatch', -> stopwatch.start() stopwatch.stop() stopwatch.start() - expect(stopwatch.state()).toEqual "running" + expect(stopwatch.state()).toEqual 'running' xit 'start from stopped state resumes time tracking for current lap', -> stopwatch = new SplitSecondStopwatch @@ -91,7 +91,7 @@ describe 'SplitSecondStopwatch', -> stopwatch.advanceTime '00:00:20' stopwatch.start() stopwatch.advanceTime '00:00:08' - expect(stopwatch.currentLap()).toEqual "00:01:28" + expect(stopwatch.currentLap()).toEqual '00:01:28' xit 'start from stopped state resumes time tracking for total', -> stopwatch = new SplitSecondStopwatch @@ -101,26 +101,26 @@ describe 'SplitSecondStopwatch', -> stopwatch.advanceTime '00:00:44' stopwatch.start() stopwatch.advanceTime '00:00:09' - expect(stopwatch.total()).toEqual "00:00:32" + expect(stopwatch.total()).toEqual '00:00:32' xit 'lap adds current lap to previous laps', -> stopwatch = new SplitSecondStopwatch stopwatch.start() stopwatch.advanceTime '00:01:38' stopwatch.lap() - expect(stopwatch.previousLaps()).toEqual ["00:01:38"] + expect(stopwatch.previousLaps()).toEqual ['00:01:38'] stopwatch.advanceTime '00:00:44' stopwatch.lap() - expect(stopwatch.previousLaps()).toEqual ["00:01:38","00:00:44"] + expect(stopwatch.previousLaps()).toEqual ['00:01:38','00:00:44'] xit 'lap resets current lap and resumes time tracking', -> stopwatch = new SplitSecondStopwatch stopwatch.start() stopwatch.advanceTime '00:08:22' stopwatch.lap() - expect(stopwatch.currentLap()).toEqual "00:00:00" + expect(stopwatch.currentLap()).toEqual '00:00:00' stopwatch.advanceTime '00:00:15' - expect(stopwatch.currentLap()).toEqual "00:00:15" + expect(stopwatch.currentLap()).toEqual '00:00:15' xit 'lap continues time tracking for total', -> stopwatch = new SplitSecondStopwatch @@ -128,7 +128,7 @@ describe 'SplitSecondStopwatch', -> stopwatch.advanceTime '00:00:22' stopwatch.lap() stopwatch.advanceTime '00:00:33' - expect(stopwatch.total()).toEqual "00:00:55" + expect(stopwatch.total()).toEqual '00:00:55' xit 'lap cannot be called from ready state', -> stopwatch = new SplitSecondStopwatch @@ -145,16 +145,16 @@ describe 'SplitSecondStopwatch', -> stopwatch.start() stopwatch.advanceTime '00:11:22' stopwatch.lap() - expect(stopwatch.previousLaps()).toEqual ["00:11:22"] + expect(stopwatch.previousLaps()).toEqual ['00:11:22'] stopwatch.stop() - expect(stopwatch.previousLaps()).toEqual ["00:11:22"] + expect(stopwatch.previousLaps()).toEqual ['00:11:22'] xit 'reset from stopped state changes state to ready', -> stopwatch = new SplitSecondStopwatch stopwatch.start() stopwatch.stop() stopwatch.reset() - expect(stopwatch.state()).toEqual "ready" + expect(stopwatch.state()).toEqual 'ready' xit 'reset resets current lap', -> stopwatch = new SplitSecondStopwatch @@ -162,7 +162,7 @@ describe 'SplitSecondStopwatch', -> stopwatch.advanceTime '00:00:10' stopwatch.stop() stopwatch.reset() - expect(stopwatch.currentLap()).toEqual "00:00:00" + expect(stopwatch.currentLap()).toEqual '00:00:00' xit 'reset clears previous laps', -> stopwatch = new SplitSecondStopwatch @@ -171,7 +171,7 @@ describe 'SplitSecondStopwatch', -> stopwatch.lap() stopwatch.advanceTime '00:00:20' stopwatch.lap() - expect(stopwatch.previousLaps()).toEqual ["00:00:10","00:00:20"] + expect(stopwatch.previousLaps()).toEqual ['00:00:10','00:00:20'] stopwatch.stop() stopwatch.reset() expect(stopwatch.previousLaps()).toEqual [] @@ -189,18 +189,18 @@ describe 'SplitSecondStopwatch', -> stopwatch = new SplitSecondStopwatch stopwatch.start() stopwatch.advanceTime '01:23:45' - expect(stopwatch.currentLap()).toEqual "01:23:45" + expect(stopwatch.currentLap()).toEqual '01:23:45' stopwatch.lap() - expect(stopwatch.previousLaps()).toEqual ["01:23:45"] + expect(stopwatch.previousLaps()).toEqual ['01:23:45'] stopwatch.advanceTime '04:01:40' - expect(stopwatch.currentLap()).toEqual "04:01:40" - expect(stopwatch.total()).toEqual "05:25:25" + expect(stopwatch.currentLap()).toEqual '04:01:40' + expect(stopwatch.total()).toEqual '05:25:25' stopwatch.lap() - expect(stopwatch.previousLaps()).toEqual ["01:23:45","04:01:40"] + expect(stopwatch.previousLaps()).toEqual ['01:23:45','04:01:40'] stopwatch.advanceTime '08:43:05' - expect(stopwatch.currentLap()).toEqual "08:43:05" - expect(stopwatch.total()).toEqual "14:08:30" + expect(stopwatch.currentLap()).toEqual '08:43:05' + expect(stopwatch.total()).toEqual '14:08:30' stopwatch.lap() - expect(stopwatch.previousLaps()).toEqual ["01:23:45","04:01:40","08:43:05"] + expect(stopwatch.previousLaps()).toEqual ['01:23:45','04:01:40','08:43:05']