public interface ComparableTest<E extends Comparable<E>> extends BasicObjectTest<E>
DATAPOINTS, EQUAL_DATAPOINTS, NONNULL_DATAPOINTS| Modifier and Type | Method and Description |
|---|---|
default void |
compareToIsAntiCommutative(E x,
E y)
The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y.
|
default void |
compareToIsTransitiveBigger(E x,
E y,
E z)
The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.
|
default void |
compareToIsTransitiveEquals(E x,
E y,
E z) |
default void |
compareToIsTransitiveSmaller(E x,
E y,
E z) |
default void |
compareToNull(E x) |
default void |
equalsConsistentWithComparable(nl.vpro.util.Pair<E,E> pair)
This test whether compareTo
Comparable.compareTo(Object) returns 0 iff if two object are equal. |
datapoints, equalDatapoints, equalsIsConsistent, equalsIsReflexive, equalsIsSymmetric, equalsIsTransitive, equalsReturnFalseOnNull, hashCodeIsConsistentWithEquals, hashCodeIsSelfConsistent, nonNullDatapoints, toString@Property
default void equalsConsistentWithComparable(@ForAll(value="equalDatapoints")
nl.vpro.util.Pair<E,E> pair)
Comparable.compareTo(Object) returns 0 iff if two object are equal.
TODO: This is not an absolute requirement, in some cases you may want to compareTo to zero even if two objects are not exactly equal.@Property
default void compareToNull(@ForAll(value="nonNullDatapoints")
E x)
@Property
default void compareToIsAntiCommutative(@ForAll(value="nonNullDatapoints")
E x,
@ForAll(value="nonNullDatapoints")
E y)
@Property(maxDiscardRatio=1000)
default void compareToIsTransitiveBigger(@ForAll(value="nonNullDatapoints")
E x,
@ForAll(value="nonNullDatapoints")
E y,
@ForAll(value="nonNullDatapoints")
E z)
@Property(maxDiscardRatio=1000)
default void compareToIsTransitiveSmaller(@ForAll(value="nonNullDatapoints")
E x,
@ForAll(value="nonNullDatapoints")
E y,
@ForAll(value="nonNullDatapoints")
E z)
Copyright © 2022. All rights reserved.