for more information visit the package's GitHub page
Package contains the following modules:
tl;dr: Fuzz-test your update
function with random List Msg
s!
(Click on the diagram below for full size!)
To do this, you create a Msg
fuzzer (and possibly a Model
fuzzer) and plug it in test functions exposed here!
rtfeldman/test-update
with the same purpose - give it a look!No, it cannot (as of version 0.18). You will have to specify your Msg fuzzers by hand:
cancel : Fuzzer Msg
cancel =
Fuzz.constant Cancel
addCoins : Fuzzer Msg
addCoins =
Fuzz.intRange 0 Random.maxInt
|> Fuzz.map AddCoins
-- some other Msg fuzzers... and then, combine them:
allMsgs : Fuzzer Msg
allMsgs =
Fuzz.oneOf
[ cancel
, addCoins
, buy
, takeProduct
]
Right, so Fuzz.oneOf
gives all the options the same probability of being chosen. It internally uses Fuzz.frequency
, which you can use too and specify your own probabilities!
preferAdding : Fuzzer Msg
preferAdding =
Fuzz.frequency
[ (1, cancel)
, (10, addCoins)
, (1, buy)
, (1, takeProduct)
]