expectCompareAgreesWithEquals
expectCompareAgreesWithEquals<
T>(values,compare,equals):void
Defined in: expect-compare-agrees-with-equals.ts:17
Asserts that compare and equals agree on every ordered pair drawn from
values: compare(a, b) === 0 exactly when equals(a, b).
Both must be exact for this to hold. An approximate equality is not transitive, so pairing one with an exact comparator lets a container order two elements apart while a dedupe pass calls them the same — the classic source of a set holding two “equal” members.
values must contain no NaN, and no structure holding one: exact equality
reports NaN !== NaN while a total order must place NaN equivalent to
itself, so the two disagree there by design.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”values
Section titled “values”readonly T[]
compare
Section titled “compare”Comparator<T>
equals
Section titled “equals”EqualityComparator<T, T>
Returns
Section titled “Returns”void