Search in sources :

Example 1 with Operator

use of org.evosuite.testcase.PrimitiveExpression.Operator in project evosuite by EvoSuite.

the class TestExtractingVisitor method retrieveVariableReference.

private VariableReference retrieveVariableReference(InfixExpression infixExpr, Class<?> exprType) {
    if (exprType == null) {
        exprType = retrieveTypeClass(infixExpr);
    }
    VariableReference ref = new VariableReferenceImpl(testCase.getReference(), exprType);
    VariableReference leftOperand = retrieveVariableReference(infixExpr.getLeftOperand(), null);
    leftOperand.setOriginalCode(infixExpr.getLeftOperand().toString());
    Operator operator = Operator.toOperator(infixExpr.getOperator().toString());
    VariableReference rightOperand = retrieveVariableReference(infixExpr.getRightOperand(), null);
    rightOperand.setOriginalCode(infixExpr.getRightOperand().toString());
    PrimitiveExpression expr = new PrimitiveExpression(testCase.getReference(), ref, leftOperand, operator, rightOperand);
    testCase.addStatement(expr);
    return ref;
}
Also used : Operator(org.evosuite.testcase.PrimitiveExpression.Operator) VariableReference(org.evosuite.testcase.VariableReference) VariableReferenceImpl(org.evosuite.testcase.VariableReferenceImpl) PrimitiveExpression(org.evosuite.testcase.PrimitiveExpression)

Aggregations

PrimitiveExpression (org.evosuite.testcase.PrimitiveExpression)1 Operator (org.evosuite.testcase.PrimitiveExpression.Operator)1 VariableReference (org.evosuite.testcase.VariableReference)1 VariableReferenceImpl (org.evosuite.testcase.VariableReferenceImpl)1