@Test
public void testDoInlineWhenPreservingSemanticsUnreachableSwitchCase() throws Exception {

  final String shader = "#version 310 es\n"
      + "uniform int u;\n"
      + "void main() {\n"
      + "  switch(" + Constants.GLF_SWITCH + "(0)) {\n"
      + "    case 2:\n"
      + "    u;\n"
      + "    case 3:\n"
      + "    u;\n"
      + "    case 0:\n"
      + "    u;\n"
      + "    case 5:\n"
      + "    u;\n"
      + "    break;\n"
      + "    case 6:\n"
      + "    u;\n"
      + "    default:\n"
      + "    u;\n"
      + "  }\n"
      + "}\n";
  final String expected = "#version 310 es\n"
      + "uniform int u;\n"
      + "void main() {\n"
      + "  switch(" + Constants.GLF_SWITCH + "(0)) {\n"
      + "    case 2:\n"
      + "    2;\n"
      + "    case 3:\n"
      + "    2;\n"
      + "    case 0:\n"
      + "    u;\n"
      + "    case 5:\n"
      + "    u;\n"
      + "    break;\n"
      + "    case 6:\n"
      + "    2;\n"
      + "    default:\n"
      + "    2;\n"
      + "  }\n"
      + "}\n";
  final TranslationUnit tu = ParseHelper.parse(shader);
  final PipelineInfo pipelineInfo = new PipelineInfo();
  pipelineInfo.addUniform("u", BasicType.INT, Optional.empty(), Collections.singletonList(2));
  final List<SimplifyExprReductionOpportunity> opportunities =
      InlineUniformReductionOpportunities.findOpportunities(new GlslShaderJob(Optional.empty(),
          pipelineInfo, tu), new ReducerContext(false, ShadingLanguageVersion.ESSL_310,
          new RandomWrapper(0), new IdGenerator()));
  assertEquals(4, opportunities.size());
  for (SimplifyExprReductionOpportunity op : opportunities) {
    op.applyReduction();
  }
  CompareAsts.assertEqualAsts(expected, tu);
}