Skip to content

Commit

Permalink
crux-llvm: Simplify pattern-matching in test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGlScott committed Aug 2, 2024
1 parent 4f37cc6 commit 8452889
Showing 1 changed file with 18 additions and 29 deletions.
47 changes: 18 additions & 29 deletions crux-llvm/test/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -142,70 +142,59 @@ getZ3Version :: IO VersionCheck
getZ3Version =
let getVer (Right inp) =
-- example inp: "Z3 version 4.8.7 - 64 bit"
let w = words inp
in if | ("Z3":_:verNum:_) <- w
-> verNum
| otherwise
-> "?"
case words inp of
"Z3":_:verNum:_ -> verNum
_ -> "?"
getVer (Left full) = full
in mkVC "z3" . getVer <$> readProcessVersion "z3"

getYicesVersion :: IO VersionCheck
getYicesVersion =
let getVer (Right inp) =
-- example inp: "Yices 2.6.1\nCopyright ..."
let w = words inp
in if | ("Yices":verNum:_) <- w
-> verNum
| otherwise
-> "?"
case words inp of
"Yices":verNum:_ -> verNum
_ -> "?"
getVer (Left full) = full
in mkVC "yices" . getVer <$> readProcessVersion "yices"

getSTPVersion :: IO VersionCheck
getSTPVersion =
let getVer (Right inp) =
-- example inp: "STP version 2.3.3\n..."
let w = words inp
in if | ("STP":"version":verNum:_) <- w
-> verNum
| otherwise
-> "?"
case words inp of
"STP":"version":verNum:_ -> verNum
_ -> "?"
getVer (Left full) = full
in mkVC "stp" . getVer <$> readProcessVersion "stp"

getCVC4Version :: IO VersionCheck
getCVC4Version =
let getVer (Right inp) =
-- example inp: "This is CVC4 version 1.8\ncompiled ..."
let w = words inp
in if | ("This":"is":"CVC4":"version":verNum:_) <- w
-> verNum
| otherwise
-> "?"
case words inp of
"This":"is":"CVC4":"version":verNum:_ -> verNum
_ -> "?"
getVer (Left full) = full
in mkVC "cvc4" . getVer <$> readProcessVersion "cvc4"

getCVC5Version :: IO VersionCheck
getCVC5Version =
let getVer (Right inp) =
-- example inp: "This is cvc5 version 1.0.2\ncompiled ..."
let w = words inp
in if | ("This":"is":"cvc5":"version":verNum:_) <- w
-> verNum
| otherwise
-> "?"
case words inp of
"This":"is":"cvc5":"version":verNum:_ -> verNum
_ -> "?"
getVer (Left full) = full
in mkVC "cvc5" . getVer <$> readProcessVersion "cvc5"

getBoolectorVersion :: IO VersionCheck
getBoolectorVersion =
let getVer (Right inp) =
-- example inp: "3.2.1"
let w = words inp
in case w of
verNum:_ -> verNum
[] -> "?"
case words inp of
verNum:_ -> verNum
[] -> "?"
getVer (Left full) = full
in mkVC "boolector" . getVer <$> readProcessVersion "boolector"

Expand Down

0 comments on commit 8452889

Please sign in to comment.