VariableIdentifierExprTemplate extends AbstractExprTemplate { @Override public boolean isLValue() { if (type.hasQualifier(TypeQualifier.ATTRIBUTE)) { return false; } if (type.hasQualifier(TypeQualifier.CONST)) { return false; } if (type.hasQualifier(TypeQualifier.SHADER_INPUT)) { return false; } if (type.hasQualifier(TypeQualifier.UNIFORM)) { return false; } return true; } VariableIdentifierExprTemplate(String name, Type type,
                                        boolean isFunctionParameter); @Override Expr generateExpr(IRandom generator, Expr... args); @Override Type getResultType(); @Override List<List<Type>> getArgumentTypes(); @Override int getNumArguments(); @Override boolean requiresLValueForArgument(int index); @Override boolean isLValue(); @Override boolean isConst();  }
@Test public void testConstIsNotLValue() throws Exception { final String program = "#version 100\n" + "const int x;"; assertFalse(getTemplateFromSingleDeclarationProgram(program).isLValue()); }
@Test public void testUniformIsNotLValue() throws Exception { final String program = "#version 100\n" + "uniform int x;"; assertFalse(getTemplateFromSingleDeclarationProgram(program).isLValue()); }
@Test public void testAttributeIsNotLValue() throws Exception { final String program = "#version 100\n" + "attribute int x;"; assertFalse(getTemplateFromSingleDeclarationProgram(program).isLValue()); }
@Test public void testShaderInputIsNotLValue() throws Exception { final String program = "#version 310 es\n" + "in int x;" + "void main() {" + "}"; assertFalse(getTemplateFromSingleDeclarationProgram(program).isLValue()); }
@Test public void testPlainIsLValue() throws Exception { final String program = "#version 100\n" + "int x;"; assertTrue(getTemplateFromSingleDeclarationProgram(program).isLValue()); }
@Test public void testShaderOutputIsLValue() throws Exception { final String program = "#version 100\n" + "out int x;"; assertTrue(getTemplateFromSingleDeclarationProgram(program).isLValue()); }