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

Side by Side Diff: tests/html/typed_arrays_5_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « tests/html/queryall_test.dart ('k') | tests/html/websql_test.dart » ('j') | 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 library typed_arrays_5_test; 5 library typed_arrays_5_test;
6 import '../../pkg/unittest/lib/unittest.dart'; 6 import '../../pkg/unittest/lib/unittest.dart';
7 import '../../pkg/unittest/lib/html_config.dart'; 7 import '../../pkg/unittest/lib/html_config.dart';
8 import 'dart:html'; 8 import 'dart:html';
9 9
10 main() { 10 main() {
11 useHtmlConfiguration(); 11 useHtmlConfiguration();
12 12
13 // Only perform tests if ArrayBuffer is supported. 13 // Only perform tests if ArrayBuffer is supported.
14 if (!ArrayBuffer.supported) { 14 if (!ArrayBuffer.supported) {
15 return; 15 return;
16 } 16 }
17 17
18 test('filter_dynamic', () { 18 test('filter_dynamic', () {
19 var a = new Float32Array(1024); 19 var a = new Float32Array(1024);
20 for (int i = 0; i < a.length; i++) { 20 for (int i = 0; i < a.length; i++) {
21 a[i] = i; 21 a[i] = i;
22 } 22 }
23 23
24 expect(a.filter((x) => x >= 1000).length, equals(24)); 24 expect(a.where((x) => x >= 1000).length, equals(24));
25 }); 25 });
26 26
27 test('filter_typed', () { 27 test('filter_typed', () {
28 Float32Array a = new Float32Array(1024); 28 Float32Array a = new Float32Array(1024);
29 for (int i = 0; i < a.length; i++) { 29 for (int i = 0; i < a.length; i++) {
30 a[i] = i; 30 a[i] = i;
31 } 31 }
32 32
33 expect(a.filter((x) => x >= 1000).length, equals(24)); 33 expect(a.where((x) => x >= 1000).length, equals(24));
34 }); 34 });
35 35
36 test('contains', () { 36 test('contains', () {
37 var a = new Int16Array(1024); 37 var a = new Int16Array(1024);
38 for (int i = 0; i < a.length; i++) { 38 for (int i = 0; i < a.length; i++) {
39 a[i] = i; 39 a[i] = i;
40 } 40 }
41 expect(a.contains(0), isTrue); 41 expect(a.contains(0), isTrue);
42 expect(a.contains(5), isTrue); 42 expect(a.contains(5), isTrue);
43 expect(a.contains(1023), isTrue); 43 expect(a.contains(1023), isTrue);
44 44
45 expect(a.contains(-5), isFalse); 45 expect(a.contains(-5), isFalse);
46 expect(a.contains(-1), isFalse); 46 expect(a.contains(-1), isFalse);
47 expect(a.contains(1024), isFalse); 47 expect(a.contains(1024), isFalse);
48 }); 48 });
49 } 49 }
OLDNEW
« no previous file with comments | « tests/html/queryall_test.dart ('k') | tests/html/websql_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698