@Test void test_constraint_copy_of_not_null_constraint() throws Exception { ProgramState ps = ProgramState.EMPTY_STATE; SymbolicValue svNotNull = new SymbolicValue(); ps = Iterables.getOnlyElement(svNotNull.setConstraint(ps, ObjectConstraint.NOT_NULL)); SymbolicValue sv = new SymbolicValue(); RelationalSymbolicValue neq = new RelationalSymbolicValue(NOT_EQUAL, svNotNull, sv); ProgramState result = setTrue(ps, neq); assertNoConstraints(result, sv); neq = new RelationalSymbolicValue(NOT_EQUAL, NULL_LITERAL, sv); result = setTrue(ps, neq); assertThat(result.getConstraint(sv, ObjectConstraint.class)).isEqualTo(ObjectConstraint.NOT_NULL); RelationalSymbolicValue eq = new RelationalSymbolicValue(EQUAL, NULL_LITERAL, sv); result = setTrue(ps, eq); assertNullConstraint(result, sv); eq = new RelationalSymbolicValue(METHOD_EQUALS, sv, svNotNull); result = setTrue(ps, eq); assertThat(result.getConstraint(sv, ObjectConstraint.class)).isEqualTo(ObjectConstraint.NOT_NULL); }
@Override public List<ProgramState> setConstraint(ProgramState initialProgramState, BooleanConstraint booleanConstraint) { return setConstraint(initialProgramState, booleanConstraint, new HashSet<>(initialProgramState.knownRelations())); }
RelationalSymbolicValue extends BinarySymbolicValue { @Override public List<ProgramState> setConstraint(ProgramState initialProgramState, BooleanConstraint booleanConstraint) { return setConstraint(initialProgramState, booleanConstraint, new HashSet<>(initialProgramState.knownRelations())); } }
RelationalSymbolicValue extends BinarySymbolicValue { @Override public List<ProgramState> setConstraint(ProgramState initialProgramState, BooleanConstraint booleanConstraint) { return setConstraint(initialProgramState, booleanConstraint, new HashSet<>(initialProgramState.knownRelations())); } RelationalSymbolicValue(Kind kind); @VisibleForTesting  RelationalSymbolicValue(Kind kind, SymbolicValue leftOp, SymbolicValue rightOp); }
RelationalSymbolicValue extends BinarySymbolicValue { @Override public List<ProgramState> setConstraint(ProgramState initialProgramState, BooleanConstraint booleanConstraint) { return setConstraint(initialProgramState, booleanConstraint, new HashSet<>(initialProgramState.knownRelations())); } RelationalSymbolicValue(Kind kind); @VisibleForTesting  RelationalSymbolicValue(Kind kind, SymbolicValue leftOp, SymbolicValue rightOp); @Override List<ProgramState> setConstraint(ProgramState initialProgramState, BooleanConstraint booleanConstraint); @Override boolean equals(Object o); boolean isEquality(); @Override int hashCode(); @Override String toString(); @VisibleForTesting Kind kind(); }
RelationalSymbolicValue extends BinarySymbolicValue { @Override public List<ProgramState> setConstraint(ProgramState initialProgramState, BooleanConstraint booleanConstraint) { return setConstraint(initialProgramState, booleanConstraint, new HashSet<>(initialProgramState.knownRelations())); } RelationalSymbolicValue(Kind kind); @VisibleForTesting  RelationalSymbolicValue(Kind kind, SymbolicValue leftOp, SymbolicValue rightOp); @Override List<ProgramState> setConstraint(ProgramState initialProgramState, BooleanConstraint booleanConstraint); @Override boolean equals(Object o); boolean isEquality(); @Override int hashCode(); @Override String toString(); @VisibleForTesting Kind kind();  }