Hello,
I have written a Haskell module that contains functions that operate on some state. Let's say that the code looks like this (the actual functions may return an actual result instead of `()`, but this is irrelevant to the question):
data StateContext = StateContext {
-- some records
}
handleEventA :: EventA -> State StateContext ()
handleEventB :: EventB -> State StateContext ()
handleEventC :: EventC -> State StateContext ()
As you can imagine the behavior of each function depends on the current state. For example `handleEventA >> handleEventB` will not produce the same result as `handleEventB >> handleEventA`. So I have several HUnit tests that verify the behavior of each function at several states.
But now I would like to write more tests, that exercise all functions at all possible states (the number of states is finite). Writing them with HUnit would be quite labor-itensive, so I thought that using QuickCheck might be helpful in that case (I have only used it before for trivial functions).
But I cannot see which properties should I test, or what kind of data should the test generate. I suspect that the test should generate random sequence of events (e.g. `handleEventB >> handleEventC >> handleEventA` etc), but I cannot see what properties should be satisfied.
Thanks