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

Side by Side Diff: tests/language/number_identity2_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 // Dart test program for testing params. 4 // Dart test program for testing params.
5 // 5 //
6 // Contains test that is failing on dart2js. Merge this test with 6 // Contains test that is failing on dart2js. Merge this test with
7 // 'number_identity_test.dart' once fixed. 7 // 'number_identity_test.dart' once fixed.
8 // VMOptions=--optimization-counter-threshold=10 --no-background-compilation 8 // VMOptions=--optimization-counter-threshold=10 --no-background-compilation
9 9
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
11 import 'dart:typed_data'; 11 import 'dart:typed_data';
12 12
13 double uint64toDouble(int i) { 13 double uint64toDouble(int i) {
14 var buffer = new Uint8List(8).buffer; 14 var buffer = new Uint8List(8).buffer;
15 var bdata = new ByteData.view(buffer); 15 var bdata = new ByteData.view(buffer);
16 bdata.setUint64(0, i); 16 bdata.setUint64(0, i);
17 return bdata.getFloat64(0); 17 return bdata.getFloat64(0);
18 } 18 }
19 19
20 testNumberIdentity () { 20 testNumberIdentity() {
21 var a = double.NAN; 21 var a = double.NAN;
22 var b = a + 0.0; 22 var b = a + 0.0;
23 Expect.isTrue(identical(a, b)); 23 Expect.isTrue(identical(a, b));
24 24
25 a = uint64toDouble((1 << 64) - 1); 25 a = uint64toDouble((1 << 64) - 1);
26 b = uint64toDouble((1 << 64) - 2); 26 b = uint64toDouble((1 << 64) - 2);
27 Expect.isFalse(identical(a, b)); 27 Expect.isFalse(identical(a, b));
28 28
29 a = 0.0/0.0; 29 a = 0.0 / 0.0;
30 b = 1.0/0.0; 30 b = 1.0 / 0.0;
31 Expect.isFalse(identical(a, b)); 31 Expect.isFalse(identical(a, b));
32 } 32 }
33 33
34 main() { 34 main() {
35 for (int i = 0; i < 20; i++) { 35 for (int i = 0; i < 20; i++) {
36 testNumberIdentity(); 36 testNumberIdentity();
37 } 37 }
38 } 38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698