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

Side by Side Diff: tests/language/positive_bit_operations_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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 constants() { 7 constants() {
8 Expect.equals(0x80000000, 0x80000000 | 0); 8 Expect.equals(0x80000000, 0x80000000 | 0);
9 Expect.equals(0x80000001, 0x80000000 | 1); 9 Expect.equals(0x80000001, 0x80000000 | 1);
10 Expect.equals(0x80000000, 0x80000000 | 0x80000000); 10 Expect.equals(0x80000000, 0x80000000 | 0x80000000);
11 Expect.equals(0xFFFFFFFF, 0xFFFF0000 | 0xFFFF); 11 Expect.equals(0xFFFFFFFF, 0xFFFF0000 | 0xFFFF);
12 Expect.equals(0x80000000, 0x80000000 & 0xFFFFFFFF); 12 Expect.equals(0x80000000, 0x80000000 & 0xFFFFFFFF);
13 Expect.equals(0x80000000, 0x80000000 & 0x80000000); 13 Expect.equals(0x80000000, 0x80000000 & 0x80000000);
14 Expect.equals(0x80000000, 0x80000000 & 0xF0000000); 14 Expect.equals(0x80000000, 0x80000000 & 0xF0000000);
15 Expect.equals(0x80000000, 0xFFFFFFFF & 0x80000000); 15 Expect.equals(0x80000000, 0xFFFFFFFF & 0x80000000);
16 Expect.equals(0x80000000, 0x80000000 ^ 0); 16 Expect.equals(0x80000000, 0x80000000 ^ 0);
17 Expect.equals(0xFFFFFFFF, 0x80000000 ^ 0x7FFFFFFF); 17 Expect.equals(0xFFFFFFFF, 0x80000000 ^ 0x7FFFFFFF);
18 Expect.equals(0xFFFFFFFF, 0x7FFFFFFF ^ 0x80000000); 18 Expect.equals(0xFFFFFFFF, 0x7FFFFFFF ^ 0x80000000);
19 Expect.equals(0xF0000000, 0x70000000 ^ 0x80000000); 19 Expect.equals(0xF0000000, 0x70000000 ^ 0x80000000);
20 Expect.equals(0x80000000, 1 << 31); 20 Expect.equals(0x80000000, 1 << 31);
21 Expect.equals(0xFFFFFFF0, 0xFFFFFFF << 4); 21 Expect.equals(0xFFFFFFF0, 0xFFFFFFF << 4);
22 Expect.equals(0x7FFFFFFF, 0xFFFFFFFF >> 1); 22 Expect.equals(0x7FFFFFFF, 0xFFFFFFFF >> 1);
23 Expect.equals(0xFFFFFFFC, 23 Expect.equals(
24 ((((((0xFFFFFFF << 4) // 0xFFFFFFF0 24 0xFFFFFFFC,
25 >> 1) // 0x7FFFFFF8 25 ((((((0xFFFFFFF << 4) // 0xFFFFFFF0
26 | 0x80000000) // 0xFFFFFFF8 26 >>
27 >> 2) // 0x3FFFFFFE 27 1) // 0x7FFFFFF8
28 ^ 0x40000000) // 0x7FFFFFFE 28 |
29 << 1)); 29 0x80000000) // 0xFFFFFFF8
30 >>
31 2) // 0x3FFFFFFE
32 ^
33 0x40000000) // 0x7FFFFFFE
34 <<
35 1));
30 } 36 }
31 37
32 foo(i) { 38 foo(i) {
33 if (i != 0) { 39 if (i != 0) {
34 y--; 40 y--;
35 foo(i - 1); 41 foo(i - 1);
36 y++; 42 y++;
37 } 43 }
38 } 44 }
39 45
(...skipping 15 matching lines...) Expand all
55 Expect.equals(0x80000000, id(0x80000000) & id(0x80000000)); 61 Expect.equals(0x80000000, id(0x80000000) & id(0x80000000));
56 Expect.equals(0x80000000, id(0x80000000) & id(0xF0000000)); 62 Expect.equals(0x80000000, id(0x80000000) & id(0xF0000000));
57 Expect.equals(0x80000000, id(0xFFFFFFFF) & id(0x80000000)); 63 Expect.equals(0x80000000, id(0xFFFFFFFF) & id(0x80000000));
58 Expect.equals(0x80000000, id(0x80000000) ^ id(0)); 64 Expect.equals(0x80000000, id(0x80000000) ^ id(0));
59 Expect.equals(0xFFFFFFFF, id(0x80000000) ^ id(0x7FFFFFFF)); 65 Expect.equals(0xFFFFFFFF, id(0x80000000) ^ id(0x7FFFFFFF));
60 Expect.equals(0xFFFFFFFF, id(0x7FFFFFFF) ^ id(0x80000000)); 66 Expect.equals(0xFFFFFFFF, id(0x7FFFFFFF) ^ id(0x80000000));
61 Expect.equals(0xF0000000, id(0x70000000) ^ id(0x80000000)); 67 Expect.equals(0xF0000000, id(0x70000000) ^ id(0x80000000));
62 Expect.equals(0x80000000, id(1) << id(31)); 68 Expect.equals(0x80000000, id(1) << id(31));
63 Expect.equals(0xFFFFFFF0, id(0xFFFFFFF) << id(4)); 69 Expect.equals(0xFFFFFFF0, id(0xFFFFFFF) << id(4));
64 Expect.equals(0x7FFFFFFF, id(0xFFFFFFFF) >> id(1)); 70 Expect.equals(0x7FFFFFFF, id(0xFFFFFFFF) >> id(1));
65 Expect.equals(0xFFFFFFFC, 71 Expect.equals(
66 ((((((id(0xFFFFFFF) << 4) // 0xFFFFFFF0 72 0xFFFFFFFC,
67 >> 1) // 0x7FFFFFF8 73 ((((((id(0xFFFFFFF) << 4) // 0xFFFFFFF0
68 | 0x80000000) // 0xFFFFFFF8 74 >>
69 >> 2) // 0x3FFFFFFE 75 1) // 0x7FFFFFF8
70 ^ 0x40000000) // 0x7FFFFFFE 76 |
71 << 1)); 77 0x80000000) // 0xFFFFFFF8
78 >>
79 2) // 0x3FFFFFFE
80 ^
81 0x40000000) // 0x7FFFFFFE
82 <<
83 1));
72 } 84 }
73 85
74 speculative() { 86 speculative() {
75 var a = id(0x80000000); 87 var a = id(0x80000000);
76 var b = id(0); 88 var b = id(0);
77 var c = id(1); 89 var c = id(1);
78 var d = id(0xFFFF0000); 90 var d = id(0xFFFF0000);
79 var e = id(0xFFFF); 91 var e = id(0xFFFF);
80 var f = id(0xFFFFFFFF); 92 var f = id(0xFFFFFFFF);
81 var g = id(0xF0000000); 93 var g = id(0xF0000000);
(...skipping 11 matching lines...) Expand all
93 Expect.equals(0x80000000, a & a); 105 Expect.equals(0x80000000, a & a);
94 Expect.equals(0x80000000, a & g); 106 Expect.equals(0x80000000, a & g);
95 Expect.equals(0x80000000, f & a); 107 Expect.equals(0x80000000, f & a);
96 Expect.equals(0x80000000, a ^ b); 108 Expect.equals(0x80000000, a ^ b);
97 Expect.equals(0xFFFFFFFF, a ^ h); 109 Expect.equals(0xFFFFFFFF, a ^ h);
98 Expect.equals(0xFFFFFFFF, h ^ a); 110 Expect.equals(0xFFFFFFFF, h ^ a);
99 Expect.equals(0xF0000000, j ^ a); 111 Expect.equals(0xF0000000, j ^ a);
100 Expect.equals(0x80000000, c << k); 112 Expect.equals(0x80000000, c << k);
101 Expect.equals(0xFFFFFFF0, m << l); 113 Expect.equals(0xFFFFFFF0, m << l);
102 Expect.equals(0x7FFFFFFF, f >> c); 114 Expect.equals(0x7FFFFFFF, f >> c);
103 Expect.equals(0xFFFFFFFC, 115 Expect.equals(
104 ((((((m << 4) // 0xFFFFFFF0 116 0xFFFFFFFC,
105 >> 1) // 0x7FFFFFF8 117 ((((((m << 4) // 0xFFFFFFF0
106 | 0x80000000) // 0xFFFFFFF8 118 >>
107 >> 2) // 0x3FFFFFFE 119 1) // 0x7FFFFFF8
108 ^ 0x40000000) // 0x7FFFFFFE 120 |
109 << 1)); 121 0x80000000) // 0xFFFFFFF8
122 >>
123 2) // 0x3FFFFFFE
124 ^
125 0x40000000) // 0x7FFFFFFE
126 <<
127 1));
110 } 128 }
111 } 129 }
112 130
113 // Due to bad precedence rules this example was broken in Dart2Js. 131 // Due to bad precedence rules this example was broken in Dart2Js.
114 precedence() { 132 precedence() {
115 Expect.equals(0x80000000, -1 & 0x80000000); 133 Expect.equals(0x80000000, -1 & 0x80000000);
116 Expect.equals(0x80000000, id(-1) & 0x80000000); 134 Expect.equals(0x80000000, id(-1) & 0x80000000);
117 Expect.equals(0x80000000, ~(~(0x80000000))); 135 Expect.equals(0x80000000, ~(~(0x80000000)));
118 Expect.equals(0x80000000, ~(~(id(0x80000000)))); 136 Expect.equals(0x80000000, ~(~(id(0x80000000))));
119 } 137 }
120 138
121 main() { 139 main() {
122 constants(); 140 constants();
123 interceptors(); 141 interceptors();
124 speculative(); 142 speculative();
125 precedence(); 143 precedence();
126 } 144 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698