mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 09:28:26 +08:00
style: improve test names of GetEuclidGCD'
(#1646)
This commit is contained in:
@ -1,25 +1,22 @@
|
|||||||
import { GetEuclidGCD, GetEuclidGCDRecursive } from '../GetEuclidGCD'
|
import { GetEuclidGCD, GetEuclidGCDRecursive } from '../GetEuclidGCD'
|
||||||
|
|
||||||
describe.each([GetEuclidGCD, GetEuclidGCDRecursive])(
|
describe.each([GetEuclidGCD, GetEuclidGCDRecursive])('%o', (gcdFunction) => {
|
||||||
'%# GetEuclidGCD',
|
it.each([
|
||||||
(gcdFunction) => {
|
[5, 20, 5],
|
||||||
it.each([
|
[109, 902, 1],
|
||||||
[5, 20, 5],
|
[290, 780, 10],
|
||||||
[109, 902, 1],
|
[104, 156, 52],
|
||||||
[290, 780, 10],
|
[0, 100, 100],
|
||||||
[104, 156, 52],
|
[-5, 50, 5],
|
||||||
[0, 100, 100],
|
[0, 0, 0],
|
||||||
[-5, 50, 5],
|
[1, 1234567, 1]
|
||||||
[0, 0, 0],
|
])('returns correct result for %i and %j', (inputA, inputB, expected) => {
|
||||||
[1, 1234567, 1]
|
expect(gcdFunction(inputA, inputB)).toBe(expected)
|
||||||
])('returns correct result for %i and %j', (inputA, inputB, expected) => {
|
expect(gcdFunction(inputB, inputA)).toBe(expected)
|
||||||
expect(gcdFunction(inputA, inputB)).toBe(expected)
|
})
|
||||||
expect(gcdFunction(inputB, inputA)).toBe(expected)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should throw when any of the inputs is not a number', () => {
|
it('should throw when any of the inputs is not a number', () => {
|
||||||
expect(() => gcdFunction('1', 2)).toThrowError()
|
expect(() => gcdFunction('1', 2)).toThrowError()
|
||||||
expect(() => gcdFunction(1, '2')).toThrowError()
|
expect(() => gcdFunction(1, '2')).toThrowError()
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
Reference in New Issue
Block a user