Content-Length: 290170 | pFad | http://github.com/RabibHossain/JavaScriptAlgorithm/commit/f5be6b2daa2ebec46f59873c4a1a056eff5a603c

71 merge: Add test case to Fibonacci Search Algorithm (#1042) · RabibHossain/JavaScriptAlgorithm@f5be6b2 · GitHub
Skip to content

Commit f5be6b2

Browse files
Ankush263github-actions
andauthored
merge: Add test case to Fibonacci Search Algorithm (TheAlgorithms#1042)
* Add test case to Fibonacci Search Algorithm * Updated Documentation in README.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent 15c2096 commit f5be6b2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Search/test/FibonacciSearch.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { fibonacciSearch } from '../FibonacciSearch'
2+
3+
test('fibonacciSearch([10, 22, 35, 40, 45, 50, 80, 82, 85, 90, 100], 90, arr.length) => 9', () => {
4+
const arr = [10, 22, 35, 40, 45, 50, 80, 82, 85, 90, 100]
5+
const target = 90
6+
const res = fibonacciSearch(arr, target, arr.length)
7+
expect(res).toEqual(9)
8+
})
9+
10+
test('fibonacciSearch([1, 11, 55, 56, 78, 82, 104], 104, arr.length) => 6', () => {
11+
const arr = [1, 11, 55, 56, 78, 82, 104]
12+
const target = 104
13+
const res = fibonacciSearch(arr, target, arr.length)
14+
expect(res).toEqual(6)
15+
})
16+
17+
test('fibonacciSearch([40, 45, 50, 80, 82, 85, 90, 100]. 190, arr.length) => -1', () => {
18+
const arr = [40, 45, 50, 80, 82, 85, 90, 100]
19+
const target = 190
20+
const res = fibonacciSearch(arr, target, arr.length)
21+
expect(res).toEqual(-1)
22+
})

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/RabibHossain/JavaScriptAlgorithm/commit/f5be6b2daa2ebec46f59873c4a1a056eff5a603c

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy