blob: 97d85dce9b781fbef5426fa826a8ca7169b14871 [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 abstract void setRange(int start, int end, Iterable<E> iterable,
* [int skipCount = 0])
* Copies the elements of iterable, skipping the skipCount first elements into
* the range start to end exclusive of this.
* If start equals end and represent a legal range, this method has no effect.
* It is an error if start.. end is not a valid range pointing into the this.
* It is an error if the iterable does not have enough elements after skipping
* skipCount elements.
* @description Checks that all needed elements are copied.
* @author iefremov
*/
library setRange_A01_t02;
import "../../../Utils/expect.dart";
check(List dst, var def) {
List src = [dst, null];
src[1] = src;
dst.setRange(0, 2, src);
Expect.listEquals([dst, src, def, def, def], dst);
dst.setRange(4, 5, src);
Expect.listEquals([dst, src, def, def, dst], dst);
dst.setRange(2, 4, src);
Expect.listEquals([dst, src, dst, src, dst], dst);
}
test(List<E> create<E>([int length, E fill])) {
check(create<dynamic>(5, 0), 0);
List a = create();
a.length = 5;
check(a, null);
}