@Test
public void testAssignVariableIdentifier() throws Exception {

  final String program = "void main() {"
      + "int a = 1;"
      + "int b = a, c = b;"   // b depends on a and c depends on b.
      + "int d = c;"          // d depends on c.
      + "}";
  // As here we have the variable identifier as the initializer, we need to
  // make sure that new expressions generated by the reducer are added
  // in the correct order.
  final String expected = "void main() {"
      + " int a;"
      + " a = 1;"
      + " int b, c;"
      + " b = a;"
      + " c = b;"
      + " int d;"
      + " d = c;"
      + "}";
  final TranslationUnit tu = ParseHelper.parse(program);
  List<VariableDeclToExprReductionOpportunity> ops = VariableDeclToExprReductionOpportunities
      .findOpportunities(MakeShaderJobFromFragmentShader.make(tu), new ReducerContext(true,
          ShadingLanguageVersion.ESSL_100,
          new RandomWrapper(0), new IdGenerator()));
  assertEquals(4, ops.size());
  ops.forEach(VariableDeclToExprReductionOpportunity::applyReductionImpl);
  CompareAsts.assertEqualAsts(expected, tu);
}