Skip to content

Commit

Permalink
expose printing of SMT scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
owestphal committed Jul 11, 2023
1 parent 39a8e6f commit f3d8d9d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Test/IOTasks/Z3.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE DeriveFunctor #-}
module Test.IOTasks.Z3 (findPathInput, satPaths, satPathsQ, isSatPath, SatResult(..), Timeout) where
module Test.IOTasks.Z3 (findPathInput, printPathScript, satPaths, satPathsQ, isSatPath, SatResult(..), Timeout) where

import Test.IOTasks.Constraints
import Test.IOTasks.ValueSet
Expand Down Expand Up @@ -46,10 +46,13 @@ data ImplicitParameters = ImplicitParameter { valueSizeParameter :: Integer, max
type Timeout = Int

findPathInput :: Timeout -> Path -> Integer -> Int -> Bool -> IO (SatResult [String])
findPathInput t p bound maxSeqLength checkOverflows = fst <$> findPathInputDebug t p bound maxSeqLength checkOverflows
findPathInput t p bound maxSeqLength checkOverflows = fst <$> evalPathScript t p bound maxSeqLength checkOverflows

findPathInputDebug :: Timeout -> Path -> Integer -> Int -> Bool -> IO (SatResult [String],String)
findPathInputDebug t p bound maxSeqLength checkOverflows = do
printPathScript :: Timeout -> Path -> Integer -> Int -> Bool -> IO String
printPathScript t p bound maxSeqLength checkOverflows = snd <$> evalPathScript t p bound maxSeqLength checkOverflows

evalPathScript :: Timeout -> Path -> Integer -> Int -> Bool -> IO (SatResult [String],String)
evalPathScript t p bound maxSeqLength checkOverflows = do
evalZ3With Nothing (stdOpts +? opt "timeout" (show t)) $ runReaderT (pathScript p WithSoft checkOverflows) implicits
where implicits = ImplicitParameter {valueSizeParameter=bound, maxSeqLengthParameter=maxSeqLength}

Expand Down

0 comments on commit f3d8d9d

Please sign in to comment.