blob: 0efee0280640291cda5279cd567f91bf6d98a7f5 [file] [log] [blame]
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/**
* @assertion Future<T> reduce(T combine(T previous, T element))
* Reduces a sequence of values by repeatedly applying combine.
* @description Checks that the result is correct.
* @author kaigorodov
*/
library reduce_A01_t01;
import "../../../Utils/expect.dart";
void test(CreateStreamFunction create) {
AsyncExpect.value(10, create([1, 2, 3, 4]).reduce((int p, int e) => p + e));
AsyncExpect.value(24, create([1, 2, 3, 4]).reduce((int p, int e) => p * e));
}