@Test public void prefix_increment() throws Exception { UnaryExpressionTree tree = tree("++x", Kind.PREFIX_INCREMENT); execute(tree, Constraint.ANY_VALUE); assertThat(operandValueAfter).isEqualTo(expressionValue); assertThat(expressionValue).isInstanceOf(IncDecSymbolicValue.class); assertThat(((IncDecSymbolicValue) expressionValue).sign()).isEqualTo(Sign.PLUS); execute(tree, Constraint.POSITIVE_NUMBER_PRIMITIVE); assertThat(operandValueAfter).isEqualTo(expressionValue); assertThat(expressionValue).isInstanceOf(IncDecSymbolicValue.class); assertThat(((IncDecSymbolicValue) expressionValue).sign()).isEqualTo(Sign.PLUS); }
@Override public Optional<ProgramState> execute(ProgramState state) { ExpressionStack stack = state.getStack(); ExpressionStack stackAfterExecution = stack.apply(newStack -> { SymbolicValue operandValue = newStack.pop(); Constraint operandConstraint = state.getConstraint(operandValue); execute(operandValue, operandConstraint); newStack.push(expressionValue); }); ProgramState newPS = state.withStack(stackAfterExecution); newPS = executeAssignment(newPS); return Optional.of(newPS); }
UnaryNumericProgramPoint implements ProgramPoint { @Override public Optional<ProgramState> execute(ProgramState state) { ExpressionStack stack = state.getStack(); ExpressionStack stackAfterExecution = stack.apply(newStack -> { SymbolicValue operandValue = newStack.pop(); Constraint operandConstraint = state.getConstraint(operandValue); execute(operandValue, operandConstraint); newStack.push(expressionValue); }); ProgramState newPS = state.withStack(stackAfterExecution); newPS = executeAssignment(newPS); return Optional.of(newPS); } }
UnaryNumericProgramPoint implements ProgramPoint { @Override public Optional<ProgramState> execute(ProgramState state) { ExpressionStack stack = state.getStack(); ExpressionStack stackAfterExecution = stack.apply(newStack -> { SymbolicValue operandValue = newStack.pop(); Constraint operandConstraint = state.getConstraint(operandValue); execute(operandValue, operandConstraint); newStack.push(expressionValue); }); ProgramState newPS = state.withStack(stackAfterExecution); newPS = executeAssignment(newPS); return Optional.of(newPS); } UnaryNumericProgramPoint(Tree element, SymbolicExecution execution); }
UnaryNumericProgramPoint implements ProgramPoint { @Override public Optional<ProgramState> execute(ProgramState state) { ExpressionStack stack = state.getStack(); ExpressionStack stackAfterExecution = stack.apply(newStack -> { SymbolicValue operandValue = newStack.pop(); Constraint operandConstraint = state.getConstraint(operandValue); execute(operandValue, operandConstraint); newStack.push(expressionValue); }); ProgramState newPS = state.withStack(stackAfterExecution); newPS = executeAssignment(newPS); return Optional.of(newPS); } UnaryNumericProgramPoint(Tree element, SymbolicExecution execution); @Override Optional<ProgramState> execute(ProgramState state); static boolean originatesFrom(Tree element); }
UnaryNumericProgramPoint implements ProgramPoint { @Override public Optional<ProgramState> execute(ProgramState state) { ExpressionStack stack = state.getStack(); ExpressionStack stackAfterExecution = stack.apply(newStack -> { SymbolicValue operandValue = newStack.pop(); Constraint operandConstraint = state.getConstraint(operandValue); execute(operandValue, operandConstraint); newStack.push(expressionValue); }); ProgramState newPS = state.withStack(stackAfterExecution); newPS = executeAssignment(newPS); return Optional.of(newPS); } UnaryNumericProgramPoint(Tree element, SymbolicExecution execution); @Override Optional<ProgramState> execute(ProgramState state); static boolean originatesFrom(Tree element);  }