Skip to content

Commit 0b474aa

Browse files
committed
add validity to fromSet testing
1 parent 93d9a4a commit 0b474aa

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
@@ -1723,7 +1723,10 @@ prop_argSet xs =
17231723
prop_fromSet :: [OrdA] -> Fun OrdA B -> Property
17241724
prop_fromSet keys funF =
17251725
let f = apply funF
1726-
in fromSet f (Set.fromList keys) === fromList (fmap (id &&& f) keys)
1726+
m = fromSet f (Set.fromList keys)
1727+
in
1728+
valid m .&&.
1729+
m === fromList (fmap (id &&& f) keys)
17271730

17281731
prop_fromSetA_action_order :: [OrdA] -> Fun OrdA B -> Property
17291732
prop_fromSetA_action_order keys funF =
@@ -1735,6 +1738,7 @@ prop_fromSetA_action_order keys funF =
17351738
in tell [v] $> v
17361739
(writtenMap, writtenOutput) = runWriter (fromSetA action set)
17371740
in
1741+
valid writtenMap .&&.
17381742
writtenOutput === List.map f setList .&&.
17391743
toList writtenMap === fmap (id &&& f) setList
17401744

0 commit comments

Comments
 (0)