Created
February 10, 2015 21:06
-
-
Save tazjin/4598b0e6646fc63b29c8 to your computer and use it in GitHub Desktop.
Beautiful
This file contains hidden or 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 event query result. | |
| (UpdateEvent event, MethodState event ~ HerbertState, | |
| QueryEvent query, MethodState query ~ HerbertState, | |
| MethodResult query ~ result) | |
| => String -- ^ Test description | |
| -> HerbertState -- ^ 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