Skip to content

Commit

Permalink
Reduce long execution time of prop_tx_utxo_coverage.
Browse files Browse the repository at this point in the history
By conservatively reducing coverage expectations, this change reduces
the overall run time from around 20 seconds to around 1 second.
  • Loading branch information
jonathanknowles committed Sep 3, 2021
1 parent 804037c commit 25d9b6f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/core/test/unit/Cardano/Wallet/Primitive/ModelSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1400,16 +1400,22 @@ blockchain =
prop_tx_utxo_coverage :: Tx -> UTxO -> Property
prop_tx_utxo_coverage tx u =
checkCoverage $
cover 5 (UTxO.null u) "UTxO empty" $
cover 30 (not $ UTxO.null u) "UTxO not empty" $
cover 2 (UTxO.null u)
"UTxO empty" $
cover 30 (not $ UTxO.null u)
"UTxO not empty" $
cover 30 (not $ Set.disjoint (dom u) (Set.fromList $ inputs tx))
"UTxO and Tx not disjoint" $
cover 10 (Set.disjoint (dom u) (Set.fromList $ inputs tx))
"UTxO and Tx disjoint" $
cover 10 (length (inputs tx) > 3) "Number of tx inputs > 3" $
cover 10 (length (inputs tx) < 3) "Number of tx inputs < 3" $
cover 10 (length (outputs tx) > 3) "Number of tx outputs > 3" $
cover 10 (length (outputs tx) < 3) "Number of tx outputs < 3" $
cover 4 (length (inputs tx) > 3)
"Number of tx inputs > 3" $
cover 4 (length (inputs tx) < 3)
"Number of tx inputs < 3" $
cover 4 (length (outputs tx) > 3)
"Number of tx outputs > 3" $
cover 4 (length (outputs tx) < 3)
"Number of tx outputs < 3" $
property True

prop_applyTxToUTxO_balance :: Tx -> UTxO -> Property
Expand Down

0 comments on commit 25d9b6f

Please sign in to comment.