blob: cfbfd56f84dd00a4b9cf185dee49051e9617b4b8 [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.
/// @assertion void removeWhere(bool test(E element))
/// The [test] function must not throw or modify the queue.
/// @description Checks case when test function clears the queue
/// @note See While spec reads
/// that [test] function must not modify the queue it is expensive to check it
/// every time. So, let's test the current implementation. When element is
/// removed by [removeWhere] it must still be in the queue
/// @author
/// @issue 27920
import "dart:collection";
import "../../../Utils/expect.dart";
List list = [1, 3, 3, 4, 5, 6];
DoubleLinkedQueue? queue;
bool testClear1(var element) {
return element == 1;
bool testClear2(var element) {
return false;
bool testClear3(var element) {
return true;
check(bool test(var element), List list) {
queue = new DoubleLinkedQueue.from(list);
Expect.throws(() {queue?.removeWhere(test);});
main() {
check(testClear1, list);
check(testClear2, list);
check(testClear3, list);