Search in sources :

Example 1 with IntegerUnaryExpression

use of org.evosuite.symbolic.expr.bv.IntegerUnaryExpression in project evosuite by EvoSuite.

the class Character_getNumericValue method executeFunction.

@Override
public Object executeFunction() {
    IntegerValue charValueExpr = this.getSymbIntegerArgument(0);
    int res = this.getConcIntRetVal();
    if (charValueExpr.containsSymbolicVariable()) {
        IntegerUnaryExpression getNumericValueExpr = new IntegerUnaryExpression(charValueExpr, Operator.GETNUMERICVALUE, (long) res);
        return getNumericValueExpr;
    } else {
        return this.getSymbIntegerRetVal();
    }
}
Also used : IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) IntegerUnaryExpression(org.evosuite.symbolic.expr.bv.IntegerUnaryExpression)

Example 2 with IntegerUnaryExpression

use of org.evosuite.symbolic.expr.bv.IntegerUnaryExpression in project evosuite by EvoSuite.

the class ArithmeticVM method INEG.

/**
 * http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.
 * doc6.html#ineg
 */
@Override
public void INEG() {
    IntegerValue param = env.topFrame().operandStack.popBv32();
    int param_concrete_value = ((Long) param.getConcreteValue()).intValue();
    if (!param.containsSymbolicVariable()) {
        param = ExpressionFactory.buildNewIntegerConstant(param_concrete_value);
    }
    int con = -param_concrete_value;
    IntegerValue intExpr = new IntegerUnaryExpression(param, Operator.NEG, (long) con);
    env.topFrame().operandStack.pushBv32(intExpr);
}
Also used : IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) IntegerUnaryExpression(org.evosuite.symbolic.expr.bv.IntegerUnaryExpression) IntegerConstraint(org.evosuite.symbolic.expr.IntegerConstraint)

Example 3 with IntegerUnaryExpression

use of org.evosuite.symbolic.expr.bv.IntegerUnaryExpression in project evosuite by EvoSuite.

the class ArithmeticVM method LNEG.

/**
 * http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.
 * doc8.html#lneg
 */
@Override
public void LNEG() {
    IntegerValue param = env.topFrame().operandStack.popBv64();
    long param_concrete_value = ((Long) param.getConcreteValue()).longValue();
    if (!param.containsSymbolicVariable()) {
        param = ExpressionFactory.buildNewIntegerConstant(param_concrete_value);
    }
    long con = -param_concrete_value;
    IntegerValue intExpr = new IntegerUnaryExpression(param, Operator.NEG, (long) con);
    env.topFrame().operandStack.pushBv64(intExpr);
}
Also used : IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) IntegerUnaryExpression(org.evosuite.symbolic.expr.bv.IntegerUnaryExpression)

Example 4 with IntegerUnaryExpression

use of org.evosuite.symbolic.expr.bv.IntegerUnaryExpression in project evosuite by EvoSuite.

the class Character_isDigit method executeFunction.

@Override
public Object executeFunction() {
    IntegerValue charValueExpr = this.getSymbIntegerArgument(0);
    boolean res = this.getConcBooleanRetVal();
    if (charValueExpr.containsSymbolicVariable()) {
        long conV = res ? 1 : 0;
        IntegerUnaryExpression getNumericValueExpr = new IntegerUnaryExpression(charValueExpr, Operator.ISDIGIT, conV);
        return getNumericValueExpr;
    } else {
        return this.getSymbIntegerRetVal();
    }
}
Also used : IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) IntegerUnaryExpression(org.evosuite.symbolic.expr.bv.IntegerUnaryExpression)

Example 5 with IntegerUnaryExpression

use of org.evosuite.symbolic.expr.bv.IntegerUnaryExpression in project evosuite by EvoSuite.

the class Character_isLetter method executeFunction.

@Override
public Object executeFunction() {
    IntegerValue charValueExpr = this.getSymbIntegerArgument(0);
    boolean res = this.getConcBooleanRetVal();
    if (charValueExpr.containsSymbolicVariable()) {
        long conV = res ? 1 : 0;
        IntegerUnaryExpression is_letter_expr = new IntegerUnaryExpression(charValueExpr, Operator.ISLETTER, conV);
        return is_letter_expr;
    } else {
        return this.getSymbIntegerRetVal();
    }
}
Also used : IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) IntegerUnaryExpression(org.evosuite.symbolic.expr.bv.IntegerUnaryExpression)

Aggregations

IntegerUnaryExpression (org.evosuite.symbolic.expr.bv.IntegerUnaryExpression)5 IntegerValue (org.evosuite.symbolic.expr.bv.IntegerValue)5 IntegerConstraint (org.evosuite.symbolic.expr.IntegerConstraint)1