Skip to content

Commit 4b9f984

Browse files
committed
add validity to fromSet testing
1 parent bff17cf commit 4b9f984

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

containers-tests/tests/intmap-properties.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1701,7 +1701,10 @@ prop_keysSet keys =
17011701
prop_fromSet :: [Int] -> Fun Int A -> Property
17021702
prop_fromSet keys funF =
17031703
let f = apply funF
1704-
in fromSet f (IntSet.fromList keys) === fromList (fmap (id &&& f) keys)
1704+
m = fromSet f (IntSet.fromList keys)
1705+
in
1706+
valid m .&&.
1707+
m === fromList (fmap (id &&& f) keys)
17051708

17061709
prop_fromSetA_action_order :: [Int] -> Fun Int A -> Property
17071710
prop_fromSetA_action_order keys funF =
@@ -1713,6 +1716,7 @@ prop_fromSetA_action_order keys funF =
17131716
in tell [v] $> v
17141717
(writtenMap, writtenOutput) = runWriter (fromSetA action set)
17151718
in
1719+
valid writtenMap .&&.
17161720
writtenOutput === List.map f setList .&&.
17171721
toList writtenMap === fmap (id &&& f) setList
17181722

containers-tests/tests/map-properties.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,10 @@ prop_argSet xs =
16951695
prop_fromSet :: [OrdA] -> Fun OrdA B -> Property
16961696
prop_fromSet keys funF =
16971697
let f = apply funF
1698-
in fromSet f (Set.fromList keys) === fromList (fmap (id &&& f) keys)
1698+
m = fromSet f (Set.fromList keys)
1699+
in
1700+
valid m .&&.
1701+
m === fromList (fmap (id &&& f) keys)
16991702

17001703
prop_fromSetA_action_order :: [OrdA] -> Fun OrdA B -> Property
17011704
prop_fromSetA_action_order keys funF =
@@ -1707,6 +1710,7 @@ prop_fromSetA_action_order keys funF =
17071710
in tell [v] $> v
17081711
(writtenMap, writtenOutput) = runWriter (fromSetA action set)
17091712
in
1713+
valid writtenMap .&&.
17101714
writtenOutput === List.map f setList .&&.
17111715
toList writtenMap === fmap (id &&& f) setList
17121716

0 commit comments

Comments
 (0)