use of org.evosuite.symbolic.solver.smt.SmtExpr in project evosuite by EvoSuite.
the class ExprToZ3Visitor method visit.
@Override
public SmtExpr visit(HasMoreTokensExpr e, Void v) {
Long longObject = e.getConcreteValue();
SmtExpr intConst = createIntegerConstant(longObject);
return intConst;
}
use of org.evosuite.symbolic.solver.smt.SmtExpr in project evosuite by EvoSuite.
the class ExprToZ3Visitor method visit.
@Override
public SmtExpr visit(IntegerUnaryExpression e, Void v) {
SmtExpr intExpr = e.getOperand().accept(this, null);
if (intExpr == null) {
return null;
}
if (!intExpr.isSymbolic()) {
long longValue = e.getConcreteValue();
return SmtExprBuilder.mkIntConstant(longValue);
}
switch(e.getOperator()) {
case NEG:
{
SmtExpr minus_expr = SmtExprBuilder.mkNeg(intExpr);
return minus_expr;
}
case GETNUMERICVALUE:
case ISDIGIT:
case ISLETTER:
{
long longValue = e.getConcreteValue();
return SmtExprBuilder.mkIntConstant(longValue);
}
case ABS:
SmtExpr zero = SmtExprBuilder.mkIntConstant(0);
SmtExpr gte_than_zero = SmtExprBuilder.mkGe(intExpr, zero);
SmtExpr minus_expr = SmtExprBuilder.mkNeg(intExpr);
SmtExpr ite_expr = SmtExprBuilder.mkITE(gte_than_zero, intExpr, minus_expr);
return ite_expr;
default:
throw new UnsupportedOperationException("Not implemented yet!" + e.getOperator());
}
}
use of org.evosuite.symbolic.solver.smt.SmtExpr in project evosuite by EvoSuite.
the class ExprToZ3Visitor 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 doubleVal = e.getConcreteValue();
return mkRepresentableRealConstant(doubleVal);
}
SmtExpr realExpr = SmtExprBuilder.mkInt2Real(integerExpr);
return realExpr;
}
use of org.evosuite.symbolic.solver.smt.SmtExpr in project evosuite by EvoSuite.
the class ExprToZ3Visitor method visit.
@Override
public SmtExpr visit(RealBinaryExpression e, Void v) {
SmtExpr left = e.getLeftOperand().accept(this, null);
SmtExpr right = e.getRightOperand().accept(this, null);
if (left == null || right == null) {
return null;
}
if (!left.isSymbolic() && !right.isSymbolic()) {
double doubleValue = e.getConcreteValue();
return mkRepresentableRealConstant(doubleValue);
}
switch(e.getOperator()) {
case DIV:
{
SmtExpr z3_div = SmtExprBuilder.mkRealDiv(left, right);
return z3_div;
}
case MUL:
{
SmtExpr z3_mul = SmtExprBuilder.mkMul(left, right);
return z3_mul;
}
case MINUS:
{
SmtExpr z3_sub = SmtExprBuilder.mkSub(left, right);
return z3_sub;
}
case PLUS:
{
SmtExpr z3_add = SmtExprBuilder.mkAdd(left, right);
return z3_add;
}
case MAX:
{
SmtExpr left_gt_right = SmtExprBuilder.mkGt(left, right);
SmtExpr ite_expr = SmtExprBuilder.mkITE(left_gt_right, left, right);
return ite_expr;
}
case MIN:
{
SmtExpr left_gt_right = SmtExprBuilder.mkLt(left, right);
SmtExpr ite_expr = SmtExprBuilder.mkITE(left_gt_right, left, right);
return ite_expr;
}
case ATAN2:
case COPYSIGN:
case HYPOT:
case NEXTAFTER:
case POW:
case SCALB:
case IEEEREMAINDER:
case REM:
{
double doubleValue = e.getConcreteValue();
return mkRepresentableRealConstant(doubleValue);
}
default:
{
throw new UnsupportedOperationException("Not implemented yet! " + e.getOperator());
}
}
}
use of org.evosuite.symbolic.solver.smt.SmtExpr in project evosuite by EvoSuite.
the class ExprToZ3Visitor method visit.
@Override
public SmtExpr visit(StringReaderExpr e, Void v) {
Long longObject = e.getConcreteValue();
SmtExpr intConst = createIntegerConstant(longObject);
return intConst;
}
Aggregations