Skip to content

Commit

Permalink
Strengthen coverage check for prop_spendTx_balance_inequality.
Browse files Browse the repository at this point in the history
What we really want here is to capture the notion of "strictly less
than", but `leq` gives us "less than OR equal". We can't use `<=`, as
token maps are only partially ordered. So we have to use a combination
of `leq` and `/=`.

In response to review comment:

https://github.com/input-output-hk/cardano-wallet/pull/2867/files#r701595441
  • Loading branch information
jonathanknowles committed Sep 3, 2021
1 parent 25d9b6f commit ff9ef8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/core/test/unit/Cardano/Wallet/Primitive/ModelSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1490,8 +1490,8 @@ prop_spendTx_balance_inequality :: Tx -> UTxO -> Property
prop_spendTx_balance_inequality tx u =
checkCoverage $
cover 10
(lhs /= mempty && lhs `leq` rhs)
"lhs /= mempty && lhs `leq` rhs" $
(lhs /= mempty && lhs `leq` rhs && lhs /= rhs)
"lhs /= mempty && lhs `leq` rhs && lhs /= rhs" $
isJust (rhs `TokenBundle.subtract` lhs)
& counterexample ("balance (spendTx tx u) = " <> show lhs)
& counterexample ("balance u = " <> show rhs)
Expand Down

0 comments on commit ff9ef8a

Please sign in to comment.