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

Side by Side Diff: tests/standalone/typed_data_test.dart

Issue 308513005: Intrinsify [] for ExternalUint8 and Uint8 typed data. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intrinsifier_x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 typed_data[3] = 127; 53 typed_data[3] = 127;
54 Expect.equals(127, typed_data[3]); 54 Expect.equals(127, typed_data[3]);
55 // This should eventually throw. 55 // This should eventually throw.
56 typed_data[0] = 128; 56 typed_data[0] = 128;
57 typed_data[4] = -129; 57 typed_data[4] = -129;
58 if (check_throws) { 58 if (check_throws) {
59 Expect.throws(() { 59 Expect.throws(() {
60 typed_data[1] = 1.2; 60 typed_data[1] = 1.2;
61 }); 61 });
62 } 62 }
63 Expect.throws(() => typed_data[-1]);
64 Expect.throws(() => typed_data[100]);
65 Expect.throws(() => typed_data[2.0]);
63 } 66 }
64 67
65 void testUnsignedTypedDataRange(bool check_throws) { 68 void testUnsignedTypedDataRange(bool check_throws) {
66 Uint8List typed_data; 69 Uint8List typed_data;
67 typed_data = new Uint8List(10); 70 typed_data = new Uint8List(10);
68 71
69 typed_data[1] = 255; 72 typed_data[1] = 255;
70 Expect.equals(255, typed_data[1]); 73 Expect.equals(255, typed_data[1]);
71 typed_data[1] = 0; 74 typed_data[1] = 0;
72 Expect.equals(0, typed_data[1]); 75 Expect.equals(0, typed_data[1]);
73 76
74 for (int i = 0; i < typed_data.length; i++) { 77 for (int i = 0; i < typed_data.length; i++) {
75 typed_data[i] = i; 78 typed_data[i] = i;
76 } 79 }
77 for (int i = 0; i < typed_data.length; i++) { 80 for (int i = 0; i < typed_data.length; i++) {
78 Expect.equals(i, typed_data[i]); 81 Expect.equals(i, typed_data[i]);
79 } 82 }
80 83
81 // These should eventually throw. 84 // These should eventually throw.
82 typed_data[1] = 256; 85 typed_data[1] = 256;
83 typed_data[1] = -1; 86 typed_data[1] = -1;
84 typed_data[2] = -129; 87 typed_data[2] = -129;
85 if (check_throws) { 88 if (check_throws) {
86 Expect.throws(() { 89 Expect.throws(() {
87 typed_data[1] = 1.2; 90 typed_data[1] = 1.2;
88 }); 91 });
89 } 92 }
93 Expect.throws(() => typed_data[-1]);
94 Expect.throws(() => typed_data[100]);
95 Expect.throws(() => typed_data[2.0]);
90 } 96 }
91 97
92 void testClampedUnsignedTypedDataRangeHelper(Uint8ClampedList typed_data, 98 void testClampedUnsignedTypedDataRangeHelper(Uint8ClampedList typed_data,
93 bool check_throws) { 99 bool check_throws) {
94 Uint8ClampedList typed_data; 100 Uint8ClampedList typed_data;
95 typed_data = new Uint8ClampedList(10); 101 typed_data = new Uint8ClampedList(10);
96 102
97 typed_data[1] = 255; 103 typed_data[1] = 255;
98 Expect.equals(255, typed_data[1]); 104 Expect.equals(255, typed_data[1]);
99 typed_data[1] = 0; 105 typed_data[1] = 0;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 testSetAtIndex(float64list, 1.4260258159703532e-105, true); 411 testSetAtIndex(float64list, 1.4260258159703532e-105, true);
406 testGetAtIndex(float64list, 1.4260258159703532e-105); 412 testGetAtIndex(float64list, 1.4260258159703532e-105);
407 } 413 }
408 testTypedDataRange(true); 414 testTypedDataRange(true);
409 testUnsignedTypedDataRange(true); 415 testUnsignedTypedDataRange(true);
410 testViewCreation(); 416 testViewCreation();
411 testWhere(); 417 testWhere();
412 testCreationFromList(); 418 testCreationFromList();
413 } 419 }
414 420
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698