Skip to content

Commit

Permalink
Shorten SQL golden test names
Browse files Browse the repository at this point in the history
  • Loading branch information
jhbertra committed Sep 27, 2023
1 parent b9d7e09 commit 8d771bf
Show file tree
Hide file tree
Showing 113 changed files with 135 additions and 135 deletions.
220 changes: 110 additions & 110 deletions marlowe-runtime/marlowe-runtime.cabal

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ modificationsToContractFilterAndRange = foldr modifyContractFilterAndRange defau
modifyContractFilterAndRange
:: QueryModifications -> (ContractFilter, Range ContractId) -> (ContractFilter, Range ContractId)
modifyContractFilterAndRange = \case
SpecifyRolesCurrency -> first \cFilter -> cFilter{roleCurrencies = Set.singleton ""}
SpecifyTag -> first \cFilter -> cFilter{tags = Set.singleton $ MarloweMetadataTag ""}
SpecifyPartyRole -> first \cFilter -> cFilter{partyRoles = Set.singleton $ AssetId "" ""}
SpecifyPartyAddress -> first \cFilter -> cFilter{partyAddresses = Set.singleton $ Address ""}
SetRangeStart -> fmap \range -> range{rangeStart = Just "#2"}
SetRangeAscending -> fmap \range -> range{rangeDirection = Ascending}
RolesCurrency -> first \cFilter -> cFilter{roleCurrencies = Set.singleton ""}
Tag -> first \cFilter -> cFilter{tags = Set.singleton $ MarloweMetadataTag ""}
PartyRole -> first \cFilter -> cFilter{partyRoles = Set.singleton $ AssetId "" ""}
PartyAddress -> first \cFilter -> cFilter{partyAddresses = Set.singleton $ Address ""}
RangeStart -> fmap \range -> range{rangeStart = Just "#2"}
RangeAscending -> fmap \range -> range{rangeDirection = Ascending}

defaultContractAndRange :: (ContractFilter, Range ContractId)
defaultContractAndRange =
Expand All @@ -55,10 +55,10 @@ defaultContractAndRange =
)

data QueryModifications
= SpecifyRolesCurrency
| SpecifyTag
| SpecifyPartyRole
| SpecifyPartyAddress
| SetRangeStart
| SetRangeAscending
= RolesCurrency
| Tag
| PartyRole
| PartyAddress
| RangeStart
| RangeAscending
deriving (Eq, Show, Ord, Enum, Bounded)
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ showStatement :: String -> Statement a b -> String
showStatement title (Statement sql _ _ _) = title <> ": " <> T.unpack (decodeUtf8 sql)

removeDuplicateWithdrawnSets :: Set QueryModifications -> Bool
removeDuplicateWithdrawnSets mods = not $ Set.member SetIsWithdrawnFalse mods && Set.member SetIsWithdrawnTrue mods
removeDuplicateWithdrawnSets mods = not $ Set.member Available mods && Set.member Withdrawn mods

modificationsToPayoutFilterAndRange :: Set QueryModifications -> (PayoutFilter, Range TxOutRef)
modificationsToPayoutFilterAndRange = foldr modifyPayoutFilterAndRange defaultPayoutAndRange

modifyPayoutFilterAndRange :: QueryModifications -> (PayoutFilter, Range TxOutRef) -> (PayoutFilter, Range TxOutRef)
modifyPayoutFilterAndRange = \case
SetIsWithdrawnFalse -> first \pFilter -> pFilter{isWithdrawn = Just False}
SetIsWithdrawnTrue -> first \pFilter -> pFilter{isWithdrawn = Just True}
SpecifyContractId -> first \pFilter -> pFilter{contractIds = Set.singleton "#1"}
SpecifyRoleToken -> first \pFilter -> pFilter{roleTokens = Set.singleton $ AssetId "" ""}
SetRangeStart -> fmap \range -> range{rangeStart = Just "#2"}
SetRangeAscending -> fmap \range -> range{rangeDirection = Ascending}
Available -> first \pFilter -> pFilter{isWithdrawn = Just False}
Withdrawn -> first \pFilter -> pFilter{isWithdrawn = Just True}
ContractId -> first \pFilter -> pFilter{contractIds = Set.singleton "#1"}
RoleToken -> first \pFilter -> pFilter{roleTokens = Set.singleton $ AssetId "" ""}
RangeStart -> fmap \range -> range{rangeStart = Just "#2"}
RangeAscending -> fmap \range -> range{rangeDirection = Ascending}

defaultPayoutAndRange :: (PayoutFilter, Range TxOutRef)
defaultPayoutAndRange =
Expand All @@ -56,10 +56,10 @@ defaultPayoutAndRange =
)

data QueryModifications
= SetIsWithdrawnFalse
| SetIsWithdrawnTrue
| SpecifyContractId
| SpecifyRoleToken
| SetRangeStart
| SetRangeAscending
= Available
| Withdrawn
| ContractId
| RoleToken
| RangeStart
| RangeAscending
deriving (Eq, Show, Ord, Enum, Bounded)

0 comments on commit 8d771bf

Please sign in to comment.