blob: 1f4abc48e04c16addfea9b368b0d17ea459ed899 [file] [log] [blame]
// Copyright (c) 2017, 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 UnmodifiableMapView(Map<K, V> map)
/// @description Checks that default constructor creates a [UnmodifiableMapView].
/// @author iarkh@unipro.ru
import "dart:collection";
import "../../../Utils/expect.dart";
check(Map map) {
UnmodifiableMapView view = new UnmodifiableMapView(map);
Expect.equals(map.isEmpty, view.isEmpty);
Expect.equals(map.length, view.length);
map.forEach ((var key, var value) {
Expect.identical(view[key], value);
});
Expect.listEquals(map.keys.toList(), view.keys.toList());
Expect.listEquals(map.values.toList(), view.values.toList());
}
main() {
HashMap map = new HashMap();
check(map);
map.addAll(
{1 : 0, 2 : 2, 3.0 : null, "testme" : "test", new Object(): "12345"});
check(map);
}