blob: c14fcc99b0bdc109c9de5c9b3e2553fea75c9962 [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.
// @dart = 2.9
/// @assertion LinkedHashMap.fromIterable(Iterable iterable,
/// {K key(element), V value(element)})
/// ...
/// If no values are specified for [key] and [value] the default is the identity
/// function
/// @description Checks that if no values are specified for key and value the
/// default is the identity function
/// @author sgrekhov@unipro.ru
import "../../../Utils/expect.dart";
import "dart:collection";
check(Iterable it, Iterable expected) {
LinkedHashMap m = new LinkedHashMap.fromIterable(it);
Expect.equals(expected.length, m.length);
for (var v in expected) {
Expect.equals(v, m[v]);
}
}
class C {}
main() {
var o1 = new Object();
var o2 = new Object();
C c1 = new C();
C c2 = new C();
check([o1, o2, c1, c2], [o1, o2, c1, c2]);
check([null, null], [null]);
}