Skip to content

Commit

Permalink
Update square-root test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
ladokp committed Jan 4, 2024
1 parent 37e7fbd commit 059cec5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion exercises/practice/square-root/.meta/example.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class SquareRoot
squareRoot: (radicand) ->
@squareRoot: (radicand) ->
results = 0
while (results * results != radicand)
results += 1
Expand Down
13 changes: 6 additions & 7 deletions exercises/practice/square-root/square-root.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,38 @@
SquareRoot = require './square-root'

describe 'SquareRoot', ->
sqrt = new SquareRoot()
it 'root of 1', ->
radicand = 1
results = sqrt.squareRoot(radicand)
results = SquareRoot.squareRoot(radicand)
expected = 1
expect(results).toEqual expected

xit 'root of 4', ->
radicand = 4
results = sqrt.squareRoot(radicand)
results = SquareRoot.squareRoot(radicand)
expected = 2
expect(results).toEqual expected

xit 'root of 25', ->
radicand = 25
results = sqrt.squareRoot(radicand)
results = SquareRoot.squareRoot(radicand)
expected = 5
expect(results).toEqual expected

xit 'root of 81', ->
radicand = 81
results = sqrt.squareRoot(radicand)
results = SquareRoot.squareRoot(radicand)
expected = 9
expect(results).toEqual expected

xit 'root of 196', ->
radicand = 196
results = sqrt.squareRoot(radicand)
results = SquareRoot.squareRoot(radicand)
expected = 14
expect(results).toEqual expected

xit 'root of 65025', ->
radicand = 65025
results = sqrt.squareRoot(radicand)
results = SquareRoot.squareRoot(radicand)
expected = 255
expect(results).toEqual expected

0 comments on commit 059cec5

Please sign in to comment.