diff options
author | Yann Herklotz <git@ymhg.org> | 2019-04-24 11:30:24 +0100 |
---|---|---|
committer | Yann Herklotz <git@ymhg.org> | 2019-04-24 11:30:24 +0100 |
commit | e116c73bc75188db5cae0cda3f5251c0f69b822b (patch) | |
tree | a96598abafdf896fbf23d4eb45761b99f6f03560 /src/VeriFuzz/Fuzz.hs | |
parent | 9c96914d48e798294e20ccd863fdb25fde1c39b9 (diff) | |
download | verismith-e116c73bc75188db5cae0cda3f5251c0f69b822b.tar.gz verismith-e116c73bc75188db5cae0cda3f5251c0f69b822b.zip |
Add time and date by default
Diffstat (limited to 'src/VeriFuzz/Fuzz.hs')
-rw-r--r-- | src/VeriFuzz/Fuzz.hs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/VeriFuzz/Fuzz.hs b/src/VeriFuzz/Fuzz.hs index dd3bfd4..c0e6117 100644 --- a/src/VeriFuzz/Fuzz.hs +++ b/src/VeriFuzz/Fuzz.hs @@ -34,6 +34,7 @@ import Control.Monad.Trans.State.Strict import Data.ByteString (ByteString) import Data.List (nubBy) import Data.Text (Text) +import qualified Data.Text as T import Data.Time import Hedgehog (Gen) import qualified Hedgehog.Gen as Hog @@ -165,9 +166,22 @@ fuzzInDir fp src = do pop fp $ fuzz src fuzzMultiple - :: MonadFuzz m => Int -> FilePath -> Gen SourceInfo -> Fuzz m FuzzReport + :: MonadFuzz m + => Int + -> (Maybe FilePath) + -> Gen SourceInfo + -> Fuzz m FuzzReport fuzzMultiple n fp src = do - make fp - void . pop fp $ forM [1 .. n] fuzzDir + x <- case fp of + Nothing -> do + ct <- liftIO getZonedTime + return + . fromText + . T.pack + $ "output_" + <> formatTime defaultTimeLocale "%Y-%m-%d_%H-%M-%S" ct + Just f -> return f + make x + void . pop x $ forM [1 .. n] fuzzDir return mempty where fuzzDir n' = fuzzInDir (fromText $ "fuzz_" <> showT n') src |