Simplify min/max implementation

This commit is contained in:
Ilya Gorbunov
2020-05-22 01:10:05 +03:00
parent b4ba00ca36
commit d19f9ee0c5
5 changed files with 33 additions and 63 deletions
@@ -832,6 +832,9 @@ class CollectionTest {
expect("a", { listOf("a", "b").min() })
expect(null, { listOf<Int>().asSequence().min() })
expect(2, { listOf(2, 3).asSequence().min() })
assertIsNegativeZero(listOf(0.0, -0.0).shuffled().min()!!)
assertIsNegativeZero(listOf(0.0F, -0.0F).shuffled().min()!!.toDouble())
}
@Test fun max() {
@@ -843,6 +846,9 @@ class CollectionTest {
expect("b", { listOf("a", "b").max() })
expect(null, { listOf<Int>().asSequence().max() })
expect(3, { listOf(2, 3).asSequence().max() })
assertIsPositiveZero(listOf(0.0, -0.0).shuffled().max()!!)
assertIsPositiveZero(listOf(0.0F, -0.0F).shuffled().max()!!.toDouble())
}
@Test fun minWith() {