From 7ca582719b1093707d382ebf5cc4445ee6be7543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 28 Jan 2018 15:12:32 +0100 Subject: [PATCH] Tests for Cursor.reduce(into:_:) --- Tests/GRDBTests/CursorTests.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tests/GRDBTests/CursorTests.swift b/Tests/GRDBTests/CursorTests.swift index d49d6defe..155d5daa4 100644 --- a/Tests/GRDBTests/CursorTests.swift +++ b/Tests/GRDBTests/CursorTests.swift @@ -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])