Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Unified Diff: runtime/tests/vm/dart/byte_array_test.dart

Issue 2759973004: Fix observatory tests broken by running dartfmt. Temporarily reverted formatting for evaluate_activ… (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/tests/vm/dart/byte_array_test.dart
diff --git a/runtime/tests/vm/dart/byte_array_test.dart b/runtime/tests/vm/dart/byte_array_test.dart
index 048e2e72b6c81d1eb6dd339c4d091c46a537d7d6..26e2b68776ea8d64a2eb414eb05e40459f7638f7 100644
--- a/runtime/tests/vm/dart/byte_array_test.dart
+++ b/runtime/tests/vm/dart/byte_array_test.dart
@@ -15,59 +15,79 @@ class ByteArrayTest {
Expect.equals(10, array.length);
Expect.equals(1, array.elementSizeInBytes);
Expect.equals(10, array.lengthInBytes);
- Expect.listEquals([0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0],
- array);
- Expect.throws(() { array[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return array[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { array.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeRange(0, array.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([0, 0, 0, 0, 0, 0, 0, 0, 0, 0], array);
+ Expect.throws(() {
+ array[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return array[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeRange(0, array.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < array.length; ++i) {
array[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0x100 + i;
}
- Expect.listEquals([0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], array);
for (int i = 0; i < array.length; ++i) {
array[i] = -10 + i;
}
- Expect.listEquals([-10, -9, -8, -7, -6,
- -5, -4, -3, -2, -1],
- array);
+ Expect.listEquals([-10, -9, -8, -7, -6, -5, -4, -3, -2, -1], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0x7F - i;
}
- Expect.listEquals([127, 126, 125, 124, 123,
- 122, 121, 120, 119, 118],
- array);
+ Expect
+ .listEquals([127, 126, 125, 124, 123, 122, 121, 120, 119, 118], array);
for (int i = 0; i < array.length; ++i) {
array[i] = -0x80 + i;
}
- Expect.listEquals([-128, -127, -126, -125, -124,
- -123, -122, -121, -120, -119],
- array);
+ Expect.listEquals(
+ [-128, -127, -126, -125, -124, -123, -122, -121, -120, -119], array);
for (int i = 0; i < array.length; ++i) {
array[i] = i;
}
@@ -86,12 +106,15 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
array.setRange(3, 7, [-128, 0, 1, 127]);
- Expect.listEquals([0, 1, 2, -128, 0, 1, 127, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, -128, 0, 1, 127, 7, 8, 9], array);
}
+
static testInt8List() {
- Expect.throws(() { new Int8List(-1); },
- (e) { return e is ArgumentError; });
+ Expect.throws(() {
+ new Int8List(-1);
+ }, (e) {
+ return e is ArgumentError;
+ });
var array = new Int8List(10);
testInt8ListImpl(array);
}
@@ -101,47 +124,70 @@ class ByteArrayTest {
Expect.equals(10, array.length);
Expect.equals(1, array.elementSizeInBytes);
Expect.equals(10, array.lengthInBytes);
- Expect.listEquals([0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0],
- array);
- Expect.throws(() { array[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return array[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { array.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeRange(0, array.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([0, 0, 0, 0, 0, 0, 0, 0, 0, 0], array);
+ Expect.throws(() {
+ array[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return array[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeRange(0, array.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < array.length; ++i) {
array[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0x100 + i;
}
- Expect.listEquals([0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0xFF - i;
}
- Expect.listEquals([0xFF, 0xFE, 0xFD, 0xFC, 0xFB,
- 0xFA, 0xF9, 0xF8, 0xF7, 0xF6],
- array);
+ Expect.listEquals(
+ [0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8, 0xF7, 0xF6], array);
for (int i = 0; i < array.length; ++i) {
array[i] = i;
}
@@ -160,13 +206,15 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
array.setRange(3, 7, [257, 0, 1, 255]);
- Expect.listEquals([0, 1, 2, 1, 0, 1, 255, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, 1, 0, 1, 255, 7, 8, 9], array);
}
static testUint8List() {
- Expect.throws(() { new Uint8List(-1); },
- (e) { return e is ArgumentError; });
+ Expect.throws(() {
+ new Uint8List(-1);
+ }, (e) {
+ return e is ArgumentError;
+ });
var array = new Uint8List(10);
testUint8ListImpl(array);
}
@@ -176,29 +224,57 @@ class ByteArrayTest {
Expect.equals(10, array.length);
Expect.equals(1, array.elementSizeInBytes);
Expect.equals(10, array.lengthInBytes);
- Expect.listEquals([0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0],
- array);
- Expect.throws(() { array[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return array[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { array.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeRange(0, array.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([0, 0, 0, 0, 0, 0, 0, 0, 0, 0], array);
+ Expect.throws(() {
+ array[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return array[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeRange(0, array.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < array.length; ++i) {
array[i] = -1 + i;
}
@@ -206,14 +282,13 @@ class ByteArrayTest {
for (int i = 0; i < array.length; ++i) {
array[i] = 0x100 + i;
}
- Expect.listEquals([255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
- array);
+ Expect
+ .listEquals([255, 255, 255, 255, 255, 255, 255, 255, 255, 255], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0xFF - i;
}
- Expect.listEquals([0xFF, 0xFE, 0xFD, 0xFC, 0xFB,
- 0xFA, 0xF9, 0xF8, 0xF7, 0xF6],
- array);
+ Expect.listEquals(
+ [0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8, 0xF7, 0xF6], array);
for (int i = 0; i < array.length; ++i) {
array[i] = i;
}
@@ -236,8 +311,11 @@ class ByteArrayTest {
}
static testUint8ClampedList() {
- Expect.throws(() { new Uint8ClampedList(-1); },
- (e) { return e is ArgumentError; });
+ Expect.throws(() {
+ new Uint8ClampedList(-1);
+ }, (e) {
+ return e is ArgumentError;
+ });
var array = new Uint8ClampedList(10);
testUint8ClampedListImpl(array);
}
@@ -247,59 +325,99 @@ class ByteArrayTest {
Expect.equals(10, array.length);
Expect.equals(2, array.elementSizeInBytes);
Expect.equals(20, array.lengthInBytes);
- Expect.listEquals([0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0],
- array);
- Expect.throws(() { array[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return array[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { array.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeRange(0, array.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([0, 0, 0, 0, 0, 0, 0, 0, 0, 0], array);
+ Expect.throws(() {
+ array[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return array[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeRange(0, array.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < array.length; ++i) {
array[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0x10000 + i;
}
- Expect.listEquals([0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], array);
for (int i = 0; i < array.length; ++i) {
array[i] = -10 + i;
}
- Expect.listEquals([-10, -9, -8, -7, -6,
- -5, -4, -3, -2, -1],
- array);
+ Expect.listEquals([-10, -9, -8, -7, -6, -5, -4, -3, -2, -1], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0x7FFF - i;
}
- Expect.listEquals([0x7FFF, 0x7FFE, 0x7FFD, 0x7FFC, 0x7FFB,
- 0x7FFA, 0x7FF9, 0x7FF8, 0x7FF7, 0x7FF6],
- array);
+ Expect.listEquals([
+ 0x7FFF,
+ 0x7FFE,
+ 0x7FFD,
+ 0x7FFC,
+ 0x7FFB,
+ 0x7FFA,
+ 0x7FF9,
+ 0x7FF8,
+ 0x7FF7,
+ 0x7FF6
+ ], array);
for (int i = 0; i < array.length; ++i) {
array[i] = -0x8000 + i;
}
- Expect.listEquals([-0x8000, -0x7FFF, -0x7FFE, -0x7FFD, -0x7FFC,
- -0x7FFB, -0x7FFA, -0x7FF9, -0x7FF8, -0x7FF7],
- array);
+ Expect.listEquals([
+ -0x8000,
+ -0x7FFF,
+ -0x7FFE,
+ -0x7FFD,
+ -0x7FFC,
+ -0x7FFB,
+ -0x7FFA,
+ -0x7FF9,
+ -0x7FF8,
+ -0x7FF7
+ ], array);
for (int i = 0; i < array.length; ++i) {
array[i] = i;
}
@@ -318,13 +436,15 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
array.setRange(3, 7, [-32768, 0, 1, 32767]);
- Expect.listEquals([0, 1, 2, -32768, 0, 1, 32767, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, -32768, 0, 1, 32767, 7, 8, 9], array);
}
static testInt16List() {
- Expect.throws(() { new Int16List(-1); },
- (e) { return e is ArgumentError; });
+ Expect.throws(() {
+ new Int16List(-1);
+ }, (e) {
+ return e is ArgumentError;
+ });
var array = new Int16List(10);
testInt16ListImpl(array);
}
@@ -334,47 +454,80 @@ class ByteArrayTest {
Expect.equals(10, array.length);
Expect.equals(2, array.elementSizeInBytes);
Expect.equals(20, array.lengthInBytes);
- Expect.listEquals([0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0],
- array);
- Expect.throws(() { array[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return array[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { array.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeRange(0, array.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([0, 0, 0, 0, 0, 0, 0, 0, 0, 0], array);
+ Expect.throws(() {
+ array[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return array[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeRange(0, array.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < array.length; ++i) {
array[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0x10000 + i;
}
- Expect.listEquals([0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0xFFFF - i;
}
- Expect.listEquals([0xFFFF, 0xFFFE, 0xFFFD, 0xFFFC, 0xFFFB,
- 0xFFFA, 0xFFF9, 0xFFF8, 0xFFF7, 0xFFF6],
- array);
+ Expect.listEquals([
+ 0xFFFF,
+ 0xFFFE,
+ 0xFFFD,
+ 0xFFFC,
+ 0xFFFB,
+ 0xFFFA,
+ 0xFFF9,
+ 0xFFF8,
+ 0xFFF7,
+ 0xFFF6
+ ], array);
for (int i = 0; i < array.length; ++i) {
array[i] = i;
}
@@ -393,13 +546,15 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
array.setRange(3, 7, [0x10001, 0, 1, 0xFFFF]);
- Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFF, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFF, 7, 8, 9], array);
}
static testUint16List() {
- Expect.throws(() { new Uint16List(-1); },
- (e) { return e is ArgumentError; });
+ Expect.throws(() {
+ new Uint16List(-1);
+ }, (e) {
+ return e is ArgumentError;
+ });
var array = new Uint16List(10);
testUint16ListImpl(array);
}
@@ -409,65 +564,99 @@ class ByteArrayTest {
Expect.equals(10, array.length);
Expect.equals(4, array.elementSizeInBytes);
Expect.equals(40, array.lengthInBytes);
- Expect.listEquals([0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0],
- array);
- Expect.throws(() { array[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return array[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { array.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeRange(0, array.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([0, 0, 0, 0, 0, 0, 0, 0, 0, 0], array);
+ Expect.throws(() {
+ array[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return array[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeRange(0, array.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < array.length; ++i) {
array[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0x100000000 + i;
}
- Expect.listEquals([0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], array);
for (int i = 0; i < array.length; ++i) {
array[i] = -10 + i;
}
- Expect.listEquals([-10, -9, -8, -7, -6,
- -5, -4, -3, -2, -1],
- array);
+ Expect.listEquals([-10, -9, -8, -7, -6, -5, -4, -3, -2, -1], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0x7FFFFFFF - i;
}
- Expect.listEquals([0x7FFFFFFF, 0x7FFFFFFE,
- 0x7FFFFFFD, 0x7FFFFFFC,
- 0x7FFFFFFB, 0x7FFFFFFA,
- 0x7FFFFFF9, 0x7FFFFFF8,
- 0x7FFFFFF7, 0x7FFFFFF6],
- array);
+ Expect.listEquals([
+ 0x7FFFFFFF,
+ 0x7FFFFFFE,
+ 0x7FFFFFFD,
+ 0x7FFFFFFC,
+ 0x7FFFFFFB,
+ 0x7FFFFFFA,
+ 0x7FFFFFF9,
+ 0x7FFFFFF8,
+ 0x7FFFFFF7,
+ 0x7FFFFFF6
+ ], array);
for (int i = 0; i < array.length; ++i) {
array[i] = -0x80000000 + i;
}
- Expect.listEquals([-0x80000000, -0x7FFFFFFF,
- -0x7FFFFFFE, -0x7FFFFFFD,
- -0x7FFFFFFC, -0x7FFFFFFB,
- -0x7FFFFFFA, -0x7FFFFFF9,
- -0x7FFFFFF8, -0x7FFFFFF7],
- array);
+ Expect.listEquals([
+ -0x80000000,
+ -0x7FFFFFFF,
+ -0x7FFFFFFE,
+ -0x7FFFFFFD,
+ -0x7FFFFFFC,
+ -0x7FFFFFFB,
+ -0x7FFFFFFA,
+ -0x7FFFFFF9,
+ -0x7FFFFFF8,
+ -0x7FFFFFF7
+ ], array);
for (int i = 0; i < array.length; ++i) {
array[i] = i;
}
@@ -486,13 +675,15 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
array.setRange(3, 7, [-0x80000000, 0, 1, 0x7FFFFFFF]);
- Expect.listEquals([0, 1, 2, -0x80000000, 0, 1, 0x7FFFFFFF, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, -0x80000000, 0, 1, 0x7FFFFFFF, 7, 8, 9], array);
}
static testInt32List() {
- Expect.throws(() { new Int32List(-1); },
- (e) { return e is ArgumentError; });
+ Expect.throws(() {
+ new Int32List(-1);
+ }, (e) {
+ return e is ArgumentError;
+ });
var array = new Int32List(10);
testInt32ListImpl(array);
}
@@ -502,50 +693,80 @@ class ByteArrayTest {
Expect.equals(10, array.length);
Expect.equals(4, array.elementSizeInBytes);
Expect.equals(40, array.lengthInBytes);
- Expect.listEquals([0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0],
- array);
- Expect.throws(() { array[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return array[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { array.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeRange(0, array.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([0, 0, 0, 0, 0, 0, 0, 0, 0, 0], array);
+ Expect.throws(() {
+ array[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return array[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeRange(0, array.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < array.length; ++i) {
array[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0x100000000 + i;
}
- Expect.listEquals([0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0xFFFFFFFF - i;
}
- Expect.listEquals([0xFFFFFFFF, 0xFFFFFFFE,
- 0xFFFFFFFD, 0xFFFFFFFC,
- 0xFFFFFFFB, 0xFFFFFFFA,
- 0xFFFFFFF9, 0xFFFFFFF8,
- 0xFFFFFFF7, 0xFFFFFFF6],
- array);
+ Expect.listEquals([
+ 0xFFFFFFFF,
+ 0xFFFFFFFE,
+ 0xFFFFFFFD,
+ 0xFFFFFFFC,
+ 0xFFFFFFFB,
+ 0xFFFFFFFA,
+ 0xFFFFFFF9,
+ 0xFFFFFFF8,
+ 0xFFFFFFF7,
+ 0xFFFFFFF6
+ ], array);
for (int i = 0; i < array.length; ++i) {
array[i] = i;
}
@@ -564,18 +785,22 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
array.setRange(3, 7, [0x100000001, 0, 1, 0xFFFFFFFF]);
- Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFF, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFF, 7, 8, 9], array);
}
static testUint32List() {
- Expect.throws(() { new Uint32List(-1); },
- (e) { return e is ArgumentError; });
- Expect.throws(() { new Uint32List(-1); },
- (e) { return e is ArgumentError; });
+ Expect.throws(() {
+ new Uint32List(-1);
+ }, (e) {
+ return e is ArgumentError;
+ });
+ Expect.throws(() {
+ new Uint32List(-1);
+ }, (e) {
+ return e is ArgumentError;
+ });
var array = new Uint32List(10);
testUint32ListImpl(array);
-
}
static testInt64ListImpl(Int64List array) {
@@ -583,65 +808,99 @@ class ByteArrayTest {
Expect.equals(10, array.length);
Expect.equals(8, array.elementSizeInBytes);
Expect.equals(80, array.lengthInBytes);
- Expect.listEquals([0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0],
- array);
- Expect.throws(() { array[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return array[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { array.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeRange(0, array.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([0, 0, 0, 0, 0, 0, 0, 0, 0, 0], array);
+ Expect.throws(() {
+ array[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return array[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeRange(0, array.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < array.length; ++i) {
array[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0x10000000000000000 + i;
}
- Expect.listEquals([0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], array);
for (int i = 0; i < array.length; ++i) {
array[i] = -10 + i;
}
- Expect.listEquals([-10, -9, -8, -7, -6,
- -5, -4, -3, -2, -1],
- array);
+ Expect.listEquals([-10, -9, -8, -7, -6, -5, -4, -3, -2, -1], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0x7FFFFFFFFFFFFFFF - i;
}
- Expect.listEquals([0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFE,
- 0x7FFFFFFFFFFFFFFD, 0x7FFFFFFFFFFFFFFC,
- 0x7FFFFFFFFFFFFFFB, 0x7FFFFFFFFFFFFFFA,
- 0x7FFFFFFFFFFFFFF9, 0x7FFFFFFFFFFFFFF8,
- 0x7FFFFFFFFFFFFFF7, 0x7FFFFFFFFFFFFFF6],
- array);
+ Expect.listEquals([
+ 0x7FFFFFFFFFFFFFFF,
+ 0x7FFFFFFFFFFFFFFE,
+ 0x7FFFFFFFFFFFFFFD,
+ 0x7FFFFFFFFFFFFFFC,
+ 0x7FFFFFFFFFFFFFFB,
+ 0x7FFFFFFFFFFFFFFA,
+ 0x7FFFFFFFFFFFFFF9,
+ 0x7FFFFFFFFFFFFFF8,
+ 0x7FFFFFFFFFFFFFF7,
+ 0x7FFFFFFFFFFFFFF6
+ ], array);
for (int i = 0; i < array.length; ++i) {
array[i] = -0x8000000000000000 + i;
}
- Expect.listEquals([-0x8000000000000000, -0x7FFFFFFFFFFFFFFF,
- -0x7FFFFFFFFFFFFFFE, -0x7FFFFFFFFFFFFFFD,
- -0x7FFFFFFFFFFFFFFC, -0x7FFFFFFFFFFFFFFB,
- -0x7FFFFFFFFFFFFFFA, -0x7FFFFFFFFFFFFFF9,
- -0x7FFFFFFFFFFFFFF8, -0x7FFFFFFFFFFFFFF7],
- array);
+ Expect.listEquals([
+ -0x8000000000000000,
+ -0x7FFFFFFFFFFFFFFF,
+ -0x7FFFFFFFFFFFFFFE,
+ -0x7FFFFFFFFFFFFFFD,
+ -0x7FFFFFFFFFFFFFFC,
+ -0x7FFFFFFFFFFFFFFB,
+ -0x7FFFFFFFFFFFFFFA,
+ -0x7FFFFFFFFFFFFFF9,
+ -0x7FFFFFFFFFFFFFF8,
+ -0x7FFFFFFFFFFFFFF7
+ ], array);
for (int i = 0; i < array.length; ++i) {
array[i] = i;
}
@@ -660,14 +919,17 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
array.setRange(3, 7, [-0x8000000000000000, 0, 1, 0x7FFFFFFFFFFFFFFF]);
- Expect.listEquals([0, 1, 2, -0x8000000000000000, 0,
- 1, 0x7FFFFFFFFFFFFFFF, 7, 8, 9],
- array);
+ Expect.listEquals(
+ [0, 1, 2, -0x8000000000000000, 0, 1, 0x7FFFFFFFFFFFFFFF, 7, 8, 9],
+ array);
}
static testInt64List() {
- Expect.throws(() { new Int64List(-1); },
- (e) { return e is ArgumentError; });
+ Expect.throws(() {
+ new Int64List(-1);
+ }, (e) {
+ return e is ArgumentError;
+ });
var array = new Int64List(10);
testInt64ListImpl(array);
}
@@ -677,50 +939,80 @@ class ByteArrayTest {
Expect.equals(10, array.length);
Expect.equals(8, array.elementSizeInBytes);
Expect.equals(80, array.lengthInBytes);
- Expect.listEquals([0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0],
- array);
- Expect.throws(() { array[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return array[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { array.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeRange(0, array.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([0, 0, 0, 0, 0, 0, 0, 0, 0, 0], array);
+ Expect.throws(() {
+ array[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return array[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeRange(0, array.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < array.length; ++i) {
array[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0x10000000000000000 + i;
}
- Expect.listEquals([0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], array);
for (int i = 0; i < array.length; ++i) {
array[i] = 0xFFFFFFFFFFFFFFFF - i;
}
- Expect.listEquals([0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFE,
- 0xFFFFFFFFFFFFFFFD, 0xFFFFFFFFFFFFFFFC,
- 0xFFFFFFFFFFFFFFFB, 0xFFFFFFFFFFFFFFFA,
- 0xFFFFFFFFFFFFFFF9, 0xFFFFFFFFFFFFFFF8,
- 0xFFFFFFFFFFFFFFF7, 0xFFFFFFFFFFFFFFF6],
- array);
+ Expect.listEquals([
+ 0xFFFFFFFFFFFFFFFF,
+ 0xFFFFFFFFFFFFFFFE,
+ 0xFFFFFFFFFFFFFFFD,
+ 0xFFFFFFFFFFFFFFFC,
+ 0xFFFFFFFFFFFFFFFB,
+ 0xFFFFFFFFFFFFFFFA,
+ 0xFFFFFFFFFFFFFFF9,
+ 0xFFFFFFFFFFFFFFF8,
+ 0xFFFFFFFFFFFFFFF7,
+ 0xFFFFFFFFFFFFFFF6
+ ], array);
for (int i = 0; i < array.length; ++i) {
array[i] = i;
}
@@ -739,13 +1031,15 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
array.setRange(3, 7, [0x10000000000000001, 0, 1, 0xFFFFFFFFFFFFFFFF]);
- Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFFFFFFFFFF, 7, 8, 9],
- array);
+ Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFFFFFFFFFF, 7, 8, 9], array);
}
static testUint64List() {
- Expect.throws(() { new Uint64List(-1); },
- (e) { return e is ArgumentError; });
+ Expect.throws(() {
+ new Uint64List(-1);
+ }, (e) {
+ return e is ArgumentError;
+ });
var array = new Uint64List(10);
testUint64ListImpl(array);
}
@@ -755,35 +1049,63 @@ class ByteArrayTest {
Expect.equals(10, array.length);
Expect.equals(4, array.elementSizeInBytes);
Expect.equals(40, array.lengthInBytes);
- Expect.listEquals([0.0, 0.0, 0.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 0.0, 0.0],
- array);
- Expect.throws(() { array[-1] = 0.0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return array[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10] = 0.0; },
- (e) { return e is RangeError; });
- Expect.throws(() { array.add(0.0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeRange(0, array.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect
+ .listEquals([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], array);
+ Expect.throws(() {
+ array[-1] = 0.0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return array[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10] = 0.0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array.add(0.0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeRange(0, array.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < array.length; ++i) {
array[i] = 1.0 + i;
}
- Expect.listEquals([1.0, 2.0, 3.0, 4.0, 5.0,
- 6.0, 7.0, 8.0, 9.0, 10.0],
- array);
+ Expect
+ .listEquals([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0], array);
// TODO: min, max, and round
for (int i = 0; i < array.length; ++i) {
array[i] = i * 1.0;
@@ -803,14 +1125,26 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3.0, 4.0, 5.0, 6.0], region);
array.setRange(3, 7, [double.NEGATIVE_INFINITY, 0.0, 1.0, double.INFINITY]);
- Expect.listEquals([0.0, 1.0, 2.0, double.NEGATIVE_INFINITY, 0.0,
- 1.0, double.INFINITY, 7.0, 8.0, 9.0],
- array);
+ Expect.listEquals([
+ 0.0,
+ 1.0,
+ 2.0,
+ double.NEGATIVE_INFINITY,
+ 0.0,
+ 1.0,
+ double.INFINITY,
+ 7.0,
+ 8.0,
+ 9.0
+ ], array);
}
static testFloat32List() {
- Expect.throws(() { new Float32List(-1); },
- (e) { return e is ArgumentError; });
+ Expect.throws(() {
+ new Float32List(-1);
+ }, (e) {
+ return e is ArgumentError;
+ });
var array = new Float32List(10);
testFloat32ListImpl(array);
}
@@ -820,35 +1154,63 @@ class ByteArrayTest {
Expect.equals(10, array.length);
Expect.equals(8, array.elementSizeInBytes);
Expect.equals(80, array.lengthInBytes);
- Expect.listEquals([0.0, 0.0, 0.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 0.0, 0.0],
- array);
- Expect.throws(() { array[-1] = 0.0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return array[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10]; },
- (e) { return e is RangeError; });
- Expect.throws(() { array[10] = 0.0; },
- (e) { return e is RangeError; });
- Expect.throws(() { array.add(0.0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeRange(0, array.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect
+ .listEquals([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], array);
+ Expect.throws(() {
+ array[-1] = 0.0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return array[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array[10] = 0.0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array.add(0.0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeRange(0, array.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < array.length; ++i) {
array[i] = 1.0 + i;
}
- Expect.listEquals([1.0, 2.0, 3.0, 4.0, 5.0,
- 6.0, 7.0, 8.0, 9.0, 10.0],
- array);
+ Expect
+ .listEquals([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0], array);
// TODO: min, max
for (int i = 0; i < array.length; ++i) {
array[i] = i * 1.0;
@@ -868,14 +1230,26 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3.0, 4.0, 5.0, 6.0], region);
array.setRange(3, 7, [double.NEGATIVE_INFINITY, 0.0, 1.0, double.INFINITY]);
- Expect.listEquals([0.0, 1.0, 2.0, double.NEGATIVE_INFINITY, 0.0,
- 1.0, double.INFINITY, 7.0, 8.0, 9.0],
- array);
+ Expect.listEquals([
+ 0.0,
+ 1.0,
+ 2.0,
+ double.NEGATIVE_INFINITY,
+ 0.0,
+ 1.0,
+ double.INFINITY,
+ 7.0,
+ 8.0,
+ 9.0
+ ], array);
}
static testFloat64List() {
- Expect.throws(() { new Float64List(-1); },
- (e) { return e is ArgumentError; });
+ Expect.throws(() {
+ new Float64List(-1);
+ }, (e) {
+ return e is ArgumentError;
+ });
var array = new Float64List(10);
testFloat64ListImpl(array);
}
@@ -886,86 +1260,206 @@ class ByteArrayTest {
Expect.equals(8, array.lengthInBytes);
var byte_array = new ByteData.view(array.buffer);
Expect.equals(8, byte_array.lengthInBytes);
- Expect.throws(() { byte_array.getInt8(-1); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getUint8(-1); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getInt16(-1); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getUint16(-1); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getInt32(-1); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getUint32(-1); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getInt64(-1); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getUint64(-1); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getFloat32(-1); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getFloat64(-1); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setInt8(-1, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setUint8(-1, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setInt16(-1, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setUint16(-1, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setInt32(-1, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setUint32(-1, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setInt64(-1, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setUint64(-1, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setFloat32(-1, 0.0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setFloat64(-1, 0.0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getInt8(8); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getUint8(8); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getInt16(8); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getUint16(8); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getInt32(8); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getUint32(8); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getInt64(8); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getUint64(8); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getFloat32(8); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.getFloat64(8); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setInt8(8, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setUint8(8, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setInt16(8, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setUint16(8, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setInt32(8, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setUint32(8, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setInt64(8, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setUint64(8, 0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setFloat32(8, 0.0); },
- (e) { return e is RangeError; });
- Expect.throws(() { byte_array.setFloat64(8, 0.0); },
- (e) { return e is RangeError; });
+ Expect.throws(() {
+ byte_array.getInt8(-1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getUint8(-1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getInt16(-1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getUint16(-1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getInt32(-1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getUint32(-1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getInt64(-1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getUint64(-1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getFloat32(-1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getFloat64(-1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setInt8(-1, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setUint8(-1, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setInt16(-1, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setUint16(-1, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setInt32(-1, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setUint32(-1, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setInt64(-1, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setUint64(-1, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setFloat32(-1, 0.0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setFloat64(-1, 0.0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getInt8(8);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getUint8(8);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getInt16(8);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getUint16(8);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getInt32(8);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getUint32(8);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getInt64(8);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getUint64(8);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getFloat32(8);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.getFloat64(8);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setInt8(8, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setUint8(8, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setInt16(8, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setUint16(8, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setInt32(8, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setUint32(8, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setInt64(8, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setUint64(8, 0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setFloat32(8, 0.0);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ byte_array.setFloat64(8, 0.0);
+ }, (e) {
+ return e is RangeError;
+ });
Expect.equals(0, byte_array.getInt8(0));
Expect.equals(0, byte_array.getUint8(0));
Expect.equals(0, byte_array.getInt16(0));
@@ -1017,14 +1511,14 @@ class ByteArrayTest {
Expect.equals(0xBF80, byte_array.getUint16(2, Endianness.LITTLE_ENDIAN));
Expect.equals(0xFAFB, byte_array.getUint16(4, Endianness.LITTLE_ENDIAN));
Expect.equals(0xF8F9, byte_array.getUint16(6, Endianness.LITTLE_ENDIAN));
- Expect.equals(-1082130432,
- byte_array.getInt32(0, Endianness.LITTLE_ENDIAN));
- Expect.equals(0xBF800000,
- byte_array.getUint32(0, Endianness.LITTLE_ENDIAN));
- Expect.equals(-506097523945897984,
- byte_array.getInt64(0, Endianness.LITTLE_ENDIAN));
- Expect.equals(0xF8F9FAFBBF800000,
- byte_array.getUint64(0, Endianness.LITTLE_ENDIAN));
+ Expect.equals(
+ -1082130432, byte_array.getInt32(0, Endianness.LITTLE_ENDIAN));
+ Expect.equals(
+ 0xBF800000, byte_array.getUint32(0, Endianness.LITTLE_ENDIAN));
+ Expect.equals(
+ -506097523945897984, byte_array.getInt64(0, Endianness.LITTLE_ENDIAN));
+ Expect.equals(
+ 0xF8F9FAFBBF800000, byte_array.getUint64(0, Endianness.LITTLE_ENDIAN));
Expect.equals(-1.0, byte_array.getFloat32(0, Endianness.LITTLE_ENDIAN));
// TODO: byte_array.getFloat64(0)
}
@@ -1036,21 +1530,32 @@ class ByteArrayTest {
for (int i = 0; i < array.length; ++i) {
array[i] = 0xFF;
}
- Expect.throws(() { new Int8List.view(array.buffer, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int8List.view(array.buffer, 0, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int8List.view(array.buffer,
- array.lengthInBytes + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int8List.view(array.buffer,
- 0, array.length + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int8List.view(array.buffer,
- array.length - 1, 2); },
- (e) { return e is RangeError; });
- var empty = new Int8List.view(array.buffer,
- array.lengthInBytes);
+ Expect.throws(() {
+ new Int8List.view(array.buffer, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int8List.view(array.buffer, 0, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int8List.view(array.buffer, array.lengthInBytes + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int8List.view(array.buffer, 0, array.length + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int8List.view(array.buffer, array.length - 1, 2);
+ }, (e) {
+ return e is RangeError;
+ });
+ var empty = new Int8List.view(array.buffer, array.lengthInBytes);
Expect.isTrue(empty is List<int>);
Expect.isTrue(empty is Int8List);
Expect.equals(0, empty.length);
@@ -1064,74 +1569,110 @@ class ByteArrayTest {
Expect.equals(10, view.length);
Expect.equals(1, view.elementSizeInBytes);
Expect.equals(10, view.lengthInBytes);
- Expect.listEquals([-1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1],
- view);
- Expect.throws(() { view[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return view[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[view.length]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[10] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { view.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeRange(0, view.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], view);
+ Expect.throws(() {
+ view[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return view[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[view.length];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[10] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeRange(0, view.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < view.length; ++i) {
view[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- view);
- Expect.listEquals([0xFF, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 0xFF],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], view);
+ Expect.listEquals([0xFF, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0xFF], array);
for (int i = 0; i < view.length; ++i) {
view[i] = 0x100 + i;
}
- Expect.listEquals([0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9],
- view);
- Expect.listEquals([0xFF, 0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 0xFF],
- array);
+ Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], view);
+ Expect.listEquals([0xFF, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xFF], array);
for (int i = 0; i < view.length; ++i) {
view[i] = -10 + i;
}
- Expect.listEquals([-10, -9, -8, -7, -6,
- -5, -4, -3, -2, -1],
- view);
- Expect.listEquals([0xFF, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA,
- 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0xFF],
- array);
+ Expect.listEquals([-10, -9, -8, -7, -6, -5, -4, -3, -2, -1], view);
+ Expect.listEquals([
+ 0xFF,
+ 0xF6,
+ 0xF7,
+ 0xF8,
+ 0xF9,
+ 0xFA,
+ 0xFB,
+ 0xFC,
+ 0xFD,
+ 0xFE,
+ 0xFF,
+ 0xFF
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = 0x7F - i;
}
- Expect.listEquals([127, 126, 125, 124, 123,
- 122, 121, 120, 119, 118],
- view);
- Expect.listEquals([0xFF, 127, 126, 125, 124, 123,
- 122, 121, 120, 119, 118, 0xFF],
- array);
+ Expect.listEquals([127, 126, 125, 124, 123, 122, 121, 120, 119, 118], view);
+ Expect.listEquals(
+ [0xFF, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 0xFF], array);
for (int i = 0; i < view.length; ++i) {
view[i] = -0x80 + i;
}
- Expect.listEquals([-128, -127, -126, -125, -124,
- -123, -122, -121, -120, -119],
- view);
- Expect.listEquals([0xFF, 0x80, 0x81, 0x82, 0x83, 0x84,
- 0x85, 0x86, 0x87, 0x88, 0x89, 0xFF],
- array);
+ Expect.listEquals(
+ [-128, -127, -126, -125, -124, -123, -122, -121, -120, -119], view);
+ Expect.listEquals([
+ 0xFF,
+ 0x80,
+ 0x81,
+ 0x82,
+ 0x83,
+ 0x84,
+ 0x85,
+ 0x86,
+ 0x87,
+ 0x88,
+ 0x89,
+ 0xFF
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = i;
}
@@ -1145,11 +1686,10 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
view.setRange(3, 7, [-128, 0, 1, 127]);
- Expect.listEquals([0, 1, 2, -128, 0, 1, 127, 7, 8, 9],
- view);
- Expect.listEquals([0xFF, 0, 1, 2, 128, 0, 1, 127, 7, 8, 9, 0xFF],
- array);
+ Expect.listEquals([0, 1, 2, -128, 0, 1, 127, 7, 8, 9], view);
+ Expect.listEquals([0xFF, 0, 1, 2, 128, 0, 1, 127, 7, 8, 9, 0xFF], array);
}
+
static testInt8ListView() {
var array = new Uint8List(12);
testInt8ListViewImpl(array);
@@ -1163,21 +1703,32 @@ class ByteArrayTest {
for (int i = 0; i < array.length; ++i) {
array[i] = -1;
}
- Expect.throws(() { new Uint8List.view(array.buffer, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint8List.view(array.buffer, 0, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint8List.view(array.buffer,
- array.lengthInBytes + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint8List.view(array.buffer,
- 0, array.length + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint8List.view(array.buffer,
- array.length - 1, 2); },
- (e) { return e is RangeError; });
- var empty = new Uint8List.view(array.buffer,
- array.lengthInBytes);
+ Expect.throws(() {
+ new Uint8List.view(array.buffer, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint8List.view(array.buffer, 0, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint8List.view(array.buffer, array.lengthInBytes + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint8List.view(array.buffer, 0, array.length + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint8List.view(array.buffer, array.length - 1, 2);
+ }, (e) {
+ return e is RangeError;
+ });
+ var empty = new Uint8List.view(array.buffer, array.lengthInBytes);
Expect.isTrue(empty is List<int>);
Expect.isTrue(empty is Uint8List);
Expect.equals(0, empty.length);
@@ -1191,56 +1742,74 @@ class ByteArrayTest {
Expect.equals(10, view.length);
Expect.equals(1, view.elementSizeInBytes);
Expect.equals(10, view.lengthInBytes);
- Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF],
- view);
- Expect.throws(() { view[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return view[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[view.length]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[view.length] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { view.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeRange(0, view.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals(
+ [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], view);
+ Expect.throws(() {
+ view[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return view[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[view.length];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[view.length] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeRange(0, view.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < view.length; ++i) {
view[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- view);
- Expect.listEquals([-1, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, -1],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], view);
+ Expect.listEquals([-1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1], array);
for (int i = 0; i < view.length; ++i) {
view[i] = 0x100 + i;
}
- Expect.listEquals([0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9],
- view);
- Expect.listEquals([-1, 0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, -1],
- array);
+ Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], view);
+ Expect.listEquals([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1], array);
for (int i = 0; i < view.length; ++i) {
view[i] = 0xFF - i;
}
- Expect.listEquals([0xFF, 0xFE, 0xFD, 0xFC, 0xFB,
- 0xFA, 0xF9, 0xF8, 0xF7, 0xF6],
- view);
- Expect.listEquals([-1, -1, -2, -3, -4, -5,
- -6, -7, -8, -9, -10, -1],
- array);
+ Expect.listEquals(
+ [0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8, 0xF7, 0xF6], view);
+ Expect.listEquals([-1, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -1], array);
for (int i = 0; i < view.length; ++i) {
view[i] = i;
}
@@ -1254,8 +1823,7 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
view.setRange(3, 7, [257, 0, 1, 255]);
- Expect.listEquals([0, 1, 2, 1, 0, 1, 255, 7, 8, 9],
- view);
+ Expect.listEquals([0, 1, 2, 1, 0, 1, 255, 7, 8, 9], view);
}
static testUint8ListView() {
@@ -1270,21 +1838,32 @@ class ByteArrayTest {
for (int i = 0; i < array.length; ++i) {
array[i] = 0xFF;
}
- Expect.throws(() { new Int16List.view(array.buffer, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int16List.view(array.buffer, 0, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int16List.view(array.buffer,
- array.lengthInBytes + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int16List.view(array.buffer,
- 0, array.length + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int16List.view(array.buffer,
- array.length - 1, 2); },
- (e) { return e is RangeError; });
- var empty = new Int16List.view(array.buffer,
- array.lengthInBytes);
+ Expect.throws(() {
+ new Int16List.view(array.buffer, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int16List.view(array.buffer, 0, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int16List.view(array.buffer, array.lengthInBytes + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int16List.view(array.buffer, 0, array.length + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int16List.view(array.buffer, array.length - 1, 2);
+ }, (e) {
+ return e is RangeError;
+ });
+ var empty = new Int16List.view(array.buffer, array.lengthInBytes);
Expect.isTrue(empty is List<int>);
Expect.isTrue(empty is Int16List);
Expect.equals(0, empty.length);
@@ -1298,79 +1877,229 @@ class ByteArrayTest {
Expect.equals(10, view.length);
Expect.equals(2, view.elementSizeInBytes);
Expect.equals(20, view.lengthInBytes);
- Expect.listEquals([-1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1],
- view);
- Expect.throws(() { view[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return view[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[view.length]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[10] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { view.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeRange(0, view.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], view);
+ Expect.throws(() {
+ view[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return view[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[view.length];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[10] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeRange(0, view.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < view.length; ++i) {
view[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- view);
- Expect.listEquals([0xFF, 0xFF, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00,
- 0x04, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00,
- 0x08, 0x00, 0x09, 0x00, 0x0A, 0x00, 0xFF, 0xFF],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], view);
+ Expect.listEquals([
+ 0xFF,
+ 0xFF,
+ 0x01,
+ 0x00,
+ 0x02,
+ 0x00,
+ 0x03,
+ 0x00,
+ 0x04,
+ 0x00,
+ 0x05,
+ 0x00,
+ 0x06,
+ 0x00,
+ 0x07,
+ 0x00,
+ 0x08,
+ 0x00,
+ 0x09,
+ 0x00,
+ 0x0A,
+ 0x00,
+ 0xFF,
+ 0xFF
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = 0x10000 + i;
}
- Expect.listEquals([0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9],
- view);
- Expect.listEquals([0xFF, 0xFF, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,
- 0x03, 0x00, 0x04, 0x00, 0x05, 0x00, 0x06, 0x00,
- 0x07, 0x00, 0x08, 0x00, 0x09, 0x00, 0xFF, 0xFF],
- array);
+ Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], view);
+ Expect.listEquals([
+ 0xFF,
+ 0xFF,
+ 0x00,
+ 0x00,
+ 0x01,
+ 0x00,
+ 0x02,
+ 0x00,
+ 0x03,
+ 0x00,
+ 0x04,
+ 0x00,
+ 0x05,
+ 0x00,
+ 0x06,
+ 0x00,
+ 0x07,
+ 0x00,
+ 0x08,
+ 0x00,
+ 0x09,
+ 0x00,
+ 0xFF,
+ 0xFF
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = -10 + i;
}
- Expect.listEquals([-10, -9, -8, -7, -6,
- -5, -4, -3, -2, -1],
- view);
- Expect.listEquals([0xFF, 0xFF, 0xF6, 0xFF, 0xF7, 0xFF, 0xF8, 0xFF,
- 0xF9, 0xFF,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array);
for (int i = 0; i < view.length; ++i) {
view[i] = -0x8000 + i;
}
- Expect.listEquals([-0x8000, -0x7FFF, -0x7FFE, -0x7FFD, -0x7FFC,
- -0x7FFB, -0x7FFA, -0x7FF9, -0x7FF8, -0x7FF7],
- view);
- Expect.listEquals([0xFF, 0xFF, 0x00, 0x80, 0x01, 0x80, 0x02, 0x80,
- 0x03, 0x80, 0x04, 0x80, 0x05, 0x80, 0x06, 0x80,
- 0x07, 0x80, 0x08, 0x80, 0x09, 0x80, 0xFF, 0xFF],
- array);
+ Expect.listEquals([
+ -0x8000,
+ -0x7FFF,
+ -0x7FFE,
+ -0x7FFD,
+ -0x7FFC,
+ -0x7FFB,
+ -0x7FFA,
+ -0x7FF9,
+ -0x7FF8,
+ -0x7FF7
+ ], view);
+ Expect.listEquals([
+ 0xFF,
+ 0xFF,
+ 0x00,
+ 0x80,
+ 0x01,
+ 0x80,
+ 0x02,
+ 0x80,
+ 0x03,
+ 0x80,
+ 0x04,
+ 0x80,
+ 0x05,
+ 0x80,
+ 0x06,
+ 0x80,
+ 0x07,
+ 0x80,
+ 0x08,
+ 0x80,
+ 0x09,
+ 0x80,
+ 0xFF,
+ 0xFF
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = i;
}
@@ -1384,12 +2113,33 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
view.setRange(3, 7, [-32768, 0, 1, 32767]);
- Expect.listEquals([0, 1, 2, -32768, 0, 1, 32767, 7, 8, 9],
- view);
- Expect.listEquals([0xFF, 0xFF, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0xFF, 0x7F,
- 0x07, 0x00, 0x08, 0x00, 0x09, 0x00, 0xFF, 0xFF],
- array);
+ Expect.listEquals([0, 1, 2, -32768, 0, 1, 32767, 7, 8, 9], view);
+ Expect.listEquals([
+ 0xFF,
+ 0xFF,
+ 0x00,
+ 0x00,
+ 0x01,
+ 0x00,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x00,
+ 0x00,
+ 0x01,
+ 0x00,
+ 0xFF,
+ 0x7F,
+ 0x07,
+ 0x00,
+ 0x08,
+ 0x00,
+ 0x09,
+ 0x00,
+ 0xFF,
+ 0xFF
+ ], array);
}
static testInt16ListView() {
@@ -1405,21 +2155,32 @@ class ByteArrayTest {
for (int i = 0; i < array.length; ++i) {
array[i] = -1;
}
- Expect.throws(() { new Uint16List.view(array.buffer, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint16List.view(array.buffer, 0, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint16List.view(array.buffer,
- array.lengthInBytes + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint16List.view(array.buffer,
- 0, array.length + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint16List.view(array.buffer,
- array.length - 1, 2); },
- (e) { return e is RangeError; });
- var empty = new Uint16List.view(array.buffer,
- array.lengthInBytes);
+ Expect.throws(() {
+ new Uint16List.view(array.buffer, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint16List.view(array.buffer, 0, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint16List.view(array.buffer, array.lengthInBytes + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint16List.view(array.buffer, 0, array.length + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint16List.view(array.buffer, array.length - 1, 2);
+ }, (e) {
+ return e is RangeError;
+ });
+ var empty = new Uint16List.view(array.buffer, array.lengthInBytes);
Expect.isTrue(empty is List<int>);
Expect.isTrue(empty is Uint16List);
Expect.equals(0, empty.length);
@@ -1433,57 +2194,169 @@ class ByteArrayTest {
Expect.equals(10, view.length);
Expect.equals(2, view.elementSizeInBytes);
Expect.equals(20, view.lengthInBytes);
- Expect.listEquals([0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
- 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF],
- view);
- Expect.throws(() { view[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return view[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[view.length]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[view.length] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { view.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeRange(0, view.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([
+ 0xFFFF,
+ 0xFFFF,
+ 0xFFFF,
+ 0xFFFF,
+ 0xFFFF,
+ 0xFFFF,
+ 0xFFFF,
+ 0xFFFF,
+ 0xFFFF,
+ 0xFFFF
+ ], view);
+ Expect.throws(() {
+ view[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return view[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[view.length];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[view.length] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeRange(0, view.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < view.length; ++i) {
view[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- view);
- Expect.listEquals([-1, -1, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0,
- 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, -1, -1],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], view);
+ Expect.listEquals([
+ -1,
+ -1,
+ 1,
+ 0,
+ 2,
+ 0,
+ 3,
+ 0,
+ 4,
+ 0,
+ 5,
+ 0,
+ 6,
+ 0,
+ 7,
+ 0,
+ 8,
+ 0,
+ 9,
+ 0,
+ 10,
+ 0,
+ -1,
+ -1
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = 0x10000 + i;
}
- Expect.listEquals([0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9],
- view);
- Expect.listEquals([-1, -1, 0, 0, 1, 0, 2, 0, 3, 0, 4, 0,
- 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, -1, -1],
- array);
+ Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], view);
+ Expect.listEquals([
+ -1,
+ -1,
+ 0,
+ 0,
+ 1,
+ 0,
+ 2,
+ 0,
+ 3,
+ 0,
+ 4,
+ 0,
+ 5,
+ 0,
+ 6,
+ 0,
+ 7,
+ 0,
+ 8,
+ 0,
+ 9,
+ 0,
+ -1,
+ -1
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = 0xFFFF - i;
}
- Expect.listEquals([0xFFFF, 0xFFFE, 0xFFFD, 0xFFFC, 0xFFFB,
- 0xFFFA, 0xFFF9, 0xFFF8, 0xFFF7, 0xFFF6],
- view);
- Expect.listEquals([-1, -1, -1, -1, -2, -1, -3, -1,
- -4, -1, -5, -1, -6, -1, -7, -1,
- -8, -1, -9, -1, -10, -1, -1, -1],
- array);
+ Expect.listEquals([
+ 0xFFFF,
+ 0xFFFE,
+ 0xFFFD,
+ 0xFFFC,
+ 0xFFFB,
+ 0xFFFA,
+ 0xFFF9,
+ 0xFFF8,
+ 0xFFF7,
+ 0xFFF6
+ ], view);
+ Expect.listEquals([
+ -1,
+ -1,
+ -1,
+ -1,
+ -2,
+ -1,
+ -3,
+ -1,
+ -4,
+ -1,
+ -5,
+ -1,
+ -6,
+ -1,
+ -7,
+ -1,
+ -8,
+ -1,
+ -9,
+ -1,
+ -10,
+ -1,
+ -1,
+ -1
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = i;
}
@@ -1497,12 +2370,33 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
view.setRange(3, 7, [0x10001, 0, 1, 0xFFFF]);
- Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFF, 7, 8, 9],
- view);
- Expect.listEquals([-1, -1, 0, 0, 1, 0, 2, 0,
- 1, 0, 0, 0, 1, 0, -1, -1,
- 7, 0, 8, 0, 9, 0, -1, -1],
- array);
+ Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFF, 7, 8, 9], view);
+ Expect.listEquals([
+ -1,
+ -1,
+ 0,
+ 0,
+ 1,
+ 0,
+ 2,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ -1,
+ -1,
+ 7,
+ 0,
+ 8,
+ 0,
+ 9,
+ 0,
+ -1,
+ -1
+ ], array);
}
static testUint16ListView() {
@@ -1518,21 +2412,32 @@ class ByteArrayTest {
for (int i = 0; i < array.length; ++i) {
array[i] = 0xFF;
}
- Expect.throws(() { new Int32List.view(array.buffer, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int32List.view(array.buffer, 0, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int32List.view(array.buffer,
- array.lengthInBytes + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int32List.view(array.buffer,
- 0, array.length + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int32List.view(array.buffer,
- array.length - 1, 2); },
- (e) { return e is RangeError; });
- var empty = new Int32List.view(array.buffer,
- array.lengthInBytes);
+ Expect.throws(() {
+ new Int32List.view(array.buffer, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int32List.view(array.buffer, 0, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int32List.view(array.buffer, array.lengthInBytes + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int32List.view(array.buffer, 0, array.length + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int32List.view(array.buffer, array.length - 1, 2);
+ }, (e) {
+ return e is RangeError;
+ });
+ var empty = new Int32List.view(array.buffer, array.lengthInBytes);
Expect.isTrue(empty is List<int>);
Expect.isTrue(empty is Int32List);
Expect.equals(0, empty.length);
@@ -1546,100 +2451,349 @@ class ByteArrayTest {
Expect.equals(10, view.length);
Expect.equals(4, view.elementSizeInBytes);
Expect.equals(40, view.lengthInBytes);
- Expect.listEquals([-1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1],
- view);
- Expect.throws(() { view[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return view[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[view.length]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[10] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { view.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeRange(0, view.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], view);
+ Expect.throws(() {
+ view[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return view[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[view.length];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[10] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeRange(0, view.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < view.length; ++i) {
view[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- view);
- Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
- 0x0A, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], view);
+ Expect.listEquals([
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0x01,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x03,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x04,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x05,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x06,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x07,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x09,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x0A,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = 0x100000000 + i;
}
- Expect.listEquals([0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9],
- view);
- Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF],
- array);
+ Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], view);
+ Expect.listEquals([
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x03,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x04,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x05,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x06,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x07,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x09,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = -10 + i;
}
- Expect.listEquals([-10, -9, -8, -7, -6,
- -5, -4, -3, -2, -1],
- view);
- Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0xF6, 0xFF, 0xFF, 0xFF,
- 0xF7, 0xFF, 0xFF, 0xFF, 0xF8, 0xFF, 0xFF, 0xFF,
- 0xF9, 0xFF, 0xFF, 0xFF, 0xFA, 0xFF, 0xFF, 0xFF,
- 0xFB, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF,
- 0xFD, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF],
- array);
+ Expect.listEquals([-10, -9, -8, -7, -6, -5, -4, -3, -2, -1], view);
+ Expect.listEquals([
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xF6,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xF7,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xF8,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xF9,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFA,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFB,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFC,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFD,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFE,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = 0x7FFFFFFF - i;
}
- Expect.listEquals([0x7FFFFFF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xFF,
+ 0xFF,
+ 0xFF
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = -0x80000000 + i;
}
- Expect.listEquals([-0x80000000, -0x7FFFFFFF,
- -0x7FFFFFFE, -0x7FFFFFFD,
- -0x7FFFFFFC, -0x7FFFFFFB,
- -0x7FFFFFFA, -0x7FFFFFF9,
- -0x7FFFFFF8, -0x7FFFFFF7],
- view);
- Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x80,
- 0x01, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x80,
- 0x03, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x80,
- 0x05, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0x80,
- 0x07, 0x00, 0x00, 0x80, 0x08, 0x00, 0x00, 0x80,
- 0x09, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF],
- array);
+ Expect.listEquals([
+ -0x80000000,
+ -0x7FFFFFFF,
+ -0x7FFFFFFE,
+ -0x7FFFFFFD,
+ -0x7FFFFFFC,
+ -0x7FFFFFFB,
+ -0x7FFFFFFA,
+ -0x7FFFFFF9,
+ -0x7FFFFFF8,
+ -0x7FFFFFF7
+ ], view);
+ Expect.listEquals([
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x01,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x03,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x04,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x05,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x06,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x07,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x09,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = i;
}
@@ -1653,15 +2807,57 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
view.setRange(3, 7, [-0x80000000, 0, 1, 0x7FFFFFFF]);
- Expect.listEquals([0, 1, 2, -0x80000000, 0, 1, 0x7FFFFFFF, 7, 8, 9],
- view);
- Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x7F,
- 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF],
- array);
+ Expect.listEquals([0, 1, 2, -0x80000000, 0, 1, 0x7FFFFFFF, 7, 8, 9], view);
+ Expect.listEquals([
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0x7F,
+ 0x07,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x09,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF
+ ], array);
}
static testUint32ListViewImpl(var array) {
@@ -1672,21 +2868,32 @@ class ByteArrayTest {
for (int i = 0; i < array.length; ++i) {
array[i] = -1;
}
- Expect.throws(() { new Uint32List.view(array.buffer, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint32List.view(array.buffer, 0, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint32List.view(array.buffer,
- array.lengthInBytes + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint32List.view(array.buffer,
- 0, array.length + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint32List.view(array.buffer,
- array.length - 1, 2); },
- (e) { return e is RangeError; });
- var empty = new Uint32List.view(array.buffer,
- array.lengthInBytes);
+ Expect.throws(() {
+ new Uint32List.view(array.buffer, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint32List.view(array.buffer, 0, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint32List.view(array.buffer, array.lengthInBytes + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint32List.view(array.buffer, 0, array.length + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint32List.view(array.buffer, array.length - 1, 2);
+ }, (e) {
+ return e is RangeError;
+ });
+ var empty = new Uint32List.view(array.buffer, array.lengthInBytes);
Expect.isTrue(empty is List<int>);
Expect.isTrue(empty is Uint32List);
Expect.equals(0, empty.length);
@@ -1700,71 +2907,241 @@ class ByteArrayTest {
Expect.equals(10, view.length);
Expect.equals(4, view.elementSizeInBytes);
Expect.equals(40, view.lengthInBytes);
- Expect.listEquals([0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF],
- view);
- Expect.throws(() { view[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return view[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[view.length]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[view.length] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { view.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeRange(0, view.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF
+ ], view);
+ Expect.throws(() {
+ view[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return view[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[view.length];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[view.length] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeRange(0, view.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < view.length; ++i) {
view[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- view);
- Expect.listEquals([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,
+ 0,
+ 8,
+ 0,
+ 0,
+ 0,
+ 9,
+ 0,
+ 0,
+ 0,
+ -1,
+ -1,
+ -1,
+ -1
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = 0xFFFFFFFF - i;
}
- Expect.listEquals([0xFFFFFFFF, 0xFFFFFFFE,
- 0xFFFFFFFD, 0xFFFFFFFC,
- 0xFFFFFFFB, 0xFFFFFFFA,
- 0xFFFFFFF9, 0xFFFFFFF8,
- 0xFFFFFFF7, 0xFFFFFFF6],
- view);
- Expect.listEquals([-1, -1, -1, -1, -1, -1, -1, -1,
- -2, -1, -1, -1, -3, -1, -1, -1,
- -4, -1, -1, -1, -5, -1, -1, -1,
- -6, -1, -1, -1, -7, -1, -1, -1,
- -8, -1, -1, -1, -9, -1, -1, -1,
- -10, -1, -1, -1, -1, -1, -1, -1],
- array);
+ Expect.listEquals([
+ 0xFFFFFFFF,
+ 0xFFFFFFFE,
+ 0xFFFFFFFD,
+ 0xFFFFFFFC,
+ 0xFFFFFFFB,
+ 0xFFFFFFFA,
+ 0xFFFFFFF9,
+ 0xFFFFFFF8,
+ 0xFFFFFFF7,
+ 0xFFFFFFF6
+ ], view);
+ Expect.listEquals([
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -2,
+ -1,
+ -1,
+ -1,
+ -3,
+ -1,
+ -1,
+ -1,
+ -4,
+ -1,
+ -1,
+ -1,
+ -5,
+ -1,
+ -1,
+ -1,
+ -6,
+ -1,
+ -1,
+ -1,
+ -7,
+ -1,
+ -1,
+ -1,
+ -8,
+ -1,
+ -1,
+ -1,
+ -9,
+ -1,
+ -1,
+ -1,
+ -10,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = i;
}
@@ -1778,15 +3155,57 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
view.setRange(3, 7, [0x100000001, 0, 1, 0xFFFFFFFF]);
- Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFF, 7, 8, 9],
- view);
- Expect.listEquals([-1, -1, -1, -1, 0, 0, 0, 0,
- 1, 0, 0, 0, 2, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, -1, -1, -1, -1,
- 7, 0, 0, 0, 8, 0, 0, 0,
- 9, 0, 0, 0, -1, -1, -1, -1],
- array);
+ Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFF, 7, 8, 9], view);
+ Expect.listEquals([
+ -1,
+ -1,
+ -1,
+ -1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0,
+ 2,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0,
+ -1,
+ -1,
+ -1,
+ -1,
+ 7,
+ 0,
+ 0,
+ 0,
+ 8,
+ 0,
+ 0,
+ 0,
+ 9,
+ 0,
+ 0,
+ 0,
+ -1,
+ -1,
+ -1,
+ -1
+ ], array);
}
static testUint32ListView() {
@@ -1801,21 +3220,32 @@ class ByteArrayTest {
for (int i = 0; i < array.length; ++i) {
array[i] = 0xFF;
}
- Expect.throws(() { new Int64List.view(array.buffer, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int64List.view(array.buffer, 0, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int64List.view(array.buffer,
- array.lengthInBytes + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int64List.view(array.buffer,
- 0, array.length + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Int64List.view(array.buffer,
- array.length - 1, 2); },
- (e) { return e is RangeError; });
- var empty = new Int64List.view(array.buffer,
- array.lengthInBytes);
+ Expect.throws(() {
+ new Int64List.view(array.buffer, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int64List.view(array.buffer, 0, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int64List.view(array.buffer, array.lengthInBytes + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int64List.view(array.buffer, 0, array.length + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Int64List.view(array.buffer, array.length - 1, 2);
+ }, (e) {
+ return e is RangeError;
+ });
+ var empty = new Int64List.view(array.buffer, array.lengthInBytes);
Expect.isTrue(empty is List<int>);
Expect.isTrue(empty is Int64List);
Expect.equals(0, empty.length);
@@ -1829,130 +3259,589 @@ class ByteArrayTest {
Expect.equals(10, view.length);
Expect.equals(8, view.elementSizeInBytes);
Expect.equals(80, view.lengthInBytes);
- Expect.listEquals([-1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1],
- view);
- Expect.throws(() { view[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return view[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[view.length]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[10] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { view.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeRange(0, view.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], view);
+ Expect.throws(() {
+ view[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return view[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[view.length];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[10] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeRange(0, view.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < view.length; ++i) {
view[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- view);
- Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], view);
+ Expect.listEquals([
+ 0xFF,
+ 0xFF,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F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
- 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
- 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF],
- array);
+ Expect.listEquals([
+ -0x8000000000000000,
+ -0x7FFFFFFFFFFFFFFF,
+ -0x7FFFFFFFFFFFFFFE,
+ -0x7FFFFFFFFFFFFFFD,
+ -0x7FFFFFFFFFFFFFFC,
+ -0x7FFFFFFFFFFFFFFB,
+ -0x7FFFFFFFFFFFFFFA,
+ -0x7FFFFFFFFFFFFFF9,
+ -0x7FFFFFFFFFFFFFF8,
+ -0x7FFFFFFFFFFFFFF7
+ ], view);
+ Expect.listEquals([
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x01,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x02,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x03,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x04,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x05,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x06,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x07,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x08,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x09,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = i;
}
@@ -1966,22 +3855,107 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
view.setRange(3, 7, [-0x8000000000000000, 0, 1, 0x7FFFFFFFFFFFFFFF]);
- Expect.listEquals([0, 1, 2, -0x8000000000000000, 0,
- 1, 0x7FFFFFFFFFFFFFFF, 7, 8, 9],
- view);
- Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00,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00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF
+ ], array);
}
static testInt64ListView() {
@@ -1997,21 +3971,32 @@ class ByteArrayTest {
for (int i = 0; i < array.length; ++i) {
array[i] = -1;
}
- Expect.throws(() { new Uint64List.view(array.buffer, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint64List.view(array.buffer, 0, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint64List.view(array.buffer,
- array.lengthInBytes + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint64List.view(array.buffer,
- 0, array.length + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Uint64List.view(array.buffer,
- array.length - 1, 2); },
- (e) { return e is RangeError; });
- var empty = new Uint64List.view(array.buffer,
- array.lengthInBytes);
+ Expect.throws(() {
+ new Uint64List.view(array.buffer, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint64List.view(array.buffer, 0, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint64List.view(array.buffer, array.lengthInBytes + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint64List.view(array.buffer, 0, array.length + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Uint64List.view(array.buffer, array.length - 1, 2);
+ }, (e) {
+ return e is RangeError;
+ });
+ var empty = new Uint64List.view(array.buffer, array.lengthInBytes);
Expect.isTrue(empty is List<int>);
Expect.isTrue(empty is Uint64List);
Expect.equals(0, empty.length);
@@ -2025,92 +4010,385 @@ class ByteArrayTest {
Expect.equals(10, view.length);
Expect.equals(8, view.elementSizeInBytes);
Expect.equals(80, view.lengthInBytes);
- Expect.listEquals([0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF,
- 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF,
- 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF,
- 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF,
- 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF],
- view);
- Expect.throws(() { view[-1] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return view[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[view.length]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[view.length] = 0; },
- (e) { return e is RangeError; });
- Expect.throws(() { view.add(0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { view.removeRange(0, view.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals([
+ 0xFFFFFFFFFFFFFFFF,
+ 0xFFFFFFFFFFFFFFFF,
+ 0xFFFFFFFFFFFFFFFF,
+ 0xFFFFFFFFFFFFFFFF,
+ 0xFFFFFFFFFFFFFFFF,
+ 0xFFFFFFFFFFFFFFFF,
+ 0xFFFFFFFFFFFFFFFF,
+ 0xFFFFFFFFFFFFFFFF,
+ 0xFFFFFFFFFFFFFFFF,
+ 0xFFFFFFFFFFFFFFFF
+ ], view);
+ Expect.throws(() {
+ view[-1] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return view[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[view.length];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[view.length] = 0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view.add(0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ view.removeRange(0, view.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < view.length; ++i) {
view[i] = 1 + i;
}
- Expect.listEquals([1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10],
- view);
- Expect.listEquals([-1, -1, -1, -1, -1, -1, -1, -1,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 2, 0, 0, 0, 0, 0, 0, 0,
- 3, 0, 0, 0, 0, 0, 0, 0,
- 4, 0, 0, 0, 0, 0, 0, 0,
- 5, 0, 0, 0, 0, 0, 0, 0,
- 6, 0, 0, 0, 0, 0, 0, 0,
- 7, 0, 0, 0, 0, 0, 0, 0,
- 8, 0, 0, 0, 0, 0, 0, 0,
- 9, 0, 0, 0, 0, 0, 0, 0,
- 10, 0, 0, 0, 0, 0, 0, 0,
- -1, -1, -1, -1, -1, -1, -1, -1],
- array);
+ Expect.listEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], view);
+ Expect.listEquals([
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ 1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 2,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 3,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 4,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 5,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 6,
+ 0,
+ 0,
+ 0,
+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 5,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 6,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 7,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 8,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 9,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = 0xFFFFFFFFFFFFFFFF - i;
}
- Expect.listEquals([0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFE,
- 0xFFFFFFFFFFFFFFFD, 0xFFFFFFFFFFFFFFFC,
- 0xFFFFFFFFFFFFFFFB, 0xFFFFFFFFFFFFFFFA,
- 0xFFFFFFFFFFFFFFF9, 0xFFFFFFFFFFFFFFF8,
- 0xFFFFFFFFFFFFFFF7, 0xFFFFFFFFFFFFFFF6],
- view);
- Expect.listEquals([-1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -2, -1, -1, -1, -1, -1, -1, -1,
- -3, -1, -1, -1, -1, -1, -1, -1,
- -4, -1, -1, -1, -1, -1, -1, -1,
- -5, -1, -1, -1, -1, -1, -1, -1,
- -6, -1, -1, -1, -1, -1, -1, -1,
- -7, -1, -1, -1, -1, -1, -1, -1,
- -8, -1, -1, -1, -1, -1, -1, -1,
- -9, -1, -1, -1, -1, -1, -1, -1,
- -10, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1],
- array);
+ Expect.listEquals([
+ 0xFFFFFFFFFFFFFFFF,
+ 0xFFFFFFFFFFFFFFFE,
+ 0xFFFFFFFFFFFFFFFD,
+ 0xFFFFFFFFFFFFFFFC,
+ 0xFFFFFFFFFFFFFFFB,
+ 0xFFFFFFFFFFFFFFFA,
+ 0xFFFFFFFFFFFFFFF9,
+ 0xFFFFFFFFFFFFFFF8,
+ 0xFFFFFFFFFFFFFFF7,
+ 0xFFFFFFFFFFFFFFF6
+ ], view);
+ Expect.listEquals([
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -2,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -3,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -4,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -5,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -6,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -7,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -8,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -9,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -10,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1
+ ], array);
for (int i = 0; i < view.length; ++i) {
view[i] = i;
}
@@ -2124,21 +4402,105 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3, 4, 5, 6], region);
view.setRange(3, 7, [0x10000000000000001, 0, 1, 0xFFFFFFFFFFFFFFFF]);
- Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFFFFFFFFFF, 7, 8, 9],
- view);
- Expect.listEquals([-1, -1, -1, -1, -1, -1, -1, -1,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 2, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0,
- -1, -1, -1, -1, -1, -1, -1, -1,
- 7, 0, 0, 0, 0, 0, 0, 0,
- 8, 0, 0, 0, 0, 0, 0, 0,
- 9, 0, 0, 0, 0, 0, 0, 0,
- -1, -1, -1, -1, -1, -1, -1, -1],
- array);
+ Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFFFFFFFFFF, 7, 8, 9], view);
+ Expect.listEquals([
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 2,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ 7,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 8,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 9,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1
+ ], array);
}
static testUint64ListView() {
@@ -2154,21 +4516,32 @@ class ByteArrayTest {
for (int i = 0; i < array.length; ++i) {
array[i] = 0xBF800000;
}
- Expect.throws(() { new Float32List.view(array.buffer, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Float32List.view(array.buffer, 0, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Float32List.view(array.buffer,
- array.lengthInBytes + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Float32List.view(array.buffer,
- 0, array.lengthInBytes + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Float32List.view(array.buffer,
- array.lengthInBytes - 1, 2); },
- (e) { return e is RangeError; });
- var empty = new Float32List.view(array.buffer,
- array.lengthInBytes);
+ Expect.throws(() {
+ new Float32List.view(array.buffer, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Float32List.view(array.buffer, 0, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Float32List.view(array.buffer, array.lengthInBytes + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Float32List.view(array.buffer, 0, array.lengthInBytes + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Float32List.view(array.buffer, array.lengthInBytes - 1, 2);
+ }, (e) {
+ return e is RangeError;
+ });
+ var empty = new Float32List.view(array.buffer, array.lengthInBytes);
Expect.isTrue(empty is List<double>);
Expect.isTrue(empty is Float32List);
Expect.equals(0, empty.length);
@@ -2182,42 +4555,77 @@ class ByteArrayTest {
Expect.equals(10, view.length);
Expect.equals(4, view.elementSizeInBytes);
Expect.equals(40, view.lengthInBytes);
- Expect.listEquals([-1.0, -1.0, -1.0, -1.0, -1.0,
- -1.0, -1.0, -1.0, -1.0, -1.0],
- view);
- Expect.throws(() { view[-1] = 0.0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return view[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[10]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[10] = 0.0; },
- (e) { return e is RangeError; });
- Expect.throws(() { array.add(0.0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeRange(0, array.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals(
+ [-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0], view);
+ Expect.throws(() {
+ view[-1] = 0.0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return view[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[10];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[10] = 0.0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array.add(0.0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeRange(0, array.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < view.length; ++i) {
view[i] = 1.0 + i;
}
- Expect.listEquals([1.0, 2.0, 3.0, 4.0, 5.0,
- 6.0, 7.0, 8.0, 9.0, 10.0],
- view);
- Expect.listEquals([0xBF800000, 0x3F800000,
- 0x40000000, 0x40400000,
- 0x40800000, 0x40A00000,
- 0x40C00000, 0x40E00000,
- 0x41000000, 0x41100000,
- 0x41200000, 0xBF800000],
- array);
+ Expect
+ .listEquals([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0], view);
+ Expect.listEquals([
+ 0xBF800000,
+ 0x3F800000,
+ 0x40000000,
+ 0x40400000,
+ 0x40800000,
+ 0x40A00000,
+ 0x40C00000,
+ 0x40E00000,
+ 0x41000000,
+ 0x41100000,
+ 0x41200000,
+ 0xBF800000
+ ], array);
// TODO: min, max, and round
for (int i = 0; i < view.length; ++i) {
view[i] = i * 1.0;
@@ -2232,16 +4640,32 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3.0, 4.0, 5.0, 6.0], region);
view.setRange(3, 7, [double.NEGATIVE_INFINITY, 0.0, 1.0, double.INFINITY]);
- Expect.listEquals([0.0, 1.0, 2.0, double.NEGATIVE_INFINITY, 0.0,
- 1.0, double.INFINITY, 7.0, 8.0, 9.0],
- view);
- Expect.listEquals([0xBF800000, 0x00000000,
- 0x3F800000, 0x40000000,
- 0xFF800000, 0x00000000,
- 0x3F800000, 0x7F800000,
- 0x40E00000, 0x41000000,
- 0x41100000, 0xBF800000],
- array);
+ Expect.listEquals([
+ 0.0,
+ 1.0,
+ 2.0,
+ double.NEGATIVE_INFINITY,
+ 0.0,
+ 1.0,
+ double.INFINITY,
+ 7.0,
+ 8.0,
+ 9.0
+ ], view);
+ Expect.listEquals([
+ 0xBF800000,
+ 0x00000000,
+ 0x3F800000,
+ 0x40000000,
+ 0xFF800000,
+ 0x00000000,
+ 0x3F800000,
+ 0x7F800000,
+ 0x40E00000,
+ 0x41000000,
+ 0x41100000,
+ 0xBF800000
+ ], array);
}
static testFloat32ListView() {
@@ -2257,21 +4681,32 @@ class ByteArrayTest {
for (int i = 0; i < array.length; ++i) {
array[i] = 0xBFF0000000000000;
}
- Expect.throws(() { new Float64List.view(array.buffer, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Float64List.view(array.buffer, 0, -1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Float64List.view(array.buffer,
- array.lengthInBytes + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Float64List.view(array.buffer,
- 0, array.lengthInBytes + 1); },
- (e) { return e is RangeError; });
- Expect.throws(() { new Float64List.view(array.buffer,
- array.lengthInBytes - 1, 2); },
- (e) { return e is RangeError; });
- var empty = new Float64List.view(array.buffer,
- array.lengthInBytes);
+ Expect.throws(() {
+ new Float64List.view(array.buffer, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Float64List.view(array.buffer, 0, -1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Float64List.view(array.buffer, array.lengthInBytes + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Float64List.view(array.buffer, 0, array.lengthInBytes + 1);
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ new Float64List.view(array.buffer, array.lengthInBytes - 1, 2);
+ }, (e) {
+ return e is RangeError;
+ });
+ var empty = new Float64List.view(array.buffer, array.lengthInBytes);
Expect.isTrue(empty is List<double>);
Expect.isTrue(empty is Float64List);
Expect.equals(0, empty.length);
@@ -2285,42 +4720,77 @@ class ByteArrayTest {
Expect.equals(10, view.length);
Expect.equals(8, view.elementSizeInBytes);
Expect.equals(80, view.lengthInBytes);
- Expect.listEquals([-1.0, -1.0, -1.0, -1.0, -1.0,
- -1.0, -1.0, -1.0, -1.0, -1.0],
- view);
- Expect.throws(() { view[-1] = 0.0; },
- (e) { return e is RangeError; });
- Expect.throws(() { return view[-1]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[10]; },
- (e) { return e is RangeError; });
- Expect.throws(() { view[10] = 0.0; },
- (e) { return e is RangeError; });
- Expect.throws(() { array.add(0.0); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.addAll([0]); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.clear(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.length = 0; },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeLast(); },
- (e) { return e is UnsupportedError; });
- Expect.throws(() { array.removeRange(0, array.length - 1); },
- (e) { return e is UnsupportedError; });
+ Expect.listEquals(
+ [-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0], view);
+ Expect.throws(() {
+ view[-1] = 0.0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ return view[-1];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[10];
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ view[10] = 0.0;
+ }, (e) {
+ return e is RangeError;
+ });
+ Expect.throws(() {
+ array.add(0.0);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.addAll([0]);
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.clear();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.length = 0;
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeLast();
+ }, (e) {
+ return e is UnsupportedError;
+ });
+ Expect.throws(() {
+ array.removeRange(0, array.length - 1);
+ }, (e) {
+ return e is UnsupportedError;
+ });
for (int i = 0; i < view.length; ++i) {
view[i] = 1.0 + i;
}
- Expect.listEquals([1.0, 2.0, 3.0, 4.0, 5.0,
- 6.0, 7.0, 8.0, 9.0, 10.0],
- view);
- Expect.listEquals([0xBFF0000000000000, 0x3FF0000000000000,
- 0x4000000000000000, 0x4008000000000000,
- 0x4010000000000000, 0x4014000000000000,
- 0x4018000000000000, 0x401C000000000000,
- 0x4020000000000000, 0x4022000000000000,
- 0x4024000000000000, 0xBFF0000000000000],
- array);
+ Expect
+ .listEquals([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0], view);
+ Expect.listEquals([
+ 0xBFF0000000000000,
+ 0x3FF0000000000000,
+ 0x4000000000000000,
+ 0x4008000000000000,
+ 0x4010000000000000,
+ 0x4014000000000000,
+ 0x4018000000000000,
+ 0x401C000000000000,
+ 0x4020000000000000,
+ 0x4022000000000000,
+ 0x4024000000000000,
+ 0xBFF0000000000000
+ ], array);
// TODO: min, max
for (int i = 0; i < view.length; ++i) {
view[i] = i * 1.0;
@@ -2335,16 +4805,32 @@ class ByteArrayTest {
Expect.equals(4, region.length);
Expect.listEquals([3.0, 4.0, 5.0, 6.0], region);
view.setRange(3, 7, [double.NEGATIVE_INFINITY, 0.0, 1.0, double.INFINITY]);
- Expect.listEquals([0.0, 1.0, 2.0, double.NEGATIVE_INFINITY, 0.0,
- 1.0, double.INFINITY, 7.0, 8.0, 9.0],
- view);
- Expect.listEquals([0xBFF0000000000000, 0x0000000000000000,
- 0x3FF0000000000000, 0x4000000000000000,
- 0xFFF0000000000000, 0x0000000000000000,
- 0x3FF0000000000000, 0x7FF0000000000000,
- 0x401C000000000000, 0x4020000000000000,
- 0x4022000000000000, 0xBFF0000000000000],
- array);
+ Expect.listEquals([
+ 0.0,
+ 1.0,
+ 2.0,
+ double.NEGATIVE_INFINITY,
+ 0.0,
+ 1.0,
+ double.INFINITY,
+ 7.0,
+ 8.0,
+ 9.0
+ ], view);
+ Expect.listEquals([
+ 0xBFF0000000000000,
+ 0x0000000000000000,
+ 0x3FF0000000000000,
+ 0x4000000000000000,
+ 0xFFF0000000000000,
+ 0x0000000000000000,
+ 0x3FF0000000000000,
+ 0x7FF0000000000000,
+ 0x401C000000000000,
+ 0x4020000000000000,
+ 0x4022000000000000,
+ 0xBFF0000000000000
+ ], array);
}
static testFloat64ListView() {
@@ -2381,7 +4867,7 @@ class ByteArrayTest {
}
main() {
- for (var i=0; i<20; i++) {
+ for (var i = 0; i < 20; i++) {
ByteArrayTest.testMain();
}
}
« no previous file with comments | « runtime/tests/vm/dart/byte_array_optimized_test.dart ('k') | runtime/tests/vm/dart/data_uri_spawn_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698