Skip to content
Snippets Groups Projects
Commit 8eccaf54 authored by Daniel Plagge's avatar Daniel Plagge
Browse files

Added a flag that shows if a theory was used

parent d6d36b0f
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,8 @@ public class TranslationVisitor implements ISimpleVisitor { ...@@ -49,6 +49,8 @@ public class TranslationVisitor implements ISimpleVisitor {
private LookupStack<PSubstitution> substitutions = new LookupStack<PSubstitution>(); private LookupStack<PSubstitution> substitutions = new LookupStack<PSubstitution>();
private LookupStack<String> boundVariables = new LookupStack<String>(); private LookupStack<String> boundVariables = new LookupStack<String>();
private boolean usesTheories = false;
public void visitAssociativeExpression( public void visitAssociativeExpression(
final AssociativeExpression expression) { final AssociativeExpression expression) {
// BUNION, BINTER, BCOMP, FCOMP, OVR, PLUS, MUL // BUNION, BINTER, BCOMP, FCOMP, OVR, PLUS, MUL
...@@ -602,6 +604,7 @@ public class TranslationVisitor implements ISimpleVisitor { ...@@ -602,6 +604,7 @@ public class TranslationVisitor implements ISimpleVisitor {
.getChildPredicates()); .getChildPredicates());
expressions.push(new AExtendedExprExpression(new TIdentifierLiteral( expressions.push(new AExtendedExprExpression(new TIdentifierLiteral(
symbol), childExprs, childPreds)); symbol), childExprs, childPreds));
usesTheories = true;
} }
@Override @Override
...@@ -613,6 +616,7 @@ public class TranslationVisitor implements ISimpleVisitor { ...@@ -613,6 +616,7 @@ public class TranslationVisitor implements ISimpleVisitor {
.getChildPredicates()); .getChildPredicates());
predicates.push(new AExtendedPredPredicate(new TIdentifierLiteral( predicates.push(new AExtendedPredPredicate(new TIdentifierLiteral(
symbol), childExprs, childPreds)); symbol), childExprs, childPreds));
usesTheories = true;
} }
private List<PExpression> getSubExpressions(final Formula<?>[] children) { private List<PExpression> getSubExpressions(final Formula<?>[] children) {
...@@ -701,14 +705,20 @@ public class TranslationVisitor implements ISimpleVisitor { ...@@ -701,14 +705,20 @@ public class TranslationVisitor implements ISimpleVisitor {
} }
} }
public static void checkNewImplementation(Predicate p, PPredicate predicate) { public static boolean checkNewImplementation(Formula<?> p,
Node oldImplementation) {
TranslationVisitor visitor = new TranslationVisitor(); TranslationVisitor visitor = new TranslationVisitor();
p.accept(visitor); p.accept(visitor);
final String expected = predicate.toString(); final String expected = oldImplementation.toString();
final String actual = visitor.getPredicate().toString(); final String actual = visitor.getPredicate().toString();
if (!expected.equals(actual)) { if (!expected.equals(actual)) {
throw new AssertionError("Expected:\n" + expected + "\n but was:\n" throw new AssertionError("Expected:\n" + expected + "\n but was:\n"
+ actual); + actual);
} }
return visitor.usesTheories;
}
public boolean usesTheories() {
return usesTheories;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment