Skip to content

Commit 524cc64

Browse files
Changed order of arguments for proveForAll in FloatingPointFormulaManagerTest
1 parent e5a22b2 commit 524cc64

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -777,10 +777,10 @@ public void ieeeFpConversion() throws SolverException, InterruptedException {
777777
/**
778778
* Map the function over the input list and prove the returned assertions.
779779
*
780-
* @param f A function that takes values from the list and returns assertions
781780
* @param args A list of arguments to the function
781+
* @param f A function that takes values from the list and returns assertions
782782
*/
783-
private <T> void proveForAll(Function<T, BooleanFormula> f, List<T> args)
783+
private <T> void proveForAll(List<T> args, Function<T, BooleanFormula> f)
784784
throws InterruptedException, SolverException {
785785
try (ProverEnvironment prover = context.newProverEnvironment()) {
786786
for (T value : args) {
@@ -794,24 +794,24 @@ private <T> void proveForAll(Function<T, BooleanFormula> f, List<T> args)
794794
public void checkIeeeBv2FpConversion32() throws SolverException, InterruptedException {
795795
proveForAll(
796796
// makeFP(value.float) == fromBV(makeBV(value.bits))
797+
getListOfFloats(),
797798
pFloat ->
798799
fpmgr.equalWithFPSemantics(
799800
fpmgr.makeNumber(pFloat, singlePrecType),
800801
fpmgr.fromIeeeBitvector(
801-
bvmgr.makeBitvector(32, Float.floatToRawIntBits(pFloat)), singlePrecType)),
802-
getListOfFloats());
802+
bvmgr.makeBitvector(32, Float.floatToRawIntBits(pFloat)), singlePrecType)));
803803
}
804804

805805
@Test
806806
public void checkIeeeBv2FpConversion64() throws SolverException, InterruptedException {
807807
proveForAll(
808808
// makeFP(value.float) == fromBV(makeBV(value.bits))
809+
getListOfDoubles(),
809810
pDouble ->
810811
fpmgr.equalWithFPSemantics(
811812
fpmgr.makeNumber(pDouble, doublePrecType),
812813
fpmgr.fromIeeeBitvector(
813-
bvmgr.makeBitvector(64, Double.doubleToRawLongBits(pDouble)), doublePrecType)),
814-
getListOfDoubles());
814+
bvmgr.makeBitvector(64, Double.doubleToRawLongBits(pDouble)), doublePrecType)));
815815
}
816816

817817
@Test
@@ -823,11 +823,11 @@ public void checkIeeeFp2BvConversion32() throws SolverException, InterruptedExce
823823

824824
proveForAll(
825825
// makeBV(value.bits) == fromFP(makeFP(value.float))
826+
getListOfFloats(),
826827
pFloat ->
827828
bvmgr.equal(
828829
bvmgr.makeBitvector(32, Float.floatToRawIntBits(pFloat)),
829-
fpmgr.toIeeeBitvector(fpmgr.makeNumber(pFloat, singlePrecType))),
830-
getListOfFloats());
830+
fpmgr.toIeeeBitvector(fpmgr.makeNumber(pFloat, singlePrecType))));
831831
}
832832

833833
@Test
@@ -839,11 +839,11 @@ public void checkIeeeFp2BvConversion64() throws SolverException, InterruptedExce
839839

840840
proveForAll(
841841
// makeBV(value.bits) == fromFP(makeFP(value.float))
842+
getListOfFloats(),
842843
pDouble ->
843844
bvmgr.equal(
844845
bvmgr.makeBitvector(64, Double.doubleToRawLongBits(pDouble)),
845-
fpmgr.toIeeeBitvector(fpmgr.makeNumber(pDouble, doublePrecType))),
846-
getListOfFloats());
846+
fpmgr.toIeeeBitvector(fpmgr.makeNumber(pDouble, doublePrecType))));
847847
}
848848

849849
private List<Float> getListOfFloats() {
@@ -1034,6 +1034,7 @@ public void failOnInvalidString() {
10341034
@Test
10351035
public void fpFrom32BitPattern() throws SolverException, InterruptedException {
10361036
proveForAll(
1037+
getListOfFloats(),
10371038
pFloat -> {
10381039
// makeFP(value.bits.sign, value.bits.exponent, value.bits.mantissa) = makeFP(value.float)
10391040
int bits = Float.floatToRawIntBits(pFloat);
@@ -1045,14 +1046,14 @@ public void fpFrom32BitPattern() throws SolverException, InterruptedException {
10451046
BigInteger.valueOf(exponent), BigInteger.valueOf(mantissa), sign, singlePrecType);
10461047
final FloatingPointFormula fp = fpmgr.makeNumber(pFloat, singlePrecType);
10471048
return fpmgr.assignment(fpFromBv, fp);
1048-
},
1049-
getListOfFloats());
1049+
});
10501050
}
10511051

10521052
@Test
10531053
public void fpFrom64BitPattern() throws SolverException, InterruptedException {
10541054
proveForAll(
10551055
// makeFP(value.bits.sign, value.bits.exponent, value.bits.mantissa) = makeFP(value.float)
1056+
getListOfDoubles(),
10561057
pDouble -> {
10571058
long bits = Double.doubleToRawLongBits(pDouble);
10581059
long exponent = (bits >>> 52) & 0x7FF;
@@ -1063,8 +1064,7 @@ public void fpFrom64BitPattern() throws SolverException, InterruptedException {
10631064
BigInteger.valueOf(exponent), BigInteger.valueOf(mantissa), sign, doublePrecType);
10641065
final FloatingPointFormula fp = fpmgr.makeNumber(pDouble, doublePrecType);
10651066
return fpmgr.assignment(fpFromBv, fp);
1066-
},
1067-
getListOfDoubles());
1067+
});
10681068
}
10691069

10701070
@Test

0 commit comments

Comments
 (0)