| Index: test/set_group_test.dart
|
| diff --git a/test/set_group_test.dart b/test/set_group_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..42e6b998e76cd85cb17f3a1b17131ae855c69a48
|
| --- /dev/null
|
| +++ b/test/set_group_test.dart
|
| @@ -0,0 +1,48 @@
|
| +// 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.
|
| +
|
| +import "package:test/test.dart";
|
| +
|
| +import "package:collection/collection.dart";
|
| +
|
| +void main() {
|
| + var group;
|
| + var innerSet;
|
| + setUp(() {
|
| + innerSet = new Set.from([1, 2, 3]);
|
| + group = new SetGroup<int>()..add(innerSet);
|
| + });
|
| +
|
| + test("behaves like a set of sets", () {
|
| + expect(group, unorderedEquals([innerSet]));
|
| + expect(group, contains(innerSet));
|
| +
|
| + var anotherSet = new Set.from([3, 4, 5]);
|
| + expect(group, isNot(contains(anotherSet)));
|
| +
|
| + group.add(anotherSet);
|
| + expect(group, unorderedEquals([innerSet, anotherSet]));
|
| + expect(group, contains(anotherSet));
|
| + });
|
| +
|
| + test("exposes a set group", () {
|
| + expect(group.set, unorderedEquals([1, 2, 3]));
|
| +
|
| + group.add(new Set.from([3, 4, 5]));
|
| + expect(group.set, unorderedEquals([1, 2, 3, 4, 5]));
|
| +
|
| + group.remove(innerSet);
|
| + expect(group.set, unorderedEquals([3, 4, 5]));
|
| + });
|
| +
|
| + test("exposes a disjoint set group", () {
|
| + expect(group.set, unorderedEquals([1, 2, 3]));
|
| +
|
| + group.add(new Set.from([4, 5, 6]));
|
| + expect(group.set, unorderedEquals([1, 2, 3, 4, 5, 6]));
|
| +
|
| + group.remove(innerSet);
|
| + expect(group.set, unorderedEquals([4, 5, 6]));
|
| + });
|
| +}
|
|
|