@Test
public void testUniformsGetRemoved() throws Exception {

  final String program = "#version 310 es\n"
      + "\n"
      + "#ifdef GL_ES\n"
      + "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
      + "precision highp float;\n"
      + "precision highp int;\n"
      + "#else\n"
      + "precision mediump float;\n"
      + "precision mediump int;\n"
      + "#endif\n"
      + "#endif\n"
      + "\n"
      + "#ifndef REDUCER\n"
      + "#define _GLF_ZERO(X, Y)          (Y)\n"
      + "#define _GLF_ONE(X, Y)           (Y)\n"
      + "#define _GLF_FALSE(X, Y)         (Y)\n"
      + "#define _GLF_TRUE(X, Y)          (Y)\n"
      + "#define _GLF_IDENTITY(X, Y)      (Y)\n"
      + "#define _GLF_DEAD(X)             (X)\n"
      + "#define _GLF_FUZZED(X)           (X)\n"
      + "#define _GLF_WRAPPED_LOOP(X)     X\n"
      + "#define _GLF_WRAPPED_IF_TRUE(X)  X\n"
      + "#define _GLF_WRAPPED_IF_FALSE(X) X\n"
      + "#define _GLF_SWITCH(X)           X\n"
      + "#endif\n"
      + "\n"
      + "// END OF GENERATED HEADER\n"
      + "\n"
      + "layout(set=0,binding=0) uniform buf0 {\n"
      + " vec2 injectionSwitch;\n"
      + "} ;\n"
      + "void main() { }";
  final TranslationUnit tu = ParseHelper.parse(program);
  final String json = "{ \"injectionSwitch\": { \"args\": [ 1.0, 2.0 ], "
      + "    \"func\": \"glUniform2f\", \"binding\": 0 } }";
  final ShaderJob shaderJob = new GlslShaderJob(Optional.empty(),
      new PipelineInfo(json), tu);
  shaderJob.removeUniformBindings();
  List<IReductionOpportunity> ops = ReductionOpportunities.getReductionOpportunities(
      MakeShaderJobFromFragmentShader.make(tu),
      new ReducerContext(false, ShadingLanguageVersion.GLSL_440,
          new RandomWrapper(0), new IdGenerator()), fileOps);
  assertEquals(1, ops.size());
  assertTrue(ops.get(0) instanceof VariableDeclReductionOpportunity);
  ops.get(0).applyReduction();
  shaderJob.makeUniformBindings(Optional.empty());
  CompareAsts.assertEqualAsts("#version 310 es\nvoid main() { }", tu);
}