Safe Haskell | None |
---|
Interpreter for Boogie 2
- executeProgramDet :: Program -> Context -> Maybe Integer -> Id -> TestCase
- executeProgram :: Program -> Context -> Generator Stream -> Maybe Integer -> Id -> [TestCase]
- executeProgramGeneric :: (Monad m, Functor m) => Program -> Context -> Generator m -> Maybe Integer -> Id -> m TestCase
- data FailureSource
- = SpecViolation SpecClause
- | DivisionByZero
- | UnsupportedConstruct String
- | InfiniteDomain Id Interval
- | MapEquality Value Value
- | InternalException InternalCode
- data StackFrame = StackFrame {}
- type StackTrace = [StackFrame]
- data RuntimeFailure = RuntimeFailure {}
- runtimeFailureDoc :: Bool -> RuntimeFailure -> Doc
- data FailureKind
- = Error
- | Unreachable
- | Nonexecutable
- failureKind :: RuntimeFailure -> FailureKind
- data TestCase = TestCase {}
- isPass :: TestCase -> Bool
- isInvalid :: TestCase -> Bool
- isNonexecutable :: TestCase -> Bool
- isFail :: TestCase -> Bool
- testCaseSummary :: Bool -> TestCase -> Doc
- finalStateDoc :: Bool -> TestCase -> Doc
- data Summary = Summary {
- sPassCount :: Int
- sFailCount :: Int
- sInvalidCount :: Int
- sNonExecutableCount :: Int
- sUniqueFailures :: [TestCase]
- testSessionSummary :: [TestCase] -> Summary
- summaryDoc :: Summary -> Doc
- eval :: (Monad m, Functor m) => Expression -> Execution m Value
- exec :: (Monad m, Functor m) => Statement -> Execution m ()
- execProcedure :: (Monad m, Functor m) => PSig -> PDef -> [Expression] -> [Expression] -> Execution m [Value]
- preprocess :: (Monad m, Functor m) => Program -> SafeExecution m ()
Executing programs
executeProgramDet :: Program -> Context -> Maybe Integer -> Id -> TestCaseSource
executeProgramDet
p tc entryPoint
:
Execute program p
deterministically in type context tc
starting from procedure entryPoint
and return a single outcome.
Whenever a value is unspecified, a default value of the required type is used.
executeProgram :: Program -> Context -> Generator Stream -> Maybe Integer -> Id -> [TestCase]Source
executeProgram
p tc entryPoint
:
Execute program p
non-deterministically in type context tc
starting from procedure entryPoint
and return an infinite list of possible outcomes (each either runtime failure or the final variable store).
Whenever a value is unspecified, all values of the required type are tried exhaustively.
executeProgramGeneric :: (Monad m, Functor m) => Program -> Context -> Generator m -> Maybe Integer -> Id -> m TestCaseSource
executeProgramGeneric
p tc generator qbound entryPoint
:
Execute program p
in type context tc
with input generator generator
, starting from procedure entryPoint
,
and return the outcome(s) embedded into the generator's monad.
Run-time failures
data FailureSource Source
SpecViolation SpecClause | Violation of user-defined specification |
DivisionByZero | Division by zero |
UnsupportedConstruct String | Language construct is not yet supported (should disappear in later versions) |
InfiniteDomain Id Interval | Quantification over an infinite set |
MapEquality Value Value | Equality of two maps cannot be determined |
InternalException InternalCode | Must be cought inside the interpreter and never reach the user |
type StackTrace = [StackFrame]Source
data RuntimeFailure Source
Failures that occur during execution
RuntimeFailure | |
|
runtimeFailureDoc :: Bool -> RuntimeFailure -> DocSource
Pretty-printed run-time failure
data FailureKind Source
Kinds of run-time failures
Error | Error state reached (assertion violation) |
Unreachable | Unreachable state reached (assumption violation) |
Nonexecutable | The state is OK in Boogie semantics, but the execution cannot continue due to the limitations of the interpreter |
failureKind :: RuntimeFailure -> FailureKindSource
Kind of a run-time failure
Execution outcomes
Description of an execution
TestCase | |
|
isNonexecutable :: TestCase -> BoolSource
isNonexecutable
tc
: Does tc
end in a non-executable state?
testCaseSummary :: Bool -> TestCase -> DocSource
testCaseSummary
debug tc
: Summary of tc
's inputs and outcome,
displayed in user or debug format depending on debug
finalStateDoc :: Bool -> TestCase -> DocSource
finalStateDoc
debug tc
: outputs of tc
,
displayed in user or debug format depending on debug
Test session summary
Summary | |
|
testSessionSummary :: [TestCase] -> SummarySource
Summary of a set of test cases
summaryDoc :: Summary -> DocSource
Pretty-printed test session summary
Executing parts of programs
eval :: (Monad m, Functor m) => Expression -> Execution m ValueSource
Evaluate an expression; can have a side-effect of initializing variables that were not previously defined
exec :: (Monad m, Functor m) => Statement -> Execution m ()Source
Execute a basic statement (no jump, if or while statements allowed)
execProcedure :: (Monad m, Functor m) => PSig -> PDef -> [Expression] -> [Expression] -> Execution m [Value]Source
execProcedure
sig def args lhss
:
Execute definition def
of procedure sig
with actual arguments args
and call left-hand sides lhss
preprocess :: (Monad m, Functor m) => Program -> SafeExecution m ()Source
Collect procedure implementations, and constantfunctionglobal variable constraints