Skip to content

Commit 2edf133

Browse files
committed
fix: adding quickcheck tests
1 parent 3d6c4d4 commit 2edf133

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/pure/stack.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,22 @@ mod quickcheck_tests {
995995
}
996996
}
997997

998+
#[quickcheck]
999+
fn focus_head_preserves_order(mut stack: Stack<u8>) -> bool {
1000+
let original = stack.clone().flatten();
1001+
stack.focus_head();
1002+
1003+
stack.flatten() == original
1004+
}
1005+
1006+
#[quickcheck]
1007+
fn focus_tail_preserves_order(mut stack: Stack<u8>) -> bool {
1008+
let original = stack.clone().flatten();
1009+
stack.focus_tail();
1010+
1011+
stack.flatten() == original
1012+
}
1013+
9981014
// Define a composition law for operations on a Stack.
9991015
// Using these as the real implementation is not particularly efficient but the laws should
10001016
// hold for the hand written impls as well.

0 commit comments

Comments
 (0)