@Test public void test() { final MutableValuation val = new MutableValuation(); for (final Tuple2<Decl<?>, LitExpr<?>> entry : initialEntries) { val.put(entry.get1(), entry.get2()); } final ApplyResult actualResult = StmtApplier.apply(stmt, val, approximate); assertEquals(expectedResult, actualResult); assertEquals(finalEntries.size(), val.getDecls().size()); for (final Tuple2<Decl<?>, LitExpr<?>> entry : finalEntries) { final LitExpr<?> lit = val.eval(entry.get1()).get(); assertEquals(lit, entry.get2()); } }
public static ApplyResult apply(final Stmt stmt, final MutableValuation val, final boolean approximate) { if (stmt instanceof AssignStmt) { final AssignStmt<?> assignStmt = (AssignStmt<?>) stmt; return applyAssign(assignStmt, val, approximate); } else if (stmt instanceof AssumeStmt) { final AssumeStmt assumeStmt = (AssumeStmt) stmt; return applyAssume(assumeStmt, val, approximate); } else if (stmt instanceof HavocStmt) { final HavocStmt<?> havocStmt = (HavocStmt<?>) stmt; return applyHavoc(havocStmt, val); } else if (stmt instanceof SkipStmt) { return applySkip(); } else if (stmt instanceof SequenceStmt) { final SequenceStmt sequenceStmt = (SequenceStmt) stmt; return applySequence(sequenceStmt, val, approximate); } else if (stmt instanceof NonDetStmt) { final NonDetStmt nonDetStmt = (NonDetStmt) stmt; return applyNonDet(nonDetStmt, val, approximate); } else if (stmt instanceof OrtStmt) { final OrtStmt ortStmt = (OrtStmt) stmt; return applyOrt(ortStmt, val, approximate); } else { throw new UnsupportedOperationException("Unhandled statement: " + stmt); } }
StmtApplier { public static ApplyResult apply(final Stmt stmt, final MutableValuation val, final boolean approximate) { if (stmt instanceof AssignStmt) { final AssignStmt<?> assignStmt = (AssignStmt<?>) stmt; return applyAssign(assignStmt, val, approximate); } else if (stmt instanceof AssumeStmt) { final AssumeStmt assumeStmt = (AssumeStmt) stmt; return applyAssume(assumeStmt, val, approximate); } else if (stmt instanceof HavocStmt) { final HavocStmt<?> havocStmt = (HavocStmt<?>) stmt; return applyHavoc(havocStmt, val); } else if (stmt instanceof SkipStmt) { return applySkip(); } else if (stmt instanceof SequenceStmt) { final SequenceStmt sequenceStmt = (SequenceStmt) stmt; return applySequence(sequenceStmt, val, approximate); } else if (stmt instanceof NonDetStmt) { final NonDetStmt nonDetStmt = (NonDetStmt) stmt; return applyNonDet(nonDetStmt, val, approximate); } else if (stmt instanceof OrtStmt) { final OrtStmt ortStmt = (OrtStmt) stmt; return applyOrt(ortStmt, val, approximate); } else { throw new UnsupportedOperationException("Unhandled statement: " + stmt); } } }
StmtApplier { public static ApplyResult apply(final Stmt stmt, final MutableValuation val, final boolean approximate) { if (stmt instanceof AssignStmt) { final AssignStmt<?> assignStmt = (AssignStmt<?>) stmt; return applyAssign(assignStmt, val, approximate); } else if (stmt instanceof AssumeStmt) { final AssumeStmt assumeStmt = (AssumeStmt) stmt; return applyAssume(assumeStmt, val, approximate); } else if (stmt instanceof HavocStmt) { final HavocStmt<?> havocStmt = (HavocStmt<?>) stmt; return applyHavoc(havocStmt, val); } else if (stmt instanceof SkipStmt) { return applySkip(); } else if (stmt instanceof SequenceStmt) { final SequenceStmt sequenceStmt = (SequenceStmt) stmt; return applySequence(sequenceStmt, val, approximate); } else if (stmt instanceof NonDetStmt) { final NonDetStmt nonDetStmt = (NonDetStmt) stmt; return applyNonDet(nonDetStmt, val, approximate); } else if (stmt instanceof OrtStmt) { final OrtStmt ortStmt = (OrtStmt) stmt; return applyOrt(ortStmt, val, approximate); } else { throw new UnsupportedOperationException("Unhandled statement: " + stmt); } } private  StmtApplier(); }
StmtApplier { public static ApplyResult apply(final Stmt stmt, final MutableValuation val, final boolean approximate) { if (stmt instanceof AssignStmt) { final AssignStmt<?> assignStmt = (AssignStmt<?>) stmt; return applyAssign(assignStmt, val, approximate); } else if (stmt instanceof AssumeStmt) { final AssumeStmt assumeStmt = (AssumeStmt) stmt; return applyAssume(assumeStmt, val, approximate); } else if (stmt instanceof HavocStmt) { final HavocStmt<?> havocStmt = (HavocStmt<?>) stmt; return applyHavoc(havocStmt, val); } else if (stmt instanceof SkipStmt) { return applySkip(); } else if (stmt instanceof SequenceStmt) { final SequenceStmt sequenceStmt = (SequenceStmt) stmt; return applySequence(sequenceStmt, val, approximate); } else if (stmt instanceof NonDetStmt) { final NonDetStmt nonDetStmt = (NonDetStmt) stmt; return applyNonDet(nonDetStmt, val, approximate); } else if (stmt instanceof OrtStmt) { final OrtStmt ortStmt = (OrtStmt) stmt; return applyOrt(ortStmt, val, approximate); } else { throw new UnsupportedOperationException("Unhandled statement: " + stmt); } } private  StmtApplier(); static ApplyResult apply(final Stmt stmt, final MutableValuation val, final boolean approximate); }
StmtApplier { public static ApplyResult apply(final Stmt stmt, final MutableValuation val, final boolean approximate) { if (stmt instanceof AssignStmt) { final AssignStmt<?> assignStmt = (AssignStmt<?>) stmt; return applyAssign(assignStmt, val, approximate); } else if (stmt instanceof AssumeStmt) { final AssumeStmt assumeStmt = (AssumeStmt) stmt; return applyAssume(assumeStmt, val, approximate); } else if (stmt instanceof HavocStmt) { final HavocStmt<?> havocStmt = (HavocStmt<?>) stmt; return applyHavoc(havocStmt, val); } else if (stmt instanceof SkipStmt) { return applySkip(); } else if (stmt instanceof SequenceStmt) { final SequenceStmt sequenceStmt = (SequenceStmt) stmt; return applySequence(sequenceStmt, val, approximate); } else if (stmt instanceof NonDetStmt) { final NonDetStmt nonDetStmt = (NonDetStmt) stmt; return applyNonDet(nonDetStmt, val, approximate); } else if (stmt instanceof OrtStmt) { final OrtStmt ortStmt = (OrtStmt) stmt; return applyOrt(ortStmt, val, approximate); } else { throw new UnsupportedOperationException("Unhandled statement: " + stmt); } } private  StmtApplier(); static ApplyResult apply(final Stmt stmt, final MutableValuation val, final boolean approximate);  }