forked from TheAlgorithms/JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFibonacci.test.js
More file actions
40 lines (35 loc) · 1.13 KB
/
Fibonacci.test.js
File metadata and controls
40 lines (35 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import {
FibonacciDpWithoutRecursion,
FibonacciRecursiveDP,
FibonacciIterative,
FibonacciRecursive,
FibonacciMatrixExpo
} from '../Fibonacci'
describe('Fibonacci', () => {
it('should return an array of numbers for FibonacciIterative', () => {
expect(FibonacciIterative(5)).toEqual(
expect.arrayContaining([1, 1, 2, 3, 5])
)
})
it('should return an array of numbers for FibonacciRecursive', () => {
expect(FibonacciRecursive(5)).toEqual(
expect.arrayContaining([1, 1, 2, 3, 5])
)
})
it('should return number for FibonacciRecursiveDP', () => {
expect(FibonacciRecursiveDP(5)).toBe(5)
})
it('should return an array of numbers for FibonacciDpWithoutRecursion', () => {
expect(FibonacciDpWithoutRecursion(5)).toEqual(
expect.arrayContaining([1, 1, 2, 3, 5])
)
})
it('should return number for FibonacciMatrixExpo', () => {
expect(FibonacciMatrixExpo(0)).toBe(0)
expect(FibonacciMatrixExpo(1)).toBe(1)
expect(FibonacciMatrixExpo(2)).toBe(1)
expect(FibonacciMatrixExpo(3)).toBe(2)
expect(FibonacciMatrixExpo(4)).toBe(3)
expect(FibonacciMatrixExpo(5)).toBe(5)
})
})