Fix predicate typo that disabled five bisimulation operations - #182
Open
matthiasgoergens wants to merge 1 commit into
Open
Fix predicate typo that disabled five bisimulation operations#182matthiasgoergens wants to merge 1 commit into
matthiasgoergens wants to merge 1 commit into
Conversation
test_doubly_linked_bisimulation.ml's [pred] used [n mod 0] rather than [n mod 2]. In OCaml [n mod 0] raises Division_by_zero for every [n], so the predicate raised on any input. Five operations pass that predicate in: Exists, Filter_inplace, For_all, Find_elt and Find. On a non-empty list both the real Doubly_linked and the Foil reference raised identically, so [force] took its [Error _, Error _ -> raise Both_raised] branch and the step was discarded by [Both_raised | Skip -> ()] at the bottom of the loop. Those five operations therefore ran, blew up on both sides, and were silently skipped rather than compared. Signed-off-by: Matthias Goergens <matthias.goergens@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
core/test/test_doubly_linked_bisimulation.mldefines its test predicate as:n mod 0raisesDivision_by_zerofor everyn. It looks like a typo forn mod 2.Five operations take that predicate —
Exists,Filter_inplace,For_all,Find_eltandFind. On a non-empty list bothDoubly_linkedand theFoilreference raise, and the simulation loop treats a mutual raise as agreement, so the step is skipped rather than compared. On an empty list the predicate is never reached and they pass trivially. Either way, those five operations have not been testing anything.How it was found
While surveying hand-written bisimulation tests in OCaml, as background for tapecheck, a port of Hypothesis's choice-tape shrinking engine to
base_quickcheck. The pattern being looked for was tests that silently narrow what they can detect.Happy to drop this if the predicate was deliberate for some reason I have missed.