Move comparison related functions to kotlin.comparisons, update imports in stdlib.

This commit is contained in:
Ilya Gorbunov
2016-01-16 16:00:36 +03:00
parent c250921643
commit 67ef790abc
20 changed files with 353 additions and 2 deletions
+1
View File
@@ -3,6 +3,7 @@ package test.compare
import java.util.*
import kotlin.test.*
import org.junit.Test
import kotlin.comparisons.*
data class Item(val name: String, val rating: Int) : Comparable<Item> {
public override fun compareTo(other: Item): Int {
@@ -5,6 +5,7 @@ import test.compare.STRING_CASE_INSENSITIVE_ORDER
import java.util.*
import kotlin.test.*
import org.junit.Test as test
import kotlin.comparisons.*
fun <T> assertArrayNotSameButEquals(expected: Array<out T>, actual: Array<out T>, message: String = "") { assertTrue(expected !== actual, message); assertEquals(expected.toList(), actual.toList(), message) }
fun assertArrayNotSameButEquals(expected: IntArray, actual: IntArray, message: String = "") { assertTrue(expected !== actual, message); assertEquals(expected.toList(), actual.toList(), message) }
@@ -5,7 +5,7 @@ import java.io.ByteArrayOutputStream
import java.io.ObjectInputStream
import java.io.ObjectOutputStream
import kotlin.test.*
import kotlin.comparisons.*
import java.util.*
import org.junit.Test as test
@@ -6,6 +6,7 @@ import org.junit.Test as test
import test.collections.behaviors.*
import test.compare.STRING_CASE_INSENSITIVE_ORDER
import java.io.Serializable
import kotlin.comparisons.*
class CollectionTest {
@@ -2,6 +2,7 @@ package test.collections.binarySearch
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.comparisons.*
class ListBinarySearchTest {
@@ -6,6 +6,7 @@ import kotlin.test.assertEquals
import kotlin.test.assertFails
import kotlin.test.expect
import org.junit.Test as test
import kotlin.comparisons.*
class MapJVMTest {
@test fun createSortedMap() {
@@ -4,6 +4,7 @@ import org.junit.Test as test
import org.junit.Test
import kotlin.test.*
import java.util.*
import kotlin.comparisons.*
fun fibonacci(): Sequence<Int> {
// fibonacci terms
@@ -5,6 +5,7 @@ import java.util.ArrayList
import kotlin.test.*
import org.junit.Test as test
import kotlin.comparisons.*
fun <T> List<T>.toArrayList() = this.toCollection(ArrayList<T>())