Add sortedSet and unit test
This commit is contained in:
@@ -81,7 +81,7 @@ class CollectionTest() : TestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
fun testFilterIntoSortedSet() {
|
||||
fun testFilterIntoSet() {
|
||||
// TODO would be nice to avoid the <String>
|
||||
val foo = data.filterTo(hashSet<String>()){it.startsWith("f")}
|
||||
|
||||
@@ -96,6 +96,16 @@ class CollectionTest() : TestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
fun testFilterIntoSortedSet() {
|
||||
// TODO would be nice to avoid the <String>
|
||||
val sorted = data.filterTo(sortedSet<String>()){it.length == 3}
|
||||
assertEquals(2, sorted.size)
|
||||
assertEquals(sortedSet("bar", "foo"), sorted)
|
||||
assertTrue {
|
||||
sorted is TreeSet<String>
|
||||
}
|
||||
}
|
||||
|
||||
fun testFind() {
|
||||
val x = data.find{it.startsWith("x")}
|
||||
assertNull(x)
|
||||
|
||||
Reference in New Issue
Block a user