Tests for Cursor.reduce(into:_:)

This commit is contained in:
Gwendal Roué committed 2018-01-28 17:13:51 +01:00
1 parent e4b83baa53
commit 7ca582719b
1 file changed
+6
+6
View File
@@ -126,6 +126,12 @@ class CursorTests: GRDBTestCase {
XCTAssertEqual(squareSum, 5)
}
func testReduceInto() throws {
let cursor = IteratorCursor([1, 2])
let squareSum = try cursor.reduce(into: 0) { (acc, int) in acc += int * int }
XCTAssertEqual(squareSum, 5)
}
func testSuffix() throws {
do {
let cursor = IteratorCursor([1, 2, 3, 4, 5])