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

Side by Side Diff: test/set_group_test.dart

Issue 1873373002: Add GroupSet and SetGroup classes. (Closed) Base URL: git@github.com:dart-lang/collection@master
Patch Set: Code review changes Created 4 years, 8 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
« lib/src/set_group.dart ('K') | « test/group_set_test.dart ('k') | no next file » | 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) 2016, 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 "package:test/test.dart";
6
7 import "package:collection/collection.dart";
8
9 void main() {
10 var group;
11 var innerSet;
12 setUp(() {
13 innerSet = new Set.from([1, 2, 3]);
14 group = new SetGroup<int>()..add(innerSet);
15 });
16
17 test("behaves like a set of sets", () {
18 expect(group, unorderedEquals([innerSet]));
19 expect(group, contains(innerSet));
20
21 var anotherSet = new Set.from([3, 4, 5]);
22 expect(group, isNot(contains(anotherSet)));
23
24 group.add(anotherSet);
25 expect(group, unorderedEquals([innerSet, anotherSet]));
26 expect(group, contains(anotherSet));
27 });
28
29 test("exposes a set group", () {
30 expect(group.set, unorderedEquals([1, 2, 3]));
31
32 group.add(new Set.from([3, 4, 5]));
33 expect(group.set, unorderedEquals([1, 2, 3, 4, 5]));
34
35 group.remove(innerSet);
36 expect(group.set, unorderedEquals([3, 4, 5]));
37 });
38
39 test("exposes a disjoint set group", () {
40 expect(group.set, unorderedEquals([1, 2, 3]));
41
42 group.add(new Set.from([4, 5, 6]));
43 expect(group.set, unorderedEquals([1, 2, 3, 4, 5, 6]));
44
45 group.remove(innerSet);
46 expect(group.set, unorderedEquals([4, 5, 6]));
47 });
48 }
OLDNEW
« lib/src/set_group.dart ('K') | « test/group_set_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698