Skip to content

Add BinSearch test case#184

Open
bell-boy wants to merge 2 commits intoutgheith:mainfrom
bell-boy:main
Open

Add BinSearch test case#184
bell-boy wants to merge 2 commits intoutgheith:mainfrom
bell-boy:main

Conversation

@bell-boy
Copy link

@bell-boy bell-boy commented Dec 4, 2025

Title

Copilot AI review requested due to automatic review settings December 4, 2025 03:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new binary search test case to the Dafny verification suite, consisting of an implementation and its corresponding proof structure.

Key Changes

  • Adds binsearch function implementing binary search on sorted integer sequences
  • Adds binsearchTest method to verify the function's correctness properties
  • Adds proof lemma binsearchProof to support the verification

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
testcases/binsearch.dfy Implements the binary search function and test method with preconditions ensuring sorted sequences
proofs/binsearch.dfy Provides proof lemma structure with ensures clauses for binsearch correctness properties

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,8 @@
// Proofs for bello.dfy
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment refers to "bello.dfy" but this file contains proofs for "binsearch.dfy". The comment should be updated to reflect the correct filename.

Suggested change
// Proofs for bello.dfy
// Proofs for binsearch.dfy

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@amrina18 amrina18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a private test case for binary search (008).
Also, the private one is more comprehensive. It has the case of the item not being in the list and checks that the index found is correct for a specific item.

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.

3 participants