Index: runtime/tests/vm/dart/byte_array_optimized_test.dart |
diff --git a/runtime/tests/vm/dart/byte_array_optimized_test.dart b/runtime/tests/vm/dart/byte_array_optimized_test.dart |
index 59b7085ba6f31f25d31c69c47e25375124d5be8e..755c3b1b6d7ef6ad165c9ff1f104ba13ce5836c1 100644 |
--- a/runtime/tests/vm/dart/byte_array_optimized_test.dart |
+++ b/runtime/tests/vm/dart/byte_array_optimized_test.dart |
@@ -17,79 +17,59 @@ class OptimizedByteArrayTest { |
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; |
} |
@@ -105,15 +85,12 @@ class OptimizedByteArrayTest { |
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); |
} |
@@ -123,70 +100,47 @@ class OptimizedByteArrayTest { |
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; |
} |
@@ -202,15 +156,13 @@ class OptimizedByteArrayTest { |
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); |
} |
@@ -220,99 +172,59 @@ class OptimizedByteArrayTest { |
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; |
} |
@@ -328,15 +240,13 @@ class OptimizedByteArrayTest { |
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); |
} |
@@ -346,80 +256,47 @@ class OptimizedByteArrayTest { |
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; |
} |
@@ -435,15 +312,13 @@ class OptimizedByteArrayTest { |
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); |
} |
@@ -453,99 +328,65 @@ class OptimizedByteArrayTest { |
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; |
} |
@@ -561,15 +402,13 @@ class OptimizedByteArrayTest { |
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); |
} |
@@ -579,80 +418,50 @@ class OptimizedByteArrayTest { |
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; |
} |
@@ -668,22 +477,18 @@ class OptimizedByteArrayTest { |
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) { |
@@ -691,99 +496,65 @@ class OptimizedByteArrayTest { |
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; |
} |
@@ -799,17 +570,14 @@ class OptimizedByteArrayTest { |
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); |
} |
@@ -819,80 +587,50 @@ class OptimizedByteArrayTest { |
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; |
} |
@@ -908,15 +646,13 @@ class OptimizedByteArrayTest { |
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); |
} |
@@ -926,63 +662,35 @@ class OptimizedByteArrayTest { |
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; |
@@ -999,26 +707,14 @@ class OptimizedByteArrayTest { |
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); |
} |
@@ -1028,63 +724,35 @@ class OptimizedByteArrayTest { |
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; |
@@ -1101,26 +769,14 @@ class OptimizedByteArrayTest { |
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); |
} |
@@ -1132,32 +788,21 @@ class OptimizedByteArrayTest { |
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); |
@@ -1171,110 +816,74 @@ class OptimizedByteArrayTest { |
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; |
} |
@@ -1288,10 +897,11 @@ class OptimizedByteArrayTest { |
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); |
@@ -1305,32 +915,21 @@ class OptimizedByteArrayTest { |
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); |
@@ -1344,74 +943,56 @@ class OptimizedByteArrayTest { |
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; |
} |
@@ -1425,7 +1006,8 @@ class OptimizedByteArrayTest { |
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() { |
@@ -1440,32 +1022,21 @@ class OptimizedByteArrayTest { |
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); |
@@ -1479,229 +1050,79 @@ class OptimizedByteArrayTest { |
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, |
- 0xFA, |
- 0xFF, |
- 0xFB, |
- 0xFF, |
- 0xFC, |
- 0xFF, |
- 0xFD, |
- 0xFF, |
- 0xFE, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF |
- ], array); |
+ 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, 0xFA, 0xFF, 0xFB, 0xFF, 0xFC, 0xFF, |
+ 0xFD, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], |
+ array); |
for (int i = 0; i < view.length; ++i) { |
view[i] = 0x7FFF - i; |
} |
- Expect.listEquals([ |
- 0x7FFF, |
- 0x7FFE, |
- 0x7FFD, |
- 0x7FFC, |
- 0x7FFB, |
- 0x7FFA, |
- 0x7FF9, |
- 0x7FF8, |
- 0x7FF7, |
- 0x7FF6 |
- ], view); |
- Expect.listEquals([ |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xFE, |
- 0x7F, |
- 0xFD, |
- 0x7F, |
- 0xFC, |
- 0x7F, |
- 0xFB, |
- 0x7F, |
- 0xFA, |
- 0x7F, |
- 0xF9, |
- 0x7F, |
- 0xF8, |
- 0x7F, |
- 0xF7, |
- 0x7F, |
- 0xF6, |
- 0x7F, |
- 0xFF, |
- 0xFF |
- ], array); |
+ Expect.listEquals([0x7FFF, 0x7FFE, 0x7FFD, 0x7FFC, 0x7FFB, |
+ 0x7FFA, 0x7FF9, 0x7FF8, 0x7FF7, 0x7FF6], |
+ view); |
+ Expect.listEquals([0xFF, 0xFF, 0xFF, 0x7F, 0xFE, 0x7F, 0xFD, 0x7F, |
+ 0xFC, 0x7F, 0xFB, 0x7F, 0xFA, 0x7F, 0xF9, 0x7F, |
+ 0xF8, 0x7F, 0xF7, 0x7F, 0xF6, 0x7F, 0xFF, 0xFF], |
+ 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; |
} |
@@ -1715,33 +1136,12 @@ class OptimizedByteArrayTest { |
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() { |
@@ -1757,32 +1157,21 @@ class OptimizedByteArrayTest { |
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); |
@@ -1796,169 +1185,57 @@ class OptimizedByteArrayTest { |
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; |
} |
@@ -1972,33 +1249,12 @@ class OptimizedByteArrayTest { |
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() { |
@@ -2014,32 +1270,21 @@ class OptimizedByteArrayTest { |
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); |
@@ -2053,349 +1298,100 @@ class OptimizedByteArrayTest { |
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([ |
- 0x7FFFFFFF, |
- 0x7FFFFFFE, |
- 0x7FFFFFFD, |
- 0x7FFFFFFC, |
- 0x7FFFFFFB, |
- 0x7FFFFFFA, |
- 0x7FFFFFF9, |
- 0x7FFFFFF8, |
- 0x7FFFFFF7, |
- 0x7FFFFFF6 |
- ], view); |
- Expect.listEquals([ |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xFE, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xFD, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xFC, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xFB, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xFA, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xF9, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xF8, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xF7, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xF6, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF |
- ], array); |
+ Expect.listEquals([0x7FFFFFFF, 0x7FFFFFFE, |
+ 0x7FFFFFFD, 0x7FFFFFFC, |
+ 0x7FFFFFFB, 0x7FFFFFFA, |
+ 0x7FFFFFF9, 0x7FFFFFF8, |
+ 0x7FFFFFF7, 0x7FFFFFF6], |
+ view); |
+ Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, |
+ 0xFE, 0xFF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF, 0x7F, |
+ 0xFC, 0xFF, 0xFF, 0x7F, 0xFB, 0xFF, 0xFF, 0x7F, |
+ 0xFA, 0xFF, 0xFF, 0x7F, 0xF9, 0xFF, 0xFF, 0x7F, |
+ 0xF8, 0xFF, 0xFF, 0x7F, 0xF7, 0xFF, 0xFF, 0x7F, |
+ 0xF6, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 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; |
} |
@@ -2409,57 +1405,15 @@ class OptimizedByteArrayTest { |
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) { |
@@ -2470,32 +1424,21 @@ class OptimizedByteArrayTest { |
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); |
@@ -2509,241 +1452,71 @@ class OptimizedByteArrayTest { |
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([ |
- -1, |
- -1, |
- -1, |
- -1, |
- 1, |
- 0, |
- 0, |
- 0, |
- 2, |
- 0, |
- 0, |
- 0, |
- 3, |
- 0, |
- 0, |
- 0, |
- 4, |
- 0, |
- 0, |
- 0, |
- 5, |
- 0, |
- 0, |
- 0, |
- 6, |
- 0, |
- 0, |
- 0, |
- 7, |
- 0, |
- 0, |
- 0, |
- 8, |
- 0, |
- 0, |
- 0, |
- 9, |
- 0, |
- 0, |
- 0, |
- 10, |
- 0, |
- 0, |
- 0, |
- -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, 0, 0, 0, |
+ 2, 0, 0, 0, 3, 0, 0, 0, |
+ 4, 0, 0, 0, 5, 0, 0, 0, |
+ 6, 0, 0, 0, 7, 0, 0, 0, |
+ 8, 0, 0, 0, 9, 0, 0, 0, |
+ 10, 0, 0, 0, -1, -1, -1, -1], |
+ 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([ |
- -1, |
- -1, |
- -1, |
- -1, |
- 0, |
- 0, |
- 0, |
- 0, |
- 1, |
- 0, |
- 0, |
- 0, |
- 2, |
- 0, |
- 0, |
- 0, |
- 3, |
- 0, |
- 0, |
- 0, |
- 4, |
- 0, |
- 0, |
- 0, |
- 5, |
- 0, |
- 0, |
- 0, |
- 6, |
- 0, |
- 0, |
- 0, |
- 7, |
- 0, |
- 0, |
- 0, |
- 8, |
- 0, |
- 0, |
- 0, |
- 9, |
- 0, |
- 0, |
- 0, |
- -1, |
- -1, |
- -1, |
- -1 |
- ], array); |
+ Expect.listEquals([0, 1, 2, 3, 4, |
+ 5, 6, 7, 8, 9], |
+ view); |
+ Expect.listEquals([-1, -1, -1, -1, 0, 0, 0, 0, |
+ 1, 0, 0, 0, 2, 0, 0, 0, |
+ 3, 0, 0, 0, 4, 0, 0, 0, |
+ 5, 0, 0, 0, 6, 0, 0, 0, |
+ 7, 0, 0, 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; |
} |
@@ -2757,57 +1530,15 @@ class OptimizedByteArrayTest { |
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() { |
@@ -2822,32 +1553,21 @@ class OptimizedByteArrayTest { |
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); |
@@ -2861,589 +1581,130 @@ class OptimizedByteArrayTest { |
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, 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); |
for (int i = 0; i < view.length; ++i) { |
view[i] = 0x10000000000000000 + i; |
} |
- Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 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, |
- 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, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF |
- ], array); |
+ Expect.listEquals([0, 1, 2, 3, 4, |
+ 5, 6, 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, |
+ 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, |
+ 0xFF, 0xFF, 0xFF, 0xFF, 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, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xF6, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xF7, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xF8, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xF9, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFA, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFB, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFC, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFD, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFE, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 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, 0xFF, 0xFF, 0xFF, 0xFF, |
+ 0xF6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
+ 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
+ 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
+ 0xF9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
+ 0xFA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
+ 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
+ 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
+ 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
+ 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], |
+ array); |
for (int i = 0; i < view.length; ++i) { |
view[i] = 0x7FFFFFFFFFFFFFFF - i; |
} |
- Expect.listEquals([ |
- 0x7FFFFFFFFFFFFFFF, |
- 0x7FFFFFFFFFFFFFFE, |
- 0x7FFFFFFFFFFFFFFD, |
- 0x7FFFFFFFFFFFFFFC, |
- 0x7FFFFFFFFFFFFFFB, |
- 0x7FFFFFFFFFFFFFFA, |
- 0x7FFFFFFFFFFFFFF9, |
- 0x7FFFFFFFFFFFFFF8, |
- 0x7FFFFFFFFFFFFFF7, |
- 0x7FFFFFFFFFFFFFF6 |
- ], view); |
- Expect.listEquals([ |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xFE, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xFD, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xFC, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xFB, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xFA, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xF9, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xF8, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xF7, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xF6, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF |
- ], array); |
+ Expect.listEquals([0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFE, |
+ 0x7FFFFFFFFFFFFFFD, 0x7FFFFFFFFFFFFFFC, |
+ 0x7FFFFFFFFFFFFFFB, 0x7FFFFFFFFFFFFFFA, |
+ 0x7FFFFFFFFFFFFFF9, 0x7FFFFFFFFFFFFFF8, |
+ 0x7FFFFFFFFFFFFFF7, 0x7FFFFFFFFFFFFFF6], |
+ view); |
+ Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, |
+ 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, |
+ 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, |
+ 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, |
+ 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, |
+ 0xFA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, |
+ 0xF9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, |
+ 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, |
+ 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, |
+ 0xF6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, |
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], |
+ array); |
for (int i = 0; i < view.length; ++i) { |
view[i] = -0x8000000000000000 + i; |
} |
- 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); |
+ 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; |
} |
@@ -3457,107 +1718,22 @@ class OptimizedByteArrayTest { |
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, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0x7F, |
- 0x07, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x08, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x09, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0x00, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF, |
- 0xFF |
- ], array); |
+ 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, |
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
+ 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], |
+ array); |
} |
static testInt64ListView() { |
@@ -3573,32 +1749,21 @@ class OptimizedByteArrayTest { |
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); |
@@ -3612,385 +1777,92 @@ class OptimizedByteArrayTest { |
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, 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); |
for (int i = 0; i < view.length; ++i) { |
view[i] = 0x10000000000000000 + i; |
} |
- Expect.listEquals([0, 1, 2, 3, 4, 5, 6, 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, |
- 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, |
- -1, |
- -1, |
- -1, |
- -1, |
- -1, |
- -1, |
- -1, |
- -1 |
- ], array); |
+ Expect.listEquals([0, 1, 2, 3, 4, |
+ 5, 6, 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, |
+ 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, |
+ -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; |
} |
@@ -4004,105 +1876,21 @@ class OptimizedByteArrayTest { |
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() { |
@@ -4118,32 +1906,21 @@ class OptimizedByteArrayTest { |
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); |
@@ -4157,77 +1934,42 @@ class OptimizedByteArrayTest { |
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; |
@@ -4242,32 +1984,16 @@ class OptimizedByteArrayTest { |
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() { |
@@ -4283,32 +2009,21 @@ class OptimizedByteArrayTest { |
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); |
@@ -4322,77 +2037,42 @@ class OptimizedByteArrayTest { |
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; |
@@ -4407,32 +2087,16 @@ class OptimizedByteArrayTest { |
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() { |
@@ -4466,7 +2130,7 @@ class OptimizedByteArrayTest { |
} |
main() { |
- for (var i = 0; i < 20; i++) { |
+ for (var i=0; i<20; i++) { |
OptimizedByteArrayTest.testMain(); |
} |
} |