Skip to content

Commit 398b682

Browse files
Ankush263github-actions
and
github-actions
authored
merge: Add test case to the Exponential Search Algorithm (#1040)
* Add test case to the Exponential Search Algorithm * Updated Documentation in README.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent d3cec8b commit 398b682

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Search/test/ExponentialSearch.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { exponentialSearch } from '../ExponentialSearch'
2+
3+
test('The Exponential Search of the Array [2, 3, 4, 10, 40, 65, 78, 100] is 6 where the value = 78', () => {
4+
const arr = [2, 3, 4, 10, 40, 65, 78, 100]
5+
const value = 78
6+
const result = exponentialSearch(arr, arr.length, value)
7+
expect(result).toEqual(6)
8+
})
9+
10+
test('The Exponential Search of the Array [2, 3, 4, 10, 40, 65, 78, 100] is -1 where the value = 178', () => {
11+
const arr = [2, 3, 4, 10, 40, 65, 78, 100]
12+
const value = 178
13+
const result = exponentialSearch(arr, arr.length, value)
14+
expect(result).toEqual(-1)
15+
})

0 commit comments

Comments
 (0)