Skip to content

Commit

Permalink
OpenSMT test
Browse files Browse the repository at this point in the history
  • Loading branch information
LeventErkok committed Nov 28, 2023
1 parent f10712e commit 3343db0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions SBVTestSuite/SBVConnectionTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ solverName :: SMTConfig -> String
solverName = show . name . solver

main :: IO ()
main = do let allSolvers = map (\s -> (solverName s, s)) [abc, boolector, bitwuzla, cvc4, cvc5, mathSAT, yices, z3, dReal]
main = do let allSolvers = map (\s -> (solverName s, s)) [abc, boolector, bitwuzla, cvc4, cvc5, mathSAT, yices, z3, dReal, openSMT]

args <- getArgs

Expand All @@ -33,8 +33,9 @@ main = do let allSolvers = map (\s -> (solverName s, s)) [abc, boolector, bitwuz
(requiredBad, requiredPresent) = partition (\(n, _) -> n `elem` map solverName badSolvers) chosenSolvers

pickTest s = case name (solver s) of
DReal -> testI s
_ -> test s
DReal -> testI s
OpenSMT -> testO s
_ -> test s

mapM_ (pickTest . snd) requiredPresent

Expand All @@ -61,13 +62,20 @@ test s = do check s "t0" t0 not
t3 x = x*x .== (3::SWord8)
t4 x = x*3 .== (12::SWord8)

-- integer only test, for dReal mostly
-- for dreal
testI :: SMTConfig -> IO ()
testI s = do check s "t0" t0 id
check s "t1" t1 not
where t0 x = x .== (x :: SReal)
t1 x = x .== (2 :: SReal) .&& (x .== 3)

-- for openSMT
testO :: SMTConfig -> IO ()
testO s = do check s "t0" t0 id
check s "t1" t1 not
where t0 = do {setLogic QF_RDL; x <- free "x"; pure (x .== (x :: SReal))}
t1 = do {setLogic QF_RDL; x <- free "x"; pure (x .== (2 :: SReal) .&& (x .== 3))}

check :: Provable a => SMTConfig -> String -> a -> (Bool -> Bool) -> IO ()
check s m p f = isTheoremWith s p >>= decide s m f

Expand Down

0 comments on commit 3343db0

Please sign in to comment.