advancedtelematic / quickcheck-state-machine

Test monadic programs using state machine based models
Other
203 stars 25 forks source link

remove ioProperty from tests #295

Closed kderme closed 5 years ago

kderme commented 5 years ago

Related Issue https://github.com/advancedtelematic/quickcheck-state-machine/issues/240 We use the same approach at iohk, to avoid using ioPropery for tests which need some initialization. forAllCommands needs a StateMachine, but never uses the semantics. So these semantics don't need to be initialized. What do you think?

We can see that tests now shrink:

    parallel bad, see issue #218:                                  OK
      +++ OK, failed as expected. Falsifiable (after 2 tests and 2 shrinks):
      ParallelCommands
        { prefix =
            Commands
              { unCommands =
                  [ Command
                      (In
                         "M`Yk\v<v5_:rc!% aex\930410Zh\DC1\1110845z8YP\DELW=1o\v9\920537\789089\SO\"Hqn\SUBkS\417326H~p]NS\219097\250984\&1kX\SYNv\153590\125848ijH^E\227605U8@\319153)\SUBlYhri\RS\1064709\&7`\CAN\SYN\f\216950\933519\615337\73182\&0:8J]-\882234:\DC1")
                      InAck
                      []
                  ]
              }
        , suffixes = []
        }
    parallel with shared lock:                                     OK (0.70s)
      +++ OK, failed as expected. Falsifiable (after 10 tests and 2 shrinks):
      ParallelCommands
        { prefix = Commands { unCommands = [ Command Reset ResetOk [] ] }
        , suffixes =
            [ Pair
                { proj1 =
                    Commands { unCommands = [ Command TakeTicket (GotTicket 0) [] ] }
                , proj2 =
                    Commands { unCommands = [ Command TakeTicket (GotTicket 0) [] ] }
                }
            ]
        }