| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // | 4 // |
| 5 // Dart test program for testing typed data. | 5 // Dart test program for testing typed data. |
| 6 | 6 |
| 7 // VMOptions=--optimization_counter_threshold=10 | 7 // VMOptions=--optimization_counter_threshold=10 |
| 8 | 8 |
| 9 // Library tag to be able to run in html test framework. | 9 // Library tag to be able to run in html test framework. |
| 10 library TypedDataTest; | 10 library TypedDataTest; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 Expect.throws(() { | 162 Expect.throws(() { |
| 163 typed_data.setRange(3, 4, list); | 163 typed_data.setRange(3, 4, list); |
| 164 }); | 164 }); |
| 165 | 165 |
| 166 Expect.throws(() { | 166 Expect.throws(() { |
| 167 typed_data[new C(-4000000)] = value; | 167 typed_data[new C(-4000000)] = value; |
| 168 }); | 168 }); |
| 169 | 169 |
| 170 Expect.throws(() { | 170 Expect.throws(() { |
| 171 var size = typed_data.elementSizeInBytes; | 171 var size = typed_data.elementSizeInBytes; |
| 172 var i = (typed_data.length - 1) * size + 1; | 172 var i = (typed_data.length - 1) * size + 1; |
| 173 typed_data[new C(i)] = value; | 173 typed_data[new C(i)] = value; |
| 174 }); | 174 }); |
| 175 | 175 |
| 176 Expect.throws(() { | 176 Expect.throws(() { |
| 177 typed_data[new C(-1)] = value; | 177 typed_data[new C(-1)] = value; |
| 178 }); | 178 }); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void testIndexOutOfRange() { | 181 void testIndexOutOfRange() { |
| 182 testIndexOutOfRangeHelper(new Int8List(3), 0); | 182 testIndexOutOfRangeHelper(new Int8List(3), 0); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 bdata.setInt64(i, 3038287259199220266, Endianness.LITTLE_ENDIAN); | 289 bdata.setInt64(i, 3038287259199220266, Endianness.LITTLE_ENDIAN); |
| 290 } | 290 } |
| 291 validate(); | 291 validate(); |
| 292 for (int i = 0; i < bdata.lengthInBytes-7; i+=8) { | 292 for (int i = 0; i < bdata.lengthInBytes-7; i+=8) { |
| 293 bdata.setFloat64(i, 1.4260258159703532e-105, Endianness.LITTLE_ENDIAN); | 293 bdata.setFloat64(i, 1.4260258159703532e-105, Endianness.LITTLE_ENDIAN); |
| 294 } | 294 } |
| 295 validate(false); | 295 validate(false); |
| 296 } | 296 } |
| 297 | 297 |
| 298 testViewCreation() { | 298 testViewCreation() { |
| 299 var bytes = new Uint8List(1024); | 299 var bytes = new Uint8List(1024).buffer; |
| 300 var view = new ByteData.view(bytes, 24); | 300 var view = new ByteData.view(bytes, 24); |
| 301 Expect.equals(1000, view.lengthInBytes); | 301 Expect.equals(1000, view.lengthInBytes); |
| 302 view = new Uint8List.view(bytes, 24); | 302 view = new Uint8List.view(bytes, 24); |
| 303 Expect.equals(1000, view.lengthInBytes); | 303 Expect.equals(1000, view.lengthInBytes); |
| 304 view = new Int8List.view(bytes, 24); | 304 view = new Int8List.view(bytes, 24); |
| 305 Expect.equals(1000, view.lengthInBytes); | 305 Expect.equals(1000, view.lengthInBytes); |
| 306 view = new Uint8ClampedList.view(bytes, 24); | 306 view = new Uint8ClampedList.view(bytes, 24); |
| 307 Expect.equals(1000, view.lengthInBytes); | 307 Expect.equals(1000, view.lengthInBytes); |
| 308 view = new Uint16List.view(bytes, 24); | 308 view = new Uint16List.view(bytes, 24); |
| 309 Expect.equals(1000, view.lengthInBytes); | 309 Expect.equals(1000, view.lengthInBytes); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 testSetAtIndex(float64list, 1.4260258159703532e-105, true); | 405 testSetAtIndex(float64list, 1.4260258159703532e-105, true); |
| 406 testGetAtIndex(float64list, 1.4260258159703532e-105); | 406 testGetAtIndex(float64list, 1.4260258159703532e-105); |
| 407 } | 407 } |
| 408 testTypedDataRange(true); | 408 testTypedDataRange(true); |
| 409 testUnsignedTypedDataRange(true); | 409 testUnsignedTypedDataRange(true); |
| 410 testViewCreation(); | 410 testViewCreation(); |
| 411 testWhere(); | 411 testWhere(); |
| 412 testCreationFromList(); | 412 testCreationFromList(); |
| 413 } | 413 } |
| 414 | 414 |
| OLD | NEW |