MCPcopy Create free account
hub / github.com/TheAlgorithms/TypeScript / test

Function test

maths/test/fibonacci.test.ts:7–15  ·  view source on GitHub ↗
(func: (n: number) => number)

Source from the content-addressed store, hash-verified

5} from '../fibonacci'
6
7const test = (func: (n: number) => number) =>
8 it.each([
9 [0, 0],
10 [1, 1],
11 [2, 1],
12 [5, 5],
13 [10, 55],
14 [15, 610]
15 ])('fib(%i) = %i', (n, expected) => expect(func(n)).toBe(expected))
16describe('Fibonacci iterative', () => test(nthFibonacci))
17describe('Fibonacci recursive', () => test(nthFibonacciRecursively))
18describe('Fibonacci Using formula', () => test(nthFibonacciUsingFormula))

Calls

no outgoing calls

Tested by

no test coverage detected