From 806afad2b802f9f86fdc88e8293cf6e9c23d8bdb Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Tue, 2 Apr 2019 13:05:43 +0100 Subject: Add conditionals to config --- src/VeriFuzz/Config.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/VeriFuzz/Config.hs') 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 -- cgit