|
| 1 | +import { sqrt } from '../SquareRoot' |
| 2 | + |
| 3 | +test('Check SquareRoot of 4 is 2', () => { |
| 4 | + const res = sqrt(4, 10) |
| 5 | + expect(res).toBeCloseTo(2) |
| 6 | +}) |
| 7 | + |
| 8 | +test('Check SquareRoot of 2 is 1.4142135', () => { |
| 9 | + const res = sqrt(2, 10) |
| 10 | + expect(res).toBeCloseTo(1.4142135) |
| 11 | +}) |
| 12 | + |
| 13 | +test('Check SquareRoot of 3.2 is 1.788854381999832', () => { |
| 14 | + const res = sqrt(3.2, 10) |
| 15 | + expect(res).toBeCloseTo(1.788854381999832) |
| 16 | +}) |
| 17 | + |
| 18 | +test('Check SquareRoot of 1 is 1', () => { |
| 19 | + const res = sqrt(1, 10) |
| 20 | + expect(res).toBe(1) |
| 21 | +}) |
| 22 | + |
| 23 | +test('Check SquareRoot of 144 is 12', () => { |
| 24 | + const res = sqrt(144, 10) |
| 25 | + expect(res).toBeCloseTo(12) |
| 26 | +}) |
| 27 | + |
| 28 | +test('Check SquareRoot of 0 is 0', () => { |
| 29 | + const res = sqrt(0, 10) |
| 30 | + expect(res).toBeCloseTo(0) |
| 31 | +}) |
| 32 | + |
| 33 | +test('Check SquareRoot of 1000 is 31.62277', () => { |
| 34 | + const res = sqrt(1000, 10) |
| 35 | + expect(res).toBeCloseTo(31.62277) |
| 36 | +}) |
0 commit comments