Files
JavaScript/Maths/test/SquareRootLogarithmic.test.js
Alex Popov c39d6665ce algorithm: logarithmic square root (#1259)
* algorithm: add SquareRootLogarithmic algo and a test for it

* fix: fix spelling errors

* refactor: rename a variable "e" --> "edge"
2022-10-31 22:20:33 +05:30

14 lines
492 B
JavaScript

import { squareRootLogarithmic } from '../SquareRootLogarithmic'
describe('SquareRootLogarithmic', () => {
test('Finding the square root of a positive integer', () => {
expect(squareRootLogarithmic(4)).toEqual(2)
expect(squareRootLogarithmic(16)).toEqual(4)
expect(squareRootLogarithmic(8)).toEqual(2)
})
test('Throwing an exception', () => {
expect(() => squareRootLogarithmic('not a number')).toThrow()
expect(() => squareRootLogarithmic(true)).toThrow()
})
})