use of com.rockwellcollins.atc.tcg.obligations.ufc.Obligation in project AGREE by loonwerks.
the class GenerateUfcObligationsVisitor method constructNewNode.
/**
* Method for constructing new programs using the UFC obligations.
*/
private Node constructNewNode(Node existing, ObligationSet obs) {
List<VarDecl> locals = new ArrayList<>(existing.locals);
List<Equation> equations = new ArrayList<>(existing.equations);
// List<String> properties = new ArrayList<>(existing.properties);
// Change: MWW 5/6: Don't really want existing properties here.
List<String> properties = new ArrayList<>();
/* writing the TCG obligations back as trap properties by negating them... */
for (int i = 0; i < obs.positivePolarity.size(); i++) {
String varName = TRAP_PROP_PREFIX + i;
Obligation ob = obs.positivePolarity.get(i);
locals.add(new VarDecl(varName, NamedType.BOOL));
equations.add(new Equation(new IdExpr(varName), new UnaryExpr(UnaryOp.NOT, ob.getObligationExpr())));
properties.add(varName);
// renaming information
if (renaming != null) {
renaming.addRenaming(varName, ob.getEqAssignId(), ob.getTestedCondition().toString(), new HashSet<Obligation>(Arrays.asList(ob)));
}
System.out.println("Renaming: mapping " + varName + " --> " + ob.getEqAssignId());
}
Node newNode = new Node(existing.id, existing.inputs, existing.outputs, locals, equations, properties, existing.assertions, null, null, new ArrayList<String>());
return newNode;
}
use of com.rockwellcollins.atc.tcg.obligations.ufc.Obligation in project AGREE by loonwerks.
the class TestSuiteUtils method testSuiteFromJKindResult.
public static TestSuite testSuiteFromJKindResult(JKindResult result, String implUnderTest, String name, String description, TcgRenaming tcgRenaming) {
List<TestCase> tests = new ArrayList<>();
for (PropertyResult pr : result.getPropertyResults()) {
if (pr.getProperty() instanceof InvalidProperty) {
InvalidProperty invalidProp = (InvalidProperty) pr.getProperty();
Set<Obligation> satisfiedObligations = tcgRenaming.statisfiedObligations(pr.getName());
tests.add(new TestCase(pr.getName(), "", invalidProp.getCounterexample(), satisfiedObligations));
}
}
return new TestSuite(implUnderTest, name, description, tests, TestSuite.State.INSTANTIATED);
}
Aggregations