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

Side by Side Diff: tests/html/typed_arrays_4_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 TypedArrays4Test; 5 library TypedArrays4Test;
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('indexOf_dynamic', () { 20 test('indexOf_dynamic', () {
20 var a1 = new Uint8List(1024); 21 var a1 = new Uint8List(1024);
21 for (int i = 0; i < a1.length; i++) { 22 for (int i = 0; i < a1.length; i++) {
22 a1[i] = i; 23 a1[i] = i;
23 } 24 }
24 25
25 expect(a1.indexOf(50), 50); 26 expect(a1.indexOf(50), 50);
26 expect(a1.indexOf(50, 50), 50); 27 expect(a1.indexOf(50, 50), 50);
27 expect(a1.indexOf(50, 51), 256 + 50); 28 expect(a1.indexOf(50, 51), 256 + 50);
28 29
29 expect(a1.lastIndexOf(50), 768 + 50); 30 expect(a1.lastIndexOf(50), 768 + 50);
30 expect(a1.lastIndexOf(50, 768 + 50), 768 + 50); 31 expect(a1.lastIndexOf(50, 768 + 50), 768 + 50);
31 expect(a1.lastIndexOf(50, 768 + 50 - 1), 512 + 50); 32 expect(a1.lastIndexOf(50, 768 + 50 - 1), 512 + 50);
32 }); 33 });
33 34
34 test('indexOf_typed', () { 35 test('indexOf_typed', () {
35 Uint8List a1 = new Uint8List(1024); 36 Uint8List a1 = new Uint8List(1024);
36 for (int i = 0; i < a1.length; i++) { 37 for (int i = 0; i < a1.length; i++) {
37 a1[i] = i; 38 a1[i] = i;
38 } 39 }
39 40
40 expect(a1.indexOf(50), 50); 41 expect(a1.indexOf(50), 50);
41 expect(a1.indexOf(50, 50), 50); 42 expect(a1.indexOf(50, 50), 50);
42 expect(a1.indexOf(50, 51), 256 + 50); 43 expect(a1.indexOf(50, 51), 256 + 50);
43 44
44 expect(a1.lastIndexOf(50), 768 + 50); 45 expect(a1.lastIndexOf(50), 768 + 50);
45 expect(a1.lastIndexOf(50, 768 + 50), 768 + 50); 46 expect(a1.lastIndexOf(50, 768 + 50), 768 + 50);
46 expect(a1.lastIndexOf(50, 768 + 50 - 1), 512 + 50); 47 expect(a1.lastIndexOf(50, 768 + 50 - 1), 512 + 50);
47 }); 48 });
48 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698