@Test
public void testReductionOfUnreferencedUniform() throws Exception {

  // Check that a shader job with metadata for one unreferenced uniform gets
  // reduced to a shader job with no metadata for uniforms.
  final String emptyShader = "void main() { }";
  final TranslationUnit fragShader = ParseHelper.parse(emptyShader);
  final PipelineInfo pipelineInfo = new PipelineInfo();
  pipelineInfo.addUniform("a", BasicType.FLOAT, Optional.empty(), Collections.singletonList(1.0));
  final ShaderJob shaderJob = new GlslShaderJob(Optional.empty(),
      pipelineInfo,
      fragShader);
  assertEquals(1, shaderJob.getPipelineInfo().getNumUniforms());
  final File workDir = testFolder.getRoot();
  final File tempShaderJobFile = new File(workDir, "temp.json");
  fileOps.writeShaderJobFile(shaderJob, tempShaderJobFile);
  final String resultsPrefix = new ReductionDriver(new ReducerContext(true,
      ShadingLanguageVersion.ESSL_100,
      new RandomWrapper(0),
      new IdGenerator()),
      false,
      fileOps,
      (unused, item) -> true, workDir)
      .doReduction(shaderJob, "temp", 0, 100);
  final ShaderJob after = fileOps.readShaderJobFile(new File(testFolder.getRoot(),
      resultsPrefix + ".json"));
  CompareAsts.assertEqualAsts(emptyShader,
      after.getFragmentShader().get());
  assertEquals(0, after.getPipelineInfo().getNumUniforms());
}