|
| 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