@Test
public void testRemoveSwitchButKeepGuard() throws Exception {

  final String shaderSwitch = "#version 310 es\n"
      + "void main() {\n"
      + "  switch(0) {\n"
      + "    case 1:\n"
      + "      break;\n"
      + "  }\n"
      + "}\n";
  final String expected = "#version 310 es\n"
      + "void main() {\n"
      + "  0;\n"
      + "}\n";
  final IFileJudge customFileJudge =
      new CheckAstFeaturesFileJudge(Collections.singletonList(
          () -> new CheckAstFeatureVisitor() {
            @Override
            public void visitIntConstantExpr(IntConstantExpr intConstantExpr) {
              super.visitIntConstantExpr(intConstantExpr);
              if (intConstantExpr.getNumericValue() == 0) {
                trigger();
              }
            }
          }),
          ShaderKind.FRAGMENT,
          fileOps);
  final ShaderJob shaderJob = new GlslShaderJob(Optional.empty(),
      new PipelineInfo(),
      ParseHelper.parse(shaderSwitch));
  final File workDir = testFolder.getRoot();
  final File tempShaderJobFile = new File(workDir, "temp.json");
  fileOps.writeShaderJobFile(shaderJob, tempShaderJobFile);
  final String resultsPrefix = new ReductionDriver(new ReducerContext(true,
      ShadingLanguageVersion.ESSL_310,
      new RandomWrapper(0),
      new IdGenerator()),
      false,
      fileOps,
      customFileJudge,
      workDir)
      .doReduction(shaderJob, "temp", 0, 100);
  CompareAsts.assertEqualAsts(expected, ParseHelper.parse(new File(testFolder.getRoot(),
      resultsPrefix + ".frag")));
}