Stdlib: run all stdlib tests with JS backend(as possible).

This commit is contained in:
Zalim Bashorov
2014-10-10 17:10:17 +04:00
parent f20ee6df4b
commit f202ad9f98
18 changed files with 252 additions and 208 deletions
-31
View File
@@ -1,6 +1,5 @@
package test.compare
import java.util.Comparator
import kotlin.test.*
import org.junit.Test
@@ -35,34 +34,4 @@ class CompareTest {
val diff = compareBy(v1, v1, { rating }, { name })
assertTrue(diff == 0)
}
Test fun sortUsingComparatorHelperMethod() {
val c = comparator<Item>({ rating }, { name })
println("Created comparator $c")
val diff = c.compare(v1, v2)
assertTrue(diff < 0)
val items = arrayListOf(v1, v2)
items.sortBy(c)
println("Sorted list in rating order $items")
}
Test fun sortUsingCustomComparator() {
val c = object : Comparator<Item>{
override fun compare(o1: Item, o2: Item): Int {
return compareBy(o1, o2, { name }, { rating })
}
override fun equals(obj: Any?): Boolean {
return this == obj
}
}
println("Created comparator $c")
val diff = c.compare(v1, v2)
assertTrue(diff > 0)
val items = arrayListOf(v1, v2)
items.sortBy(c)
println("Sorted list in rating order $items")
}
}