use of org.evosuite.symbolic.solver.smt.SmtExpr in project evosuite by EvoSuite.
the class ExprToCVC4Visitor method visit.
@Override
public SmtExpr visit(RealToIntegerCast e, Void v) {
SmtExpr argument = e.getArgument().accept(this, null);
if (argument == null) {
return null;
}
if (!argument.isSymbolic()) {
long longValue = e.getConcreteValue();
return SmtExprBuilder.mkIntConstant(longValue);
}
SmtExpr intExpr = SmtExprBuilder.mkReal2Int(argument);
return intExpr;
}
use of org.evosuite.symbolic.solver.smt.SmtExpr in project evosuite by EvoSuite.
the class ExprToCVC4Visitor method visit.
@Override
public SmtExpr visit(StringReaderExpr e, Void v) {
long longValue = e.getConcreteValue();
SmtExpr intConst = SmtExprBuilder.mkIntConstant(longValue);
return intConst;
}
use of org.evosuite.symbolic.solver.smt.SmtExpr in project evosuite by EvoSuite.
the class ExprToCVC4Visitor method visit.
@Override
public SmtExpr visit(IntegerToRealCast e, Void v) {
SmtExpr integerExpr = e.getArgument().accept(this, null);
if (integerExpr == null) {
return null;
}
if (!integerExpr.isSymbolic()) {
double doubleValue = e.getConcreteValue();
return SmtExprBuilder.mkRealConstant(doubleValue);
}
SmtExpr realExpr = SmtExprBuilder.mkInt2Real(integerExpr);
return realExpr;
}
use of org.evosuite.symbolic.solver.smt.SmtExpr in project evosuite by EvoSuite.
the class ExprToCVC4Visitor method visit.
@Override
public SmtExpr visit(StringBinaryToIntegerExpression e, Void v) {
Expression<String> leftOperand = e.getLeftOperand();
Operator op = e.getOperator();
Expression<?> rightOperand = e.getRightOperand();
SmtExpr left = leftOperand.accept(this, null);
SmtExpr right = rightOperand.accept(this, null);
if (left == null || right == null) {
return null;
}
if (!left.isSymbolic() && !right.isSymbolic()) {
long longValue = e.getConcreteValue();
return SmtExprBuilder.mkIntConstant(longValue);
}
switch(op) {
case CHARAT:
{
SmtExpr charAtExpr = SmtExprBuilder.mkStrAt(left, right);
SmtExpr strToInt = SmtExprBuilder.mkCharToInt(charAtExpr);
return strToInt;
}
case INDEXOFS:
{
SmtExpr zeroIndex = SmtExprBuilder.mkIntConstant(0);
SmtExpr indexOf = SmtExprBuilder.mkStrIndexOf(left, right, zeroIndex);
return indexOf;
}
case INDEXOFC:
{
SmtExpr zeroIndex = SmtExprBuilder.mkIntConstant(0);
SmtExpr charExpr = SmtExprBuilder.mkIntToChar(right);
SmtExpr indexOf = SmtExprBuilder.mkStrIndexOf(left, charExpr, zeroIndex);
return indexOf;
}
case LASTINDEXOFC:
case LASTINDEXOFS:
case COMPARETO:
case COMPARETOIGNORECASE:
{
long longValue = e.getConcreteValue();
return SmtExprBuilder.mkIntConstant(longValue);
}
default:
{
throw new UnsupportedOperationException("Not implemented yet!" + e.getOperator());
}
}
}
use of org.evosuite.symbolic.solver.smt.SmtExpr in project evosuite by EvoSuite.
the class ExprToCVC4Visitor method visit.
@Override
public SmtExpr visit(StringMultipleToIntegerExpression e, Void v) {
SmtExpr left = e.getLeftOperand().accept(this, null);
SmtExpr right = e.getRightOperand().accept(this, null);
List<SmtExpr> others = new LinkedList<SmtExpr>();
for (Expression<?> otherExpr : e.getOther()) {
SmtExpr otherSmtExpr = otherExpr.accept(this, null);
others.add(otherSmtExpr);
}
if (isNull(left, right, others)) {
return null;
}
if (!isSymbolic(left, right, others)) {
long longValue = e.getConcreteValue();
return SmtExprBuilder.mkIntConstant(longValue);
}
Operator op = e.getOperator();
switch(op) {
case INDEXOFSI:
{
SmtExpr other = e.getOther().get(0).accept(this, null);
SmtExpr indexOf = SmtExprBuilder.mkStrIndexOf(left, right, other);
return indexOf;
}
case INDEXOFCI:
{
SmtExpr int2Str = SmtExprBuilder.mkIntToChar(right);
SmtExpr other = e.getOther().get(0).accept(this, null);
SmtExpr indexOf = SmtExprBuilder.mkStrIndexOf(left, int2Str, other);
return indexOf;
}
case LASTINDEXOFCI:
case LASTINDEXOFSI:
{
long longValue = e.getConcreteValue();
SmtExpr intNum = SmtExprBuilder.mkIntConstant(longValue);
return intNum;
}
default:
{
throw new UnsupportedOperationException("Not implemented yet! " + op);
}
}
}
Aggregations