| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 Expect.throws(() { | 168 Expect.throws(() { |
| 169 typed_data.setRange(3, 4, list); | 169 typed_data.setRange(3, 4, list); |
| 170 }); | 170 }); |
| 171 | 171 |
| 172 Expect.throws(() { | 172 Expect.throws(() { |
| 173 typed_data[new C(-4000000)] = value; | 173 typed_data[new C(-4000000)] = value; |
| 174 }); | 174 }); |
| 175 | 175 |
| 176 Expect.throws(() { | 176 Expect.throws(() { |
| 177 var size = typed_data.elementSizeInBytes; | 177 var size = typed_data.elementSizeInBytes; |
| 178 var i = (typed_data.length - 1) * size + 1; | 178 var i = (typed_data.length - 1) * size + 1; |
| 179 typed_data[new C(i)] = value; | 179 typed_data[new C(i)] = value; |
| 180 }); | 180 }); |
| 181 | 181 |
| 182 Expect.throws(() { | 182 Expect.throws(() { |
| 183 typed_data[new C(-1)] = value; | 183 typed_data[new C(-1)] = value; |
| 184 }); | 184 }); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void testIndexOutOfRange() { | 187 void testIndexOutOfRange() { |
| 188 testIndexOutOfRangeHelper(new Int8List(3), 0); | 188 testIndexOutOfRangeHelper(new Int8List(3), 0); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 bdata.setInt64(i, 3038287259199220266, Endianness.LITTLE_ENDIAN); | 295 bdata.setInt64(i, 3038287259199220266, Endianness.LITTLE_ENDIAN); |
| 296 } | 296 } |
| 297 validate(); | 297 validate(); |
| 298 for (int i = 0; i < bdata.lengthInBytes-7; i+=8) { | 298 for (int i = 0; i < bdata.lengthInBytes-7; i+=8) { |
| 299 bdata.setFloat64(i, 1.4260258159703532e-105, Endianness.LITTLE_ENDIAN); | 299 bdata.setFloat64(i, 1.4260258159703532e-105, Endianness.LITTLE_ENDIAN); |
| 300 } | 300 } |
| 301 validate(false); | 301 validate(false); |
| 302 } | 302 } |
| 303 | 303 |
| 304 testViewCreation() { | 304 testViewCreation() { |
| 305 var bytes = new Uint8List(1024); | 305 var bytes = new Uint8List(1024).buffer; |
| 306 var view = new ByteData.view(bytes, 24); | 306 var view = new ByteData.view(bytes, 24); |
| 307 Expect.equals(1000, view.lengthInBytes); | 307 Expect.equals(1000, view.lengthInBytes); |
| 308 view = new Uint8List.view(bytes, 24); | 308 view = new Uint8List.view(bytes, 24); |
| 309 Expect.equals(1000, view.lengthInBytes); | 309 Expect.equals(1000, view.lengthInBytes); |
| 310 view = new Int8List.view(bytes, 24); | 310 view = new Int8List.view(bytes, 24); |
| 311 Expect.equals(1000, view.lengthInBytes); | 311 Expect.equals(1000, view.lengthInBytes); |
| 312 view = new Uint8ClampedList.view(bytes, 24); | 312 view = new Uint8ClampedList.view(bytes, 24); |
| 313 Expect.equals(1000, view.lengthInBytes); | 313 Expect.equals(1000, view.lengthInBytes); |
| 314 view = new Uint16List.view(bytes, 24); | 314 view = new Uint16List.view(bytes, 24); |
| 315 Expect.equals(1000, view.lengthInBytes); | 315 Expect.equals(1000, view.lengthInBytes); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 testSetAtIndex(float64list, 1.4260258159703532e-105, true); | 411 testSetAtIndex(float64list, 1.4260258159703532e-105, true); |
| 412 testGetAtIndex(float64list, 1.4260258159703532e-105); | 412 testGetAtIndex(float64list, 1.4260258159703532e-105); |
| 413 } | 413 } |
| 414 testTypedDataRange(true); | 414 testTypedDataRange(true); |
| 415 testUnsignedTypedDataRange(true); | 415 testUnsignedTypedDataRange(true); |
| 416 testViewCreation(); | 416 testViewCreation(); |
| 417 testWhere(); | 417 testWhere(); |
| 418 testCreationFromList(); | 418 testCreationFromList(); |
| 419 } | 419 } |
| 420 | 420 |
| OLD | NEW |