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

Side by Side Diff: frog/tests/leg_only/nan_negate_test.dart

Issue 10536169: Move frog/tests/{leg,leg_only,frog_native} to tests/compiler/. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« no previous file with comments | « frog/tests/leg_only/naming_test.dart ('k') | frog/tests/leg_only/no_such_method_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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Don't convert !(a op b) to (a neg-op b) when a or b might be NaN.
6 test(double n) {
7 // Force known type to double, preserves NaN.
8 n = 0.0 + n;
9 Expect.isFalse(n >= 0);
10 Expect.isTrue(!(n < 0));
11
12 Expect.isFalse(n <= 0);
13 Expect.isTrue(!(n > 0));
14
15 Expect.isFalse(n < 0);
16 Expect.isTrue(!(n >= 0));
17
18 Expect.isFalse(n > 0);
19 Expect.isTrue(!(n <= 0));
20
21 Expect.isFalse(n == 0);
22 Expect.isFalse(!(n != 0));
23
24 Expect.isTrue(n != 0);
25 Expect.isTrue(!(n == 0));
26
27 Expect.isFalse(n === 0);
28 Expect.isFalse(!(n !== 0));
29
30 Expect.isTrue(n !== 0);
31 Expect.isTrue(!(n === 0));
32
33 Expect.isFalse(0 >= n);
34 Expect.isTrue(!(0 < n));
35
36 Expect.isFalse(0 <= n);
37 Expect.isTrue(!(0 > n));
38
39 Expect.isFalse(0 < n);
40 Expect.isTrue(!(0 >= n));
41
42 Expect.isFalse(0 > n);
43 Expect.isTrue(!(0 <= n));
44
45 Expect.isFalse(0 == n);
46 Expect.isFalse(!(0 != n));
47
48 Expect.isTrue(0 != n);
49 Expect.isTrue(!(0 == n));
50
51 Expect.isFalse(0 === n);
52 Expect.isFalse(!(0 !== n));
53
54 Expect.isTrue(0 !== n);
55 Expect.isTrue(!(0 === n));
56 }
57
58 testConstant() {
59 Expect.isFalse(double.NAN >= 0);
60 Expect.isTrue(!(double.NAN < 0));
61
62 Expect.isFalse(double.NAN <= 0);
63 Expect.isTrue(!(double.NAN > 0));
64
65 Expect.isFalse(double.NAN < 0);
66 Expect.isTrue(!(double.NAN >= 0));
67
68 Expect.isFalse(double.NAN > 0);
69 Expect.isTrue(!(double.NAN <= 0));
70
71 Expect.isFalse(double.NAN == 0);
72 Expect.isFalse(!(double.NAN != 0));
73
74 Expect.isTrue(double.NAN != 0);
75 Expect.isTrue(!(double.NAN == 0));
76
77 Expect.isFalse(double.NAN === 0);
78 Expect.isFalse(!(double.NAN !== 0));
79
80 Expect.isTrue(double.NAN !== 0);
81 Expect.isTrue(!(double.NAN === 0));
82
83 Expect.isFalse(0 >= double.NAN);
84 Expect.isTrue(!(0 < double.NAN));
85
86 Expect.isFalse(0 <= double.NAN);
87 Expect.isTrue(!(0 > double.NAN));
88
89 Expect.isFalse(0 < double.NAN);
90 Expect.isTrue(!(0 >= double.NAN));
91
92 Expect.isFalse(0 > double.NAN);
93 Expect.isTrue(!(0 <= double.NAN));
94
95 Expect.isFalse(0 == double.NAN);
96 Expect.isFalse(!(0 != double.NAN));
97
98 Expect.isTrue(0 != double.NAN);
99 Expect.isTrue(!(0 == double.NAN));
100
101 Expect.isFalse(0 === double.NAN);
102 Expect.isFalse(!(0 !== double.NAN));
103
104 Expect.isTrue(0 !== double.NAN);
105 Expect.isTrue(!(0 === double.NAN));
106 }
107
108 main() {
109 test(hideConstant(27, double.NAN));
110 testConstant();
111 }
112
113 double hideConstant(int n, double result) {
114 if (n == 1) return result;
115 if ((n & 1) == 0) return hideConstant(n >> 1, result);
116 return hideConstant(3 * n + 1, result);
117 }
OLDNEW
« no previous file with comments | « frog/tests/leg_only/naming_test.dart ('k') | frog/tests/leg_only/no_such_method_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698