use of org.evosuite.testcase.variable.VariableReference in project evosuite by EvoSuite.
the class SymbolicObserver method after.
private void after(FloatPrimitiveStatement statement, Scope scope) {
float valueOf = statement.getValue();
VariableReference varRef = statement.getReturnValue();
String varRefName = varRef.getName();
RealVariable realVariable = buildRealVariable(varRefName, valueOf, -Float.MAX_VALUE, Float.MAX_VALUE);
symb_expressions.put(varRefName, realVariable);
Float float_instance;
try {
float_instance = (Float) varRef.getObject(scope);
} catch (CodeUnderTestException e) {
throw new EvosuiteError(e);
}
ReferenceConstant floatRef = newFloatReference(float_instance, realVariable);
symb_references.put(varRefName, floatRef);
}
use of org.evosuite.testcase.variable.VariableReference in project evosuite by EvoSuite.
the class SymbolicObserver method call_vm_caller_stack_params.
private void call_vm_caller_stack_params(boolean needThis, List<VariableReference> parameters, Scope scope, String desc) {
int calleeLocalsIndex = 0;
if (needThis)
calleeLocalsIndex++;
for (int i = 0; i < parameters.size(); i++) {
VariableReference p = parameters.get(i);
calleeLocalsIndex += getSize(p.getType());
}
Type[] argTypes = Type.getArgumentTypes(desc);
for (int i = parameters.size() - 1; i >= 0; i--) {
Type argType = argTypes[i];
VariableReference p = parameters.get(i);
try {
Object param_object = p.getObject(scope);
calleeLocalsIndex -= getSize(p.getType());
if (argType.equals(Type.INT_TYPE)) {
int intValue = getIntValue(param_object);
VM.CALLER_STACK_PARAM(intValue, i, calleeLocalsIndex);
} else if (argType.equals(Type.CHAR_TYPE)) {
char charValue = getCharValue(param_object);
VM.CALLER_STACK_PARAM(charValue, i, calleeLocalsIndex);
} else if (argType.equals(Type.BYTE_TYPE)) {
byte byteValue = getByteValue(param_object);
VM.CALLER_STACK_PARAM(byteValue, i, calleeLocalsIndex);
} else if (argType.equals(Type.BOOLEAN_TYPE)) {
boolean booleanValue = getBooleanValue(param_object);
VM.CALLER_STACK_PARAM(booleanValue, i, calleeLocalsIndex);
} else if (argType.equals(Type.SHORT_TYPE)) {
short shortValue = getShortValue(param_object);
VM.CALLER_STACK_PARAM(shortValue, i, calleeLocalsIndex);
} else if (argType.equals(Type.LONG_TYPE)) {
long longValue = getLongValue(param_object);
VM.CALLER_STACK_PARAM(longValue, i, calleeLocalsIndex);
} else if (argType.equals(Type.FLOAT_TYPE)) {
float floatValue = getFloatValue(param_object);
VM.CALLER_STACK_PARAM(floatValue, i, calleeLocalsIndex);
} else if (argType.equals(Type.DOUBLE_TYPE)) {
double doubleValue = getDoubleValue(param_object);
VM.CALLER_STACK_PARAM(doubleValue, i, calleeLocalsIndex);
} else {
VM.CALLER_STACK_PARAM(param_object, i, calleeLocalsIndex);
}
} catch (CodeUnderTestException e) {
throw new RuntimeException(e);
}
}
}
use of org.evosuite.testcase.variable.VariableReference in project evosuite by EvoSuite.
the class SymbolicObserver method after.
private void after(BooleanPrimitiveStatement statement, Scope scope) {
boolean valueOf = statement.getValue();
VariableReference varRef = statement.getReturnValue();
String varRefName = varRef.getName();
IntegerVariable integerVariable = buildIntegerVariable(varRefName, valueOf ? 1 : 0, 0, 1);
Boolean boolean_instance;
try {
boolean_instance = (Boolean) varRef.getObject(scope);
} catch (CodeUnderTestException e) {
throw new EvosuiteError(e);
}
symb_expressions.put(varRefName, integerVariable);
ReferenceConstant booleanRef = newBooleanReference(boolean_instance, integerVariable);
symb_references.put(varRefName, booleanRef);
}
use of org.evosuite.testcase.variable.VariableReference in project evosuite by EvoSuite.
the class SymbolicObserver method after.
private void after(DoublePrimitiveStatement statement, Scope scope) {
double valueOf = statement.getValue();
VariableReference varRef = statement.getReturnValue();
String varRefName = varRef.getName();
RealVariable realVariable = buildRealVariable(varRefName, valueOf, -Double.MAX_VALUE, Double.MAX_VALUE);
symb_expressions.put(varRefName, realVariable);
Double double_instance;
try {
double_instance = (Double) varRef.getObject(scope);
} catch (CodeUnderTestException e) {
throw new EvosuiteError(e);
}
ReferenceConstant doubleRef = newDoubleReference(double_instance, realVariable);
symb_references.put(varRefName, doubleRef);
}
use of org.evosuite.testcase.variable.VariableReference in project evosuite by EvoSuite.
the class SymbolicObserver method after.
private void after(LocalAddressPrimitiveStatement s, Scope scope) {
EvoSuiteLocalAddress conc_local_address = s.getValue();
VariableReference varRef = s.getReturnValue();
String varRefName = varRef.getName();
ReferenceExpression addressRef;
if (conc_local_address == null) {
addressRef = env.heap.getReference(null);
if (addressRef.getConcreteValue() != null) {
throw new IllegalStateException("Expected null concrete object");
}
} else {
addressRef = env.heap.getReference(conc_local_address);
if (addressRef.getConcreteValue() == null) {
throw new IllegalStateException("Expected non-null concrete object");
}
}
symb_references.put(varRefName, addressRef);
}
Aggregations