mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-04 07:29:47 +08:00

* Added QuadraticRoots in the Math/QuadraticRoots * Fixed math/QyadraticRoots var to let * Added relevant links math/QyadraticRoots * Added relevant links math/QyadraticRoots and fixed let - const * Added the changes and @see notation in Math/QuadraticRoots.js * Added the changes Math/QuadraticRoots.js and return an empty [] * Readd describe block, remove redundant comments * Changed [1,1] to [1] --------- Co-authored-by: Dibya <Dibya.DebayanDash@siriuscom.com> Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
14 lines
527 B
JavaScript
14 lines
527 B
JavaScript
import { quadraticRoots } from '../QuadraticRoots.js'
|
|
|
|
describe('quadratic roots', () => {
|
|
it('returns an array with two real roots when the discriminant is positive', () => {
|
|
expect(quadraticRoots(1, -3, 2)).toEqual([2, 1])
|
|
})
|
|
it('returns an array with one real root when the discriminant is zero', () => {
|
|
expect(quadraticRoots(1, -2, 1)).toEqual([1])
|
|
})
|
|
it('returns an empty array indicating no real roots when the discriminant is negative', () => {
|
|
expect(quadraticRoots(1, 2, 5)).toEqual([])
|
|
})
|
|
})
|