@Test
public void prepareStatementToDonateContinueInLoopKept() throws Exception {

  // Checks that a 'continue' in a loop gets kept if the whole loop is donated.
  final DonateDeadCodeTransformation dlc = getDummyTransformationObject();
  final TranslationUnit donor = ParseHelper.parse("#version 100\n"
      + "void main() {\n"
      + "  for (int i = 0; i < 10; i ++)\n"
      + "     if (i > 5) continue;\n"
      + "\n"
      + "}\n");
  final TranslationUnit reference = ParseHelper.parse("#version 100\n"
      + "void main() {\n"
      + "  ;\n"
      + "  for(int i = 0; i < 100; i++) {\n"
      + "  }\n"
      + "}\n");
  for (IInjectionPoint injectionPoint : new InjectionPoints(reference, new RandomWrapper(0),
      item -> true).getAllInjectionPoints()) {
    final Stmt toDonate = donor.getMainFunction().getBody().getStmt(0).clone();
    assert toDonate instanceof ForStmt;
    final DonationContext dc = new DonationContext(toDonate, new HashMap<>(),
        new ArrayList<>(), donor.getMainFunction());
    final Stmt donated = dlc.prepareStatementToDonate(injectionPoint, dc,
        TransformationProbabilities.DEFAULT_PROBABILITIES, new RandomWrapper(0),
        ShadingLanguageVersion.ESSL_100);
    // Check that the 'continue' statement is retained.
    assertTrue(new CheckPredicateVisitor() {
      @Override
      public void visitContinueStmt(ContinueStmt continueStmt) {
        predicateHolds();
      }
    }.test(donated));
  }
}