Skip to content

Commit a4d338f

Browse files
author
BaierD
committed
Make requireFPToBitvector() adaptive based on an exception being thrown and include FP checking
1 parent 005d6b0 commit a4d338f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/org/sosy_lab/java_smt/test/SolverBasedTest0.java

+11-4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.sosy_lab.java_smt.api.FloatingPointFormulaManager;
4040
import org.sosy_lab.java_smt.api.Formula;
4141
import org.sosy_lab.java_smt.api.FormulaManager;
42+
import org.sosy_lab.java_smt.api.FormulaType.FloatingPointType;
4243
import org.sosy_lab.java_smt.api.IntegerFormulaManager;
4344
import org.sosy_lab.java_smt.api.Model;
4445
import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula;
@@ -241,10 +242,16 @@ protected final void requireBitvectorToInt() {
241242
}
242243

243244
protected final void requireFPToBitvector() {
244-
assume()
245-
.withMessage("Solver %s does not yet support FP-to-BV conversion", solverToUse())
246-
.that(solverToUse())
247-
.isNoneOf(Solvers.CVC4, Solvers.CVC5);
245+
requireFloats();
246+
try {
247+
fpmgr.toIeeeBitvector(
248+
fpmgr.makeNumber(0, FloatingPointType.getSinglePrecisionFloatingPointType()));
249+
} catch (UnsupportedOperationException e) {
250+
assume()
251+
.withMessage("Solver %s does not yet support FP-to-BV conversion", solverToUse())
252+
.that(solverToUse())
253+
.isNull();
254+
}
248255
}
249256

250257
/** Skip test if the solver does not support quantifiers. */

0 commit comments

Comments
 (0)