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

Side by Side Diff: tests/language/number_identity2_test.dart

Issue 317643004: Unify handling of identical(NaN, NaN) between generated code and Dart API. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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
« runtime/vm/object_test.cc ('K') | « runtime/vm/object_test.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 // 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 8 // VMOptions=--optimization-counter-threshold=10
9 9
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
11 import 'dart:typed_data';
11 12
12 main() { 13 double uint64toDouble(int i) {
13 for (int i = 0; i < 20; i++) testNumberIdentity(); 14 var buffer = new Uint8List(8).buffer;
15 var bdata = new ByteData.view(buffer);
16 bdata.setUint64(0, i);
17 return bdata.getFloat64(0);
14 } 18 }
15 19
16
17 testNumberIdentity () { 20 testNumberIdentity () {
18 var a = double.NAN; 21 var a = double.NAN;
19 var b = a + 0.0; 22 var b = a + 0.0;
20 Expect.isTrue(identical(a, b)); 23 Expect.isTrue(identical(a, b));
24
25 a = uint64toDouble((1 << 64) - 1);
26 b = uint64toDouble((1 << 64) - 2);
27 Expect.isFalse(identical(a, b));
28
29 a = 0.0/0.0;
30 b = 1.0/0.0;
31 Expect.isFalse(identical(a, b));
21 } 32 }
33
34 main() {
35 for (int i = 0; i < 20; i++) {
36 testNumberIdentity();
37 }
38 }
OLDNEW
« runtime/vm/object_test.cc ('K') | « runtime/vm/object_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698