| /* |
| * Copyright (c) 2013, 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 fillRange(int start, int end, [E fill]) |
| * Sets the objects in the range start inclusive to end exclusive to the given |
| * fillValue. |
| * The provide range, given by start and end, must be valid. A range from start |
| * to end is valid if 0 <= start <= end <= len, where len is this list's length. |
| * The range starts at start and has length end - start. An empty range (with |
| * end == start) is valid. |
| * @description Checks that the given range is filled with [fill] value. |
| * @author msyabro |
| */ |
| |
| import "dart:typed_data"; |
| import "../../../Utils/expect.dart"; |
| |
| main() { |
| var l = new Float32List(1000); |
| l.fillRange(0, 10, 1.0); |
| for (int i = 0; i < 10; ++i) { |
| Expect.equals(1.0, l[i]); |
| } |
| Expect.equals(0, l[10], "[end] should be exclusive"); |
| |
| l.fillRange(100, 200, 55.0); |
| for (int i = 100; i < 200; ++i) { |
| Expect.equals(55.0, l[i]); |
| } |
| Expect.equals(0, l[200], "[end] should be exclusive"); |
| |
| l.fillRange(0, 1000, 1.0); |
| for (int i = 0; i < 1000; ++i) { |
| Expect.equals(1.0, l[i]); |
| } |
| |
| l.fillRange(0, 0, 2.0); |
| for (int i = 0; i < 1000; ++i) { |
| Expect.equals(1.0, l[i]); |
| } |
| } |