Skip to content

Commit

Permalink
Add coverage check for SelectionFilter type.
Browse files Browse the repository at this point in the history
In response to review feedback:

#2431 (comment)
  • Loading branch information
jonathanknowles committed Jan 11, 2021
1 parent e992022 commit fa7983a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/core/test/unit/Cardano/Wallet/Primitive/Types/UTxOIndexSpec.hs
Expand Up @@ -132,6 +132,8 @@ spec =

parallel $ describe "Index Selection" $ do

it "prop_SelectionFilter_coverage" $
property prop_SelectionFilter_coverage
it "prop_selectRandom_empty" $
property prop_selectRandom_empty
it "prop_selectRandom_singleton" $
Expand Down Expand Up @@ -302,6 +304,21 @@ prop_insert_size i o u =
-- Index selection properties
--------------------------------------------------------------------------------

prop_SelectionFilter_coverage :: SelectionFilter -> Property
prop_SelectionFilter_coverage selectionFilter = checkCoverage $ property
$ cover 30 selectionFilterAny
"selectionFilter: Any"
$ cover 30 selectionFilterWithAsset
"selectionFilter: WithAsset"
True
where
selectionFilterAny = case selectionFilter of
Any -> True
_ -> False
selectionFilterWithAsset = case selectionFilter of
WithAsset _ -> True
_ -> False

-- | Attempt to select a random entry from an empty index.
--
-- This should always return 'Nothing'.
Expand Down

0 comments on commit fa7983a

Please sign in to comment.