@Test
public void testUniformArrayContentsInComments() throws Exception {

  final String shader = ""
      + "uniform int a[3], b[2], X[1], Y[22], Z[1];"
      + "uniform float _GLF_uniform_float_values[3], D;"
      + "uniform uint _GLF_uniform_uint_values[2], E[33];"
      + "uniform int test[5], test2[1], A;"
      + "void main()"
      + "{"
      + "  float a = _GLF_uniform_float_values[0];"
      + "  float b = _GLF_uniform_float_values[1];"
      + "  int c = _GLF_uniform_int_values[0];"
      + "  int d = _GLF_uniform_int_values[1];"
      + "  int e = _GLF_uniform_int_values[2];"
      + "  int f = _GLF_uniform_uint_values[0];"
      + "  int g = _GLF_uniform_uint_values[1];"
      + "}";
  final String shaderPrettyPrinted = ""
      + "#define _uint_2 _GLF_uniform_uint_values[0]\n"
      + "#define _uint_11 _GLF_uniform_uint_values[1]\n"
      + "#define _uint_22 _GLF_uniform_uint_values[2]\n"
      + "#define _float_0_0 _GLF_uniform_float_values[0]\n"
      + "#define _float_1_4 _GLF_uniform_float_values[1]\n"
      + "#define _float_22_2 _GLF_uniform_float_values[2]\n"
      + "\n"
      + "// Contents of a: [0, 1, 2]\n"
      + "// Contents of b: [3, 4, 5]\n"
      + "// Contents of Z: 77\n"
      + "uniform int a[3], b[2], X[1], Y[22], Z[1];\n"
      + "\n"
      + "// Contents of _GLF_uniform_float_values: [0.0, 1.4, 22.2]\n"
      + "uniform float _GLF_uniform_float_values[3], D;\n"
      + "\n"
      + "// Contents of _GLF_uniform_uint_values: [2, 11, 22]\n"
      + "uniform uint _GLF_uniform_uint_values[2], E[33];\n"
      + "\n"
      + "// Contents of test2: 66\n"
      + "uniform int test[5], test2[1], A;\n"
      + "\n"
      + "void main()\n"
      + "{\n"
      + " float a = _float_0_0;\n"
      + " float b = _float_1_4;\n"
      + " int c = _GLF_uniform_int_values[0];\n"
      + " int d = _GLF_uniform_int_values[1];\n"
      + " int e = _GLF_uniform_int_values[2];\n"
      + " int f = _uint_2;\n"
      + " int g = _uint_11;\n"
      + "}\n";
  final List<TranslationUnit> shaders = new ArrayList<>();
  shaders.add(ParseHelper.parse(shader, ShaderKind.FRAGMENT));
  UniformValueSupplier uniformValues = name -> {
    if (name.equals("a")) {
      return Optional.of(Arrays.asList("0", "1", "2"));
    } else if (name.equals("b")) {
      return Optional.of(Arrays.asList("3", "4", "5"));
    } else if (name.equals("_GLF_uniform_uint_values")) {
      return Optional.of(Arrays.asList("2", "11", "22"));
    } else if (name.equals("_GLF_uniform_float_values")) {
      return Optional.of(Arrays.asList("0.0", "1.4", "22.2"));
    } else if (name.equals("test2")) {
      return Optional.of(Arrays.asList("66"));
    } else if (name.equals("Z")) {
      return Optional.of(Arrays.asList("77"));
    }
    return Optional.empty();
  };
  assertEquals(shaderPrettyPrinted,
      PrettyPrinterVisitor.prettyPrintAsString(ParseHelper.parse(shader), uniformValues));
}