Skip to content

Commit

Permalink
Add pending test related to distributive property of toRealUTxO
Browse files Browse the repository at this point in the history
  • Loading branch information
v0d1ch committed Feb 12, 2024
1 parent d05a1a8 commit 88fee05
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions hydra-node/test/Hydra/ModelSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ import Test.QuickCheck.DynamicLogic (
)
import Test.QuickCheck.Gen.Unsafe (Capture (Capture), capture)
import Test.QuickCheck.Monadic (PropertyM, assert, monadic', monitor, run)
import Test.QuickCheck.Property ((===))
import Test.QuickCheck.StateModel (
ActionWithPolarity (..),
Actions,
Expand All @@ -166,7 +167,7 @@ import Test.QuickCheck.StateModel (
stateAfter,
pattern Actions,
)
import Test.Util (printTrace, traceDebug, traceInIOSim)
import Test.Util (printTrace, traceInIOSim)

spec :: Spec
spec = do
Expand All @@ -178,6 +179,14 @@ spec = do
prop "check conflict-free liveness" prop_checkConflictFreeLiveness
prop "check head opens if all participants commit" prop_checkHeadOpensIfAllPartiesCommit
prop "fanout contains whole confirmed UTxO" prop_fanoutContainsWholeConfirmedUTxO
-- FIXME: implement toRealUTxO correctly so the distributive property holds
xprop "realUTxO is distributive" $ propIsDistributive Model.toRealUTxO

propIsDistributive :: (Show b, Eq b, Semigroup b) => ([a] -> b) -> [a] -> [a] -> Property
propIsDistributive fn as bs =
fn as <> fn bs === fn (as <> bs)
& counterexample ("fn (as <> bs) " <> show (fn (as <> bs)))
& counterexample ("fn as <> fn bs: " <> show (fn as <> fn bs))

prop_fanoutContainsWholeConfirmedUTxO :: Property
prop_fanoutContainsWholeConfirmedUTxO =
Expand Down Expand Up @@ -379,7 +388,7 @@ runIOSimProp p = do
nodes =
Nodes
{ nodes = mempty
, logger = traceInIOSim <> traceDebug
, logger = traceInIOSim
, threads = mempty
, chain = dummySimulatedChainNetwork
}
Expand Down

0 comments on commit 88fee05

Please sign in to comment.