blob: 1e0a185254bc0e9036702609b6966a61bda26d29 [file] [log] [blame]
// Copyright (c) 2011, 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.
/// @assertion void add(T value)
/// Adds [value] into the set. The method has no effect if [value] was already
/// in the set.
/// @description Checks correctness of the set after rehashing (triggered by add()).
/// @author pagolubev
library add_A01_t04;
import "set.lib.dart";
import "../../../Utils/expect.dart";
test(Set create([Set content])) {
Set s = create();
s.addAll([-1, -3, -2, -5, -6]);
Expect.isTrue(s.length == 5);
Expect.isTrue(s.containsAll([-1, -3, -2, -5, -6]));
List a = [-1, -3, -2, -5, -6];
for(int i = 0; i < 1000; i++) {
s.add(i);
Expect.isTrue(s.contains(i));
Expect.isTrue(s.containsAll(a));
Expect.isTrue(s.length == 6 + i);
}
}
main() {
test(create);
}