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

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

Issue 11144021: Fix crashes in intrinsified float32/float64 array setters when attempting to store a Smi. Added tes… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 native float arrays. 5 // Dart test program for testing native float arrays.
6 6
7 // Library tag to be able to run in html test framework. 7 // Library tag to be able to run in html test framework.
8 #library("FloatArrayTest.dart"); 8 #library("FloatArrayTest.dart");
9 9
10 #import('dart:scalarlist'); 10 #import('dart:scalarlist');
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 list = new Float32List(10); 75 list = new Float32List(10);
76 for (int i = 0; i < list.length; i++) { 76 for (int i = 0; i < list.length; i++) {
77 list[i] = i + 10.0; 77 list[i] = i + 10.0;
78 } 78 }
79 Expect.equals(0, list.indexOf(10.0)); 79 Expect.equals(0, list.indexOf(10.0));
80 Expect.equals(5, list.indexOf(15.0)); 80 Expect.equals(5, list.indexOf(15.0));
81 Expect.equals(9, list.indexOf(19.0)); 81 Expect.equals(9, list.indexOf(19.0));
82 Expect.equals(-1, list.indexOf(20.0)); 82 Expect.equals(-1, list.indexOf(20.0));
83 } 83 }
84 84
85 void testBadValues32() {
86 var list = new Float32List(10);
87 list[0] = 2.0;
88 Expect.throws(() {
89 list[0] = 2;
90 });
91 Expect.throws(() {
92 list[0] = "hello";
93 });
94 }
95
85 void testCreateFloat64Array() { 96 void testCreateFloat64Array() {
86 Float64List floatArray; 97 Float64List floatArray;
87 98
88 floatArray = new Float64List(0); 99 floatArray = new Float64List(0);
89 Expect.equals(0, floatArray.length); 100 Expect.equals(0, floatArray.length);
90 101
91 floatArray = new Float64List(10); 102 floatArray = new Float64List(10);
92 Expect.equals(10, floatArray.length); 103 Expect.equals(10, floatArray.length);
93 for (int i = 0; i < 10; i++) { 104 for (int i = 0; i < 10; i++) {
94 Expect.equals(0.0, floatArray[i]); 105 Expect.equals(0.0, floatArray[i]);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 list = new Float64List(10); 159 list = new Float64List(10);
149 for (int i = 0; i < list.length; i++) { 160 for (int i = 0; i < list.length; i++) {
150 list[i] = i + 10.0; 161 list[i] = i + 10.0;
151 } 162 }
152 Expect.equals(0, list.indexOf(10.0)); 163 Expect.equals(0, list.indexOf(10.0));
153 Expect.equals(5, list.indexOf(15.0)); 164 Expect.equals(5, list.indexOf(15.0));
154 Expect.equals(9, list.indexOf(19.0)); 165 Expect.equals(9, list.indexOf(19.0));
155 Expect.equals(-1, list.indexOf(20.0)); 166 Expect.equals(-1, list.indexOf(20.0));
156 } 167 }
157 168
169 void testBadValues64() {
170 var list = new Float64List(10);
171 list[0] = 2.0;
172 Expect.throws(() {
173 list[0] = 2;
174 });
175 Expect.throws(() {
176 list[0] = "hello";
177 });
178 }
179
158 main() { 180 main() {
159 for (int i = 0; i < 2000; i++) { 181 for (int i = 0; i < 2000; i++) {
160 testCreateFloat32Array(); 182 testCreateFloat32Array();
161 testSetRange32(); 183 testSetRange32();
162 testIndexOutOfRange32(); 184 testIndexOutOfRange32();
163 testIndexOf32(); 185 testIndexOf32();
164 } 186 }
165 for (int i = 0; i < 2000; i++) { 187 for (int i = 0; i < 2000; i++) {
166 testCreateFloat64Array(); 188 testCreateFloat64Array();
167 testSetRange64(); 189 testSetRange64();
168 testIndexOutOfRange64(); 190 testIndexOutOfRange64();
169 testIndexOf64(); 191 testIndexOf64();
170 } 192 }
193 // These two take a long time in checked mode.
194 testBadValues32();
195 testBadValues64();
171 } 196 }
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