@Test public void constrain_to_falsy() { Optional<ProgramState> constrainedStates = relationalValue.constrainDependencies(state, Constraint.FALSY); assertThat(constrainedStates.isPresent()).isTrue(); assertThat(constrainedStates.get().relations()).containsOnly(new Relation(Kind.GREATER_THAN_OR_EQUAL_TO, sv1, sv2)); }
@Override public Optional<ProgramState> constrainDependencies(ProgramState state, Constraint constraint) { if (constraint.isStricterOrEqualTo(Constraint.TRUTHY)) { return checkRelationsAndConstrain(state, relationWhenTrue); } else if (constraint.isStricterOrEqualTo(Constraint.FALSY)) { return checkRelationsAndConstrain(state, relationWhenTrue.not()); } return Optional.of(state); }
RelationalSymbolicValue implements SymbolicValue { @Override public Optional<ProgramState> constrainDependencies(ProgramState state, Constraint constraint) { if (constraint.isStricterOrEqualTo(Constraint.TRUTHY)) { return checkRelationsAndConstrain(state, relationWhenTrue); } else if (constraint.isStricterOrEqualTo(Constraint.FALSY)) { return checkRelationsAndConstrain(state, relationWhenTrue.not()); } return Optional.of(state); } }
RelationalSymbolicValue implements SymbolicValue { @Override public Optional<ProgramState> constrainDependencies(ProgramState state, Constraint constraint) { if (constraint.isStricterOrEqualTo(Constraint.TRUTHY)) { return checkRelationsAndConstrain(state, relationWhenTrue); } else if (constraint.isStricterOrEqualTo(Constraint.FALSY)) { return checkRelationsAndConstrain(state, relationWhenTrue.not()); } return Optional.of(state); } RelationalSymbolicValue(Kind kind, SymbolicValue leftOperand, SymbolicValue rightOperand); }
RelationalSymbolicValue implements SymbolicValue { @Override public Optional<ProgramState> constrainDependencies(ProgramState state, Constraint constraint) { if (constraint.isStricterOrEqualTo(Constraint.TRUTHY)) { return checkRelationsAndConstrain(state, relationWhenTrue); } else if (constraint.isStricterOrEqualTo(Constraint.FALSY)) { return checkRelationsAndConstrain(state, relationWhenTrue.not()); } return Optional.of(state); } RelationalSymbolicValue(Kind kind, SymbolicValue leftOperand, SymbolicValue rightOperand); static SymbolicValue create(Kind kind, SymbolicValue leftOperand, SymbolicValue rightOperand); @Override Optional<ProgramState> constrainDependencies(ProgramState state, Constraint constraint); @Override Constraint baseConstraint(ProgramState state); Relation relationWhenTrue(); @Override String toString(); }
RelationalSymbolicValue implements SymbolicValue { @Override public Optional<ProgramState> constrainDependencies(ProgramState state, Constraint constraint) { if (constraint.isStricterOrEqualTo(Constraint.TRUTHY)) { return checkRelationsAndConstrain(state, relationWhenTrue); } else if (constraint.isStricterOrEqualTo(Constraint.FALSY)) { return checkRelationsAndConstrain(state, relationWhenTrue.not()); } return Optional.of(state); } RelationalSymbolicValue(Kind kind, SymbolicValue leftOperand, SymbolicValue rightOperand); static SymbolicValue create(Kind kind, SymbolicValue leftOperand, SymbolicValue rightOperand); @Override Optional<ProgramState> constrainDependencies(ProgramState state, Constraint constraint); @Override Constraint baseConstraint(ProgramState state); Relation relationWhenTrue(); @Override String toString();  }