input-output-hk / input-output-hk/quickcheck-dynamic

Difference between forAllQ and forAllNonVariableQ?

Open
#66 8 comments 1 reaction 0 assignees View on GitHub
Dominant language
Haskell
Stars
35
Forks
10
PR merge metrics
No merged PRs in 30d

Description

Is shrinking different? What is the difference?

Maybe this is also a bug report on shrinking behavior.

We are sometimes generating actions in `DL` like this:

```
-- seed world
forAllQ (withGenQ genSeed (const [])) >>= action_
-- init head
WorldState{hydraParties} <- getModelStateDL
forAllQ (withGenQ (genInit hydraParties) (const [])) >>= action_
```

which when failing, shrinks in a way it invalidates a pre-condition, e.g.

```
Falsified (after 1 test and 1 shrink):
do _ <- forAllQ $ exactlyQ $ Init (Party {vkey = HydraVerificationKey (VerKeyEd25519DSIGN "55517edd313790d7ac8140e12c783847fad49f9f7b242d385423db7b9ff2443d")})
-- In state: [] |- WorldState {hydraParties = [], hydraState = Start}
action $ Init (Party {vkey = HydraVerificationKey (VerKeyEd25519DSIGN "55517edd313790d7ac8140e12c783847fad49f9f7b242d385423db7b9ff2443d")}) -- Failed precondition
pure ()
```

(If I run this with max shrinks 0 it shows the actually failing model / perform).

However, when exchanging the first `forAllQ` with `forAllNonVariableQ` this does not fail on precondition when shrinking (supposedly, given the test output saying "1 test and 1 shrink").

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.