Skip to content

Commit 6e51e62

Browse files
committed
added tests
1 parent 0e8a608 commit 6e51e62

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

test/js/algorithms/search/search-algorithms-tests.js

+8
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ export function testSearchAlgorithm(
3333
expect(searchAlgorithm(array, SIZE)).to.equal(SIZE - 1);
3434
});
3535

36+
it('finds value at different positions', () => {
37+
const array = createSortedArray();
38+
39+
for (let value = 1; value <= SIZE; value++) {
40+
expect(searchAlgorithm(array, value)).to.equal(value - 1);
41+
}
42+
});
43+
3644
if (config.customEquals) {
3745
it('finds value with custom equals function', () => {
3846
const array = [{ key: 1 }, { key: 2 }, { key: 3 }];

test/ts/algorithms/search/search-algorithms-tests.ts

+8
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ export function testSearchAlgorithm(
3939
expect(searchAlgorithm(array, SIZE)).to.equal(SIZE - 1);
4040
});
4141

42+
it('finds value at different positions', () => {
43+
const array = createSortedArray();
44+
45+
for (let value = 1; value <= SIZE; value++) {
46+
expect(searchAlgorithm(array, value)).to.equal(value - 1);
47+
}
48+
});
49+
4250
if (config.customEquals) {
4351
it('finds value with custom equals function', () => {
4452
const array = [{ key: 1 }, { key: 2 }, { key: 3 }];

0 commit comments

Comments
 (0)