blob: 47cc80dbceaac8110a9228e17dfc06ddba532001 [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 bool remove(E entry)
/// Remove [entry] from the linked list.
/// @description Checks that [remove] does not break iteration order of the
/// linked list.
/// @author
import "../../../Utils/expect.dart";
import "dart:collection";
import "LinkedList.lib.dart";
check(LinkedList<MyLinkedListEntry> llist,
MyLinkedListEntry<Object> entry) {
List initial = llist.toList();
int i = 0;
llist.forEach((MyLinkedListEntry elem) {
if(initial[i] == entry) {
Expect.equals(initial[i++], elem);
main() {
LinkedList<MyLinkedListEntry<int>> a = new LinkedList<MyLinkedListEntry<int>>();
MyLinkedListEntry<int> entry = new MyLinkedListEntry<int>(2);
check(a, entry);
a.add(new MyLinkedListEntry(28));
a.add(new MyLinkedListEntry(2));
a.add(new MyLinkedListEntry(2));
a.add(new MyLinkedListEntry(-11));
a.add(new MyLinkedListEntry(0));
check(a, entry);
check(a, entry);