Skip to content

test(search): add duplicate-element tests for binary search#800

Open
dvanhu wants to merge 1 commit intoTheAlgorithms:masterfrom
dvanhu:improve-search-duplicate-tests
Open

test(search): add duplicate-element tests for binary search#800
dvanhu wants to merge 1 commit intoTheAlgorithms:masterfrom
dvanhu:improve-search-duplicate-tests

Conversation

@dvanhu
Copy link
Copy Markdown

@dvanhu dvanhu commented May 8, 2026

Summary

Added duplicate-element test coverage for binary search implementations.

Some search algorithms may return the first occurrence of a target, while others may return any valid matching index when duplicate values exist. These tests validate correctness by checking the returned value rather than enforcing a specific duplicate index.

Changes

  • Added duplicate-element tests for:

    • Binary
    • BinaryIterative
  • Validated returned indices safely against target values

  • Preserved current implementation semantics

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 6 complexity · -8 duplication

Metric Results
Complexity 6
Duplication -8

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant