Implement reduce and reduceRight functions

- move arrays reduce tests
This commit is contained in:
Alexander Zolotov
2012-06-16 03:43:55 +04:00
parent 0043454a06
commit 6b13f35206
2 changed files with 38 additions and 16 deletions
-9
View File
@@ -222,11 +222,6 @@ class CollectionTest {
list.reduce { a, b -> a + b }
}
expect(-4) {
val array = array(1, 2, 3)
array.reduce { a, b -> a - b }
}
failsWith<UnsupportedOperationException> {
arrayList<Int>().reduce { a, b -> a + b}
}
@@ -237,10 +232,6 @@ class CollectionTest {
val list = arrayList("1", "2", "3", "4")
list.reduceRight { a, b -> a + b }
}
expect(2) {
val array = array(1, 2, 3)
array.reduceRight { a, b -> a - b }
}
failsWith<UnsupportedOperationException> {
arrayList<Int>().reduceRight { a, b -> a + b}