aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYann Herklotz <git@ymhg.org>2019-05-13 15:28:21 +0100
committerYann Herklotz <git@ymhg.org>2019-05-13 15:28:21 +0100
commit0e0dd6ee036c333cd3026917e696cf37996af341 (patch)
tree3b6e3570f72a5c111db8f8f6ce3430a9cf4de1f3 /src
parentf984a79a85b4cc5a077fbf0f7ae6ac52a51822e8 (diff)
downloadverismith-0e0dd6ee036c333cd3026917e696cf37996af341.tar.gz
verismith-0e0dd6ee036c333cd3026917e696cf37996af341.zip
Add NonEmpty to tests
Diffstat (limited to 'src')
-rw-r--r--src/VeriFuzz.hs5
-rw-r--r--src/VeriFuzz/Reduce.hs3
-rw-r--r--src/VeriFuzz/Sim/Identity.hs3
3 files changed, 5 insertions, 6 deletions
diff --git a/src/VeriFuzz.hs b/src/VeriFuzz.hs
index 0d749db..054db72 100644
--- a/src/VeriFuzz.hs
+++ b/src/VeriFuzz.hs
@@ -29,6 +29,7 @@ where
import Control.Concurrent
import Control.Lens
+import Control.Monad.IO.Class (liftIO)
import qualified Crypto.Random.DRBG as C
import Data.ByteString (ByteString)
import Data.ByteString.Builder (byteStringHex, toLazyByteString)
@@ -333,7 +334,7 @@ handleOpts (Parse f) = do
Left l -> print l
Right v -> print $ GenVerilog v
where file = T.unpack . toTextIgnore $ f
-handleOpts (Reduce f t s) = reduceWithScript t s f
+handleOpts (Reduce f t s) = shelly $ reduceWithScript t s f
handleOpts (ConfigOpt c conf r) = do
config <- if r then getConfig conf >>= randomise else getConfig conf
maybe (T.putStrLn . encodeConfig $ config)
@@ -458,4 +459,4 @@ runEquivalence seed gm t d k i = do
where n = t <> "_" <> T.pack (show i)
runReduce :: SourceInfo -> IO SourceInfo
-runReduce s = reduce (\s' -> not <$> checkEquivalence s' "reduce") s
+runReduce s = shelly $ reduce (\s' -> not <$> liftIO (checkEquivalence s' "reduce")) s
diff --git a/src/VeriFuzz/Reduce.hs b/src/VeriFuzz/Reduce.hs
index 79a46ba..2bf5a78 100644
--- a/src/VeriFuzz/Reduce.hs
+++ b/src/VeriFuzz/Reduce.hs
@@ -16,6 +16,7 @@ Test case reducer implementation.
module VeriFuzz.Reduce
( -- $strategy
reduceWithScript
+ , reduceSynth
, reduce
, reduce_
, Replacement(..)
@@ -36,8 +37,6 @@ import Data.List.NonEmpty (NonEmpty (..))
import qualified Data.List.NonEmpty as NonEmpty
import Data.Maybe (mapMaybe)
import Data.Text (Text)
-import qualified Data.Text as T
-import qualified Data.Text.IO as T
import Shelly ((<.>))
import qualified Shelly
import Shelly.Lifted (MonadSh, liftSh)
diff --git a/src/VeriFuzz/Sim/Identity.hs b/src/VeriFuzz/Sim/Identity.hs
index 1b88032..bfded0b 100644
--- a/src/VeriFuzz/Sim/Identity.hs
+++ b/src/VeriFuzz/Sim/Identity.hs
@@ -45,8 +45,7 @@ instance NFData Identity where
rnf = rwhnf
runSynthIdentity :: Identity -> SourceInfo -> ResultSh ()
-runSynthIdentity (Identity _ out) src =
- writefile out $ genSource src
+runSynthIdentity (Identity _ out) = writefile out . genSource
defaultIdentity :: Identity
defaultIdentity = Identity "identity" "syn_identity.v"