Created
August 7, 2018 10:53
-
-
Save tazjin/05436eff4f0238a47a7c239c9f360a9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | Test something with an in-memory acid-state | |
acidTest :: forall state event query result. | |
(IsAcidic state, UpdateEvent event, MethodState event ~ state, | |
QueryEvent query, MethodState query ~ state, | |
MethodResult query ~ result) | |
=> String -- ^ Test description | |
-> state -- ^ Initial state for test | |
-> event -- ^ Event to test | |
-> query -- ^ Query to check | |
-> (result -> Bool) -- ^ Function to test query result | |
-> Assertion | |
acidTest desc initialState event query' checker = do | |
state <- openMemoryState initialState | |
update state event | |
result <- query state query' | |
assertBool desc $ checker result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment