@Test
public void testGlobalScope() throws Exception {

  final String program = "const int x = 2; void main() { int y = x + 3; }";
  final String expected = "const int x = 2; void main() { int y = (2) + 3; }";
  final TranslationUnit tu = ParseHelper.parse(program);
  final List<SimplifyExprReductionOpportunity> ops = InlineInitializerReductionOpportunities
            .findOpportunities(MakeShaderJobFromFragmentShader.make(tu), new ReducerContext(true,
        ShadingLanguageVersion.ESSL_100, new RandomWrapper(0), new IdGenerator()));
  assertEquals(1, ops.size());
  ops.get(0).applyReduction();
  CompareAsts.assertEqualAsts(expected, tu);
  // If we are preserving semantics, we do not want to apply this transformation.
  assertTrue(InlineInitializerReductionOpportunities
      .findOpportunities(MakeShaderJobFromFragmentShader.make(tu), new ReducerContext(false,
      ShadingLanguageVersion.ESSL_100, new RandomWrapper(0), new IdGenerator())).isEmpty());
}