Package org.sosy_lab.java_smt.test
Class SolverBasedTest0
- java.lang.Object
-
- org.sosy_lab.java_smt.test.SolverBasedTest0
-
public abstract class SolverBasedTest0 extends Object
Abstract base class with helpful utilities for writing tests that use an SMT solver. It instantiates and closes the SMT solver before and after each test, and provides fields with direct access to the most relevant instances.To run the tests using all available solvers, add the following code to your class:
@Parameters(name="{0}") public static List<Object[]> getAllSolvers() { return allSolversAsParameters(); } @Parameter(0) public Solvers solver; @Override protected Solvers solverToUse() { return solver; }assertThatFormula(BooleanFormula)can be used to easily write assertions about formulas using Truth.Test that rely on a theory that not all solvers support should call one of the
requiremethods at the beginning.
-
-
Field Summary
Fields Modifier and Type Field Description protected @Nullable ArrayFormulaManageramgrprotected BooleanFormulaManagerbmgrprotected @Nullable BitvectorFormulaManagerbvmgrprotected Configurationconfigprotected SolverContextcontextprotected SolverContextFactoryfactoryprotected UFManagerfmgrprotected @Nullable FloatingPointFormulaManagerfpmgrprotected IntegerFormulaManagerimgrprotected LogManagerloggerprotected FormulaManagermgrprotected @Nullable QuantifiedFormulaManagerqmgrprotected @Nullable RationalFormulaManagerrmgrprotected ShutdownManagershutdownManager
-
Constructor Summary
Constructors Constructor Description SolverBasedTest0()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ProverEnvironmentSubjectassertThatEnvironment(BasicProverEnvironment<?> prover)Use this for checking assertions about ProverEnvironments with Truth:assertThatEnvironment(stack).is...().protected BooleanFormulaSubjectassertThatFormula(BooleanFormula formula)Use this for checking assertions about BooleanFormulas with Truth:assertThatFormula(formula).is...().voidcloseSolver()protected ConfigurationBuildercreateTestConfigBuilder()voidinitSolver()protected voidrequireArrays()Skip test if the solver does not support arrays.protected voidrequireBitvectors()Skip test if the solver does not support bitvectors.protected voidrequireBitvectorToInt()protected voidrequireFloats()protected voidrequireIntegers()Skip test if the solver does not support integers.protected voidrequireInterpolation()protected voidrequireModel()protected voidrequireOptimization()Skip test if the solver does not support optimization.protected voidrequireParser()protected voidrequireQuantifiers()Skip test if the solver does not support quantifiers.protected voidrequireRationals()Skip test if the solver does not support rationals.protected voidrequireUnsatCore()protected voidrequireVisitor()protected ShutdownNotifiershutdownNotifierToUse()protected SolverContextFactory.SolverssolverToUse()Return the solver to use in this test.
-
-
-
Field Detail
-
config
protected Configuration config
-
logger
protected final LogManager logger
-
factory
protected SolverContextFactory factory
-
context
protected SolverContext context
-
mgr
protected FormulaManager mgr
-
bmgr
protected BooleanFormulaManager bmgr
-
fmgr
protected UFManager fmgr
-
imgr
protected IntegerFormulaManager imgr
-
rmgr
protected @Nullable RationalFormulaManager rmgr
-
bvmgr
protected @Nullable BitvectorFormulaManager bvmgr
-
qmgr
protected @Nullable QuantifiedFormulaManager qmgr
-
amgr
protected @Nullable ArrayFormulaManager amgr
-
fpmgr
protected @Nullable FloatingPointFormulaManager fpmgr
-
shutdownManager
protected ShutdownManager shutdownManager
-
-
Method Detail
-
shutdownNotifierToUse
protected ShutdownNotifier shutdownNotifierToUse()
-
solverToUse
protected SolverContextFactory.Solvers solverToUse()
Return the solver to use in this test. The default is SMTInterpol because it's the only solver guaranteed on all platforms. Overwrite to specify a different solver.
-
createTestConfigBuilder
protected ConfigurationBuilder createTestConfigBuilder()
-
initSolver
public final void initSolver() throws InvalidConfigurationException- Throws:
InvalidConfigurationException
-
closeSolver
public final void closeSolver()
-
requireIntegers
protected final void requireIntegers()
Skip test if the solver does not support integers.
-
requireRationals
protected final void requireRationals()
Skip test if the solver does not support rationals.
-
requireBitvectors
protected final void requireBitvectors()
Skip test if the solver does not support bitvectors.
-
requireBitvectorToInt
protected final void requireBitvectorToInt()
-
requireQuantifiers
protected final void requireQuantifiers()
Skip test if the solver does not support quantifiers.
-
requireArrays
protected final void requireArrays()
Skip test if the solver does not support arrays.
-
requireFloats
protected final void requireFloats()
-
requireOptimization
protected final void requireOptimization()
Skip test if the solver does not support optimization.
-
requireInterpolation
protected final void requireInterpolation()
-
requireParser
protected void requireParser()
-
requireModel
protected void requireModel()
-
requireVisitor
protected void requireVisitor()
-
requireUnsatCore
protected void requireUnsatCore()
-
assertThatFormula
protected final BooleanFormulaSubject assertThatFormula(BooleanFormula formula)
Use this for checking assertions about BooleanFormulas with Truth:assertThatFormula(formula).is...().
-
assertThatEnvironment
protected final ProverEnvironmentSubject assertThatEnvironment(BasicProverEnvironment<?> prover)
Use this for checking assertions about ProverEnvironments with Truth:assertThatEnvironment(stack).is...().For new code, we suggest using
ProverEnvironmentSubject.assertThat(BasicProverEnvironment)with a static import.
-
-