kotest-assertions-core / io.kotest.matchers.comparables / shouldBeEqualComparingTo

shouldBeEqualComparingTo

infix fun <T : Comparable<T>> T.shouldBeEqualComparingTo(other: T): Unit

Verifies that this is equal to other using compareTo

Opposite of shouldNotBeEqualComparingTo

This function will check for the result of Comparable.compareTo and result accordingly. This will pass if the value is equal to other (compareTo returns 0).

fun <T : Comparable<T>> T.shouldBeEqualComparingTo(other: T, comparator: Comparator<T>): Unit

Verifies that this is equal to other using compare from comparator

This function will check for the result of comparator.compare and result accordingly. This will pass if the value is equal to other (compare returns 0).