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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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
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
6 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
7 import 'package:unittest/html_config.dart'; 8 import 'package:unittest/html_config.dart';
8 import 'dart:html'; 9 import 'dart:html';
9 import 'dart:typed_data'; 10 import 'dart:typed_data';
10 11
11 main() { 12 main() {
12 useHtmlConfiguration(); 13 useHtmlConfiguration();
13 14
14 // Only perform tests if ArrayBuffer is supported. 15 // Only perform tests if ArrayBuffer is supported.
15 if (!Platform.supportsTypedData) { 16 if (!Platform.supportsTypedData) {
16 return; 17 return;
17 } 18 }
18 19
19 test('filter_dynamic', () { 20 test('filter_dynamic', () {
20 var a = new Float32List(1024); 21 var a = new Float32List(1024);
21 for (int i = 0; i < a.length; i++) { 22 for (int i = 0; i < a.length; i++) {
22 a[i] = i.toDouble(); 23 a[i] = i.toDouble();
23 } 24 }
24 25
25 expect(a.where((x) => x >= 1000).length, equals(24)); 26 expect(a.where((x) => x >= 1000).length, equals(24));
26 }); 27 });
27 28
28 test('filter_typed', () { 29 test('filter_typed', () {
29 Float32List a = new Float32List(1024); 30 Float32List a = new Float32List(1024);
30 for (int i = 0; i < a.length; i++) { 31 for (int i = 0; i < a.length; i++) {
31 a[i] = i.toDouble(); 32 a[i] = i.toDouble();
32 } 33 }
33 34
34 expect(a.where((x) => x >= 1000).length, equals(24)); 35 expect(a.where((x) => x >= 1000).length, equals(24));
35 }); 36 });
36 37
37 test('contains', () { 38 test('contains', () {
38 var a = new Int16List(1024); 39 var a = new Int16List(1024);
39 for (int i = 0; i < a.length; i++) { 40 for (int i = 0; i < a.length; i++) {
40 a[i] = i; 41 a[i] = i;
41 } 42 }
42 expect(a.contains(0), isTrue); 43 expect(a.contains(0), isTrue);
43 expect(a.contains(5), isTrue); 44 expect(a.contains(5), isTrue);
44 expect(a.contains(1023), isTrue); 45 expect(a.contains(1023), isTrue);
45 46
46 expect(a.contains(-5), isFalse); 47 expect(a.contains(-5), isFalse);
47 expect(a.contains(-1), isFalse); 48 expect(a.contains(-1), isFalse);
48 expect(a.contains(1024), isFalse); 49 expect(a.contains(1024), isFalse);
49 }); 50 });
50 } 51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698