blob: ff8c95a7cafc95ad917931edb73afb769d16f59f [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.
import "package:test/test.dart";
import "package:collection/collection.dart";
void main() {
UnionSetController<int> controller;
Set<int> innerSet;
setUp(() {
innerSet = Set.from([1, 2, 3]);
controller = UnionSetController()..add(innerSet);
});
test("exposes a union set", () {
expect(controller.set, unorderedEquals([1, 2, 3]));
controller.add(Set.from([3, 4, 5]));
expect(controller.set, unorderedEquals([1, 2, 3, 4, 5]));
controller.remove(innerSet);
expect(controller.set, unorderedEquals([3, 4, 5]));
});
test("exposes a disjoint union set", () {
expect(controller.set, unorderedEquals([1, 2, 3]));
controller.add(Set.from([4, 5, 6]));
expect(controller.set, unorderedEquals([1, 2, 3, 4, 5, 6]));
controller.remove(innerSet);
expect(controller.set, unorderedEquals([4, 5, 6]));
});
}