@Test
public void testBasicInline() throws Exception {

  final String program = "int inlineme(int x) { int y = 2; return y + x; }"
      + "void main() { int z = inlineme(5); }";
  final String expected = "int inlineme(int x) { int y = 2; return y + x; }"
      + "void main() { "
      + " int inlineme_inline_return_value_0;"
      + " {"
      + "  int x = 5;"
      + "  int y = 2;"
      + "  inlineme_inline_return_value_0 = y + x;"
      + " }"
      + " int z = inlineme_inline_return_value_0;"
      + "}";
  final TranslationUnit tu = ParseHelper.parse(program);
  final ShaderJob shaderJob = MakeShaderJobFromFragmentShader.make(tu);
  final List<InlineFunctionReductionOpportunity> ops =
      InlineFunctionReductionOpportunities.findOpportunities(shaderJob,
      new ReducerContext(true,
          ShadingLanguageVersion.ESSL_100, new RandomWrapper(0), new IdGenerator()));
  assertEquals(1, ops.size());
  ops.get(0).applyReduction();
  CompareAsts.assertEqualAsts(expected, tu);
}