diff options
author | Yann Herklotz <git@ymhg.org> | 2019-04-02 13:05:43 +0100 |
---|---|---|
committer | Yann Herklotz <git@ymhg.org> | 2019-04-02 13:05:43 +0100 |
commit | 806afad2b802f9f86fdc88e8293cf6e9c23d8bdb (patch) | |
tree | c4c1b14235e0e4f86809fcae07c5ee8deb1a794d /src/VeriFuzz/Config.hs | |
parent | ae4497bee80efbabddea9333732f783433ff4a5a (diff) | |
download | verismith-806afad2b802f9f86fdc88e8293cf6e9c23d8bdb.tar.gz verismith-806afad2b802f9f86fdc88e8293cf6e9c23d8bdb.zip |
Add conditionals to config
Diffstat (limited to 'src/VeriFuzz/Config.hs')
-rw-r--r-- | src/VeriFuzz/Config.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/VeriFuzz/Config.hs b/src/VeriFuzz/Config.hs index eb08b1e..a5955d7 100644 --- a/src/VeriFuzz/Config.hs +++ b/src/VeriFuzz/Config.hs @@ -20,6 +20,7 @@ module VeriFuzz.Config , probNonBlock , probAssign , probAlways + , probCond , propSize , propSeed , configProbability @@ -40,6 +41,7 @@ data Probability = Probability { _probAssign :: {-# UNPACK #-} !Int , _probAlways :: {-# UNPACK #-} !Int , _probBlock :: {-# UNPACK #-} !Int , _probNonBlock :: {-# UNPACK #-} !Int + , _probCond :: {-# UNPACK #-} !Int } deriving (Eq, Show) @@ -67,7 +69,7 @@ defaultValue defaultValue x = Toml.dimap Just (fromMaybe x) . Toml.dioptional defaultConfig :: Config -defaultConfig = Config (Probability 10 1 1 1) (Property 50 Nothing) +defaultConfig = Config (Probability 10 1 5 1 1) (Property 50 Nothing) probCodec :: TomlCodec Probability probCodec = @@ -80,6 +82,8 @@ probCodec = .= _probAlways <*> defaultValue (defProb probNonBlock) (Toml.int "nonblocking") .= _probAlways + <*> defaultValue (defProb probNonBlock) (Toml.int "conditional") + .= _probCond where defProb i = defaultConfig ^. configProbability . i propCodec :: TomlCodec Property |