OLD | NEW |
(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 } |
OLD | NEW |