Skip to content

Commit

Permalink
fix: adding quickcheck tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sminez committed Oct 23, 2024
1 parent 3d6c4d4 commit 2edf133
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/pure/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,22 @@ mod quickcheck_tests {
}
}

#[quickcheck]
fn focus_head_preserves_order(mut stack: Stack<u8>) -> bool {
let original = stack.clone().flatten();
stack.focus_head();

stack.flatten() == original
}

#[quickcheck]
fn focus_tail_preserves_order(mut stack: Stack<u8>) -> bool {
let original = stack.clone().flatten();
stack.focus_tail();

stack.flatten() == original
}

// Define a composition law for operations on a Stack.
// Using these as the real implementation is not particularly efficient but the laws should
// hold for the hand written impls as well.
Expand Down

0 comments on commit 2edf133

Please # to comment.