Search in sources :

Example 21 with IntegerValue

use of org.evosuite.symbolic.expr.bv.IntegerValue 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 22 with IntegerValue

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

the class I_IntValue method executeFunction.

@Override
public Object executeFunction() {
    ReferenceConstant symb_integer = this.getSymbReceiver();
    Integer conc_integer = (Integer) this.getConcReceiver();
    int conc_int_value = this.getConcIntRetVal();
    IntegerValue symb_int_value = env.heap.getField(Types.JAVA_LANG_INTEGER, SymbolicHeap.$INT_VALUE, conc_integer, symb_integer, conc_int_value);
    return symb_int_value;
}
Also used : ReferenceConstant(org.evosuite.symbolic.expr.ref.ReferenceConstant) IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue)

Example 23 with IntegerValue

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

the class J_ValueOf method executeFunction.

@Override
public Object executeFunction() {
    IntegerValue int_value = this.getSymbIntegerArgument(0);
    ReferenceConstant symb_long = (ReferenceConstant) this.getSymbRetVal();
    Long conc_long = (Long) this.getConcRetVal();
    env.heap.putField(Types.JAVA_LANG_LONG, SymbolicHeap.$LONG_VALUE, conc_long, symb_long, int_value);
    return symb_long;
}
Also used : ReferenceConstant(org.evosuite.symbolic.expr.ref.ReferenceConstant) IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue)

Example 24 with IntegerValue

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

the class S_ShortValue method executeFunction.

@Override
public Object executeFunction() {
    ReferenceConstant symb_short = this.getSymbReceiver();
    Short conc_short = (Short) this.getConcReceiver();
    short conc_short_value = this.getConcShortRetVal();
    IntegerValue symb_short_value = env.heap.getField(Types.JAVA_LANG_SHORT, SymbolicHeap.$SHORT_VALUE, conc_short, symb_short, conc_short_value);
    return symb_short_value;
}
Also used : ReferenceConstant(org.evosuite.symbolic.expr.ref.ReferenceConstant) IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue)

Example 25 with IntegerValue

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

the class ArithmeticVM method I2F.

/**
 * http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.
 * doc6.html#i2f
 */
@Override
public void I2F() {
    IntegerValue integerExpr = env.topFrame().operandStack.popBv32();
    int integerValue = ((Long) integerExpr.getConcreteValue()).intValue();
    RealValue realExpr;
    float concreteValue = (float) integerValue;
    if (!integerExpr.containsSymbolicVariable()) {
        realExpr = ExpressionFactory.buildNewRealConstant(concreteValue);
    } else {
        realExpr = new IntegerToRealCast(integerExpr, (double) concreteValue);
    }
    env.topFrame().operandStack.pushFp32(realExpr);
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue) IntegerToRealCast(org.evosuite.symbolic.expr.fp.IntegerToRealCast) IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) IntegerConstraint(org.evosuite.symbolic.expr.IntegerConstraint)

Aggregations

IntegerValue (org.evosuite.symbolic.expr.bv.IntegerValue)117 IntegerConstraint (org.evosuite.symbolic.expr.IntegerConstraint)48 ReferenceConstant (org.evosuite.symbolic.expr.ref.ReferenceConstant)32 ReferenceExpression (org.evosuite.symbolic.expr.ref.ReferenceExpression)27 RealValue (org.evosuite.symbolic.expr.fp.RealValue)22 IntegerBinaryExpression (org.evosuite.symbolic.expr.bv.IntegerBinaryExpression)14 Expression (org.evosuite.symbolic.expr.Expression)8 StringValue (org.evosuite.symbolic.expr.str.StringValue)8 IntegerConstant (org.evosuite.symbolic.expr.bv.IntegerConstant)7 Type (org.objectweb.asm.Type)7 RealToIntegerCast (org.evosuite.symbolic.expr.bv.RealToIntegerCast)6 IntegerToRealCast (org.evosuite.symbolic.expr.fp.IntegerToRealCast)6 IntegerUnaryExpression (org.evosuite.symbolic.expr.bv.IntegerUnaryExpression)5 PrimitiveExpression (org.evosuite.testcase.statements.PrimitiveExpression)4 ArrayList (java.util.ArrayList)3 CodeUnderTestException (org.evosuite.testcase.execution.CodeUnderTestException)3 Field (java.lang.reflect.Field)2 BigInteger (java.math.BigInteger)2 Vector (java.util.Vector)2 Constraint (org.evosuite.symbolic.expr.Constraint)2