@Test
public void testCompatibleDeclaration() throws Exception {

  final String original =
      "void f()\n"
          + "{\n"
          + "    vec2 GLF_merged2_0_1_1_1_1_1bc;\n"
          + "    float b;\n"
          + "    GLF_merged2_0_1_1_1_1_1bc.y;\n"
          + "    GLF_merged2_0_1_1_1_1_1bc.x;\n"
          + "}\n";
  final String expected1 =
      "void f()\n"
          + "{\n"
          + "    vec2 GLF_merged2_0_1_1_1_1_1bc;\n"
          + "    float b;\n"
          + "    GLF_merged2_0_1_1_1_1_1bc.y;\n"
          + "    b;\n"
          + "}\n";
  final String expected2 =
      "void f()\n"
          + "{\n"
          + "    float c;"
          + "    vec2 GLF_merged2_0_1_1_1_1_1bc;\n"
          + "    float b;\n"
          + "    c;\n"
          + "    b;\n"
          + "}\n";
  final TranslationUnit tu = ParseHelper.parse(original);
  List<VectorizationReductionOpportunity> ops = VectorizationReductionOpportunities
          .findOpportunities(MakeShaderJobFromFragmentShader.make(tu),
              new ReducerContext(false, ShadingLanguageVersion.GLSL_440,
      new ZeroCannedRandom(), new IdGenerator()));
  assertEquals(2, ops.size());
  ops.get(0).applyReduction();
  assertEquals(PrettyPrinterVisitor.prettyPrintAsString(ParseHelper.parse(expected1)),
      PrettyPrinterVisitor.prettyPrintAsString(tu));
  ops = VectorizationReductionOpportunities
          .findOpportunities(MakeShaderJobFromFragmentShader.make(tu),
              new ReducerContext(false, ShadingLanguageVersion.GLSL_440,
      new ZeroCannedRandom(), new IdGenerator()));
  assertEquals(1, ops.size());
  ops.get(0).applyReduction();
  assertEquals(PrettyPrinterVisitor.prettyPrintAsString(ParseHelper.parse(expected2)),
      PrettyPrinterVisitor.prettyPrintAsString(tu));
}