@Test
public void testRemoveParamOnlyIfReduceEverywhere() throws Exception {

  final String shader = ""
      + "float x = 0.0;"
      + "void bar(float a) { }"
      + "float foo() {"
      + "  x = 1.0;"
      + "  return 3.0;"
      + "}"
      + "void main() {"
      + "  bar(foo());"
      + "  gl_FragColor = vec4(x);"
      + "}";
  final String shaderIfReduced = ""
      + "float x = 0.0;"
      + "void bar() { }"
      + "float foo() {"
      + "  x = 1.0;"
      + "  return 3.0;"
      + "}"
      + "void main() {"
      + "  bar();"
      + "  gl_FragColor = vec4(x);"
      + "}";
  TranslationUnit tu = ParseHelper.parse(shader);
  List<RemoveUnusedParameterReductionOpportunity> opportunities =
      findOpportunities(tu, true);
  assertEquals(1, opportunities.size());
  opportunities.get(0).applyReduction();
  CompareAsts.assertEqualAsts(shaderIfReduced, tu);
  tu = ParseHelper.parse(shader);
  opportunities =
    findOpportunities(tu, false);
  assertEquals(0, opportunities.size());
}