Reformat stdlib tests and samples

#KT-5558
This commit is contained in:
Ilya Gorbunov
2018-04-23 16:18:24 +03:00
parent add09e0f2e
commit ecf0d7ec0d
39 changed files with 389 additions and 284 deletions
@@ -58,16 +58,16 @@ class GroupingTest {
val elements = listOf("foo", "bar", "flea", "zoo", "biscuit")
val result = elements.groupingBy { it.first() }
.fold({ k, _ -> Collector<Char, String>(k)}, { _, acc, e -> acc.accumulateIfEven(e) })
.fold({ k, _ -> Collector<Char, String>(k) }, { _, acc, e -> acc.accumulateIfEven(e) })
val ordered = result.values.sortedBy { it.key }.map { it.toPair() }
assertEquals(listOf('b' to emptyList(), 'f' to listOf("flea"), 'z' to emptyList()), ordered)
val moreElements = listOf("fire", "zero")
val result2 = moreElements.groupingBy { it.first() }
.foldTo(HashMap(result),
{ k, _ -> error("should not be called for $k") },
{ _, acc, e -> acc.accumulateIfEven(e) })
.foldTo(HashMap(result),
{ k, _ -> error("should not be called for $k") },
{ _, acc, e -> acc.accumulateIfEven(e) })
val ordered2 = result2.values.sortedBy { it.key }.map { it.toPair() }
assertEquals(listOf('b' to emptyList(), 'f' to listOf("flea", "fire"), 'z' to listOf("zero")), ordered2)
@@ -101,7 +101,7 @@ class GroupingTest {
assertEquals(mapOf('f' to 2, 'b' to 3, 'a' to 1, 'z' to 2), counts2)
}
/**
/*
@Test fun sumEach() {
val values = listOf("k" to 50, "b" to 20, "k" to 1000 )
val summary = values.groupingBy { it.first }.eachSumOf { it.second }