Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(489)

Side by Side Diff: tests/lib/async/stream_min_max_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/lib/async/stream_controller_test.dart ('k') | tests/lib/async/stream_single_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:async';
6 import 'dart:isolate';
7 import '../../../pkg/unittest/lib/unittest.dart';
8 import 'event_helper.dart';
9
10 const int big = 1000000;
11 const double inf = double.INFINITY;
12 List intList = const [-0, 0, -1, 1, -10, 10, -big, big];
13 List doubleList = const [-0.0, 0.0, -1.0, 1.0, -10.0, 10.0, -inf, inf];
14
15 main() {
16 testMinMax(name, iterable, min, max, [int compare(a, b)]) {
17 test("$name-min", () {
18 StreamController c = new StreamController();
19 Future f = c.min(compare);
20 f.then(expectAsync1((v) { Expect.equals(min, v);}));
21 new Events.fromIterable(iterable).replay(c);
22 });
23 test("$name-max", () {
24 StreamController c = new StreamController();
25 Future f = c.max(compare);
26 f.then(expectAsync1((v) { Expect.equals(max, v);}));
27 new Events.fromIterable(iterable).replay(c);
28 });
29 }
30
31 testMinMax("const-int", intList, -big, big);
32 testMinMax("list-int", intList.toList(), -big, big);
33 testMinMax("set-int", intList.toSet(), -big, big);
34
35 testMinMax("const-double", doubleList, -inf, inf);
36 testMinMax("list-double", doubleList.toList(), -inf, inf);
37 testMinMax("set-double", doubleList.toSet(), -inf, inf);
38
39 int reverse(a, b) => b.compareTo(a);
40 testMinMax("rev-int", intList, big, -big, reverse);
41 testMinMax("rev-double", doubleList, inf, -inf, reverse);
42 }
OLDNEW
« no previous file with comments | « tests/lib/async/stream_controller_test.dart ('k') | tests/lib/async/stream_single_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698