blob: e5d97a9b14a56bb4a9abfbc0595ed1fb9daf88f0 [file] [log] [blame]
// Copyright (c) 2016, 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 Stream.periodic(Duration period,
/// [T computation(int computationCount)])
/// Creates a stream that repeatedly emits events at period intervals.
/// If computation is omitted the event values will all be null.
/// @description Checks Stream interface methods
/// @author a.semenov@unipro.ru
import "dart:async";
import "allTests_A01.lib.dart" as all;
Stream<T> create<T>(Iterable<T> data) {
return new Stream.periodic(
new Duration(milliseconds: 10), (int i) => data.elementAt(i))
.take(data.length);
}
main() {
all.test(create);
}