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

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

Issue 2765693002: Update all tests (Closed)
Patch Set: Created 3 years, 9 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 for testing bitwise operations. 4 // Dart test for testing bitwise operations.
5 // VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-co mpilation 5 // VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-co mpilation
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 8
9 void main() { 9 void main() {
10 for (int i = 0; i < 4; i++) { 10 for (int i = 0; i < 4; i++) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 void testRightShift64Bit() { 86 void testRightShift64Bit() {
87 var t = 0x1ffffffff; 87 var t = 0x1ffffffff;
88 Expect.equals(0xffffffff, t >> 1); 88 Expect.equals(0xffffffff, t >> 1);
89 } 89 }
90 90
91 void testLeftShift64Bit() { 91 void testLeftShift64Bit() {
92 var t = 0xffffffff; 92 var t = 0xffffffff;
93 Expect.equals(0xffffffff, t << 0); 93 Expect.equals(0xffffffff, t << 0);
94 Expect.equals(0x1fffffffe, t << 1); 94 Expect.equals(0x1fffffffe, t << 1);
95 Expect.equals(0x7fffffff80000000, t << 31); 95 Expect.equals(0x7fffffff80000000, t << 31);
96 Expect.equals(0x10000000000000000, 2*(t+1) << 31); /// 01: static type warning 96 Expect.equals(0x10000000000000000, 2*(t+1) << 31); //# 01: static type warning
97 Expect.equals(0x20000000000000000, 4*(t+1) << 31); /// 02: static type warning 97 Expect.equals(0x20000000000000000, 4*(t+1) << 31); //# 02: static type warning
98 Expect.equals(0x8000000000000000, (t+1) << 31); 98 Expect.equals(0x8000000000000000, (t+1) << 31);
99 } 99 }
100 100
101 void testLeftShift64BitWithOverflow1() { 101 void testLeftShift64BitWithOverflow1() {
102 var t = 0xffffffff; 102 var t = 0xffffffff;
103 Expect.equals(0x10000000000000000, 2*(t+1) << 31); /// 03: static type warning 103 Expect.equals(0x10000000000000000, 2*(t+1) << 31); //# 03: static type warning
104 } 104 }
105 105
106 void testLeftShift64BitWithOverflow2() { 106 void testLeftShift64BitWithOverflow2() {
107 var t = 0xffffffff; 107 var t = 0xffffffff;
108 Expect.equals(0x20000000000000000, 4*(t+1) << 31); /// 04: static type warning 108 Expect.equals(0x20000000000000000, 4*(t+1) << 31); //# 04: static type warning
109 } 109 }
110 110
111 void testLeftShift64BitWithOverflow3() { 111 void testLeftShift64BitWithOverflow3() {
112 var t = 0xffffffff; 112 var t = 0xffffffff;
113 Expect.equals(0x8000000000000000, (t+1) << 31); 113 Expect.equals(0x8000000000000000, (t+1) << 31);
114 } 114 }
115 115
116 void testNegativeCountShifts() { 116 void testNegativeCountShifts() {
117 bool throwOnLeft(a, b) { 117 bool throwOnLeft(a, b) {
118 try { 118 try {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 Expect.notEquals((a & b) ^ (c | (d & b)) ^ c, result); // &|^ 186 Expect.notEquals((a & b) ^ (c | (d & b)) ^ c, result); // &|^
187 Expect.notEquals((a & b) ^ ((c | d) & b) ^ c, result); // |&^ 187 Expect.notEquals((a & b) ^ ((c | d) & b) ^ c, result); // |&^
188 Expect.notEquals(a & (b ^ (c | d)) & (b ^ c), result); // |^& 188 Expect.notEquals(a & (b ^ (c | d)) & (b ^ c), result); // |^&
189 Expect.notEquals(a & ((b ^ c) | d) & (b ^ c), result); // ^|& 189 Expect.notEquals(a & ((b ^ c) | d) & (b ^ c), result); // ^|&
190 // Binds stronger than relational operators. 190 // Binds stronger than relational operators.
191 Expect.equals((a & b) < (c & d), a & b < c & d); 191 Expect.equals((a & b) < (c & d), a & b < c & d);
192 // Binds weaker than shift operators. 192 // Binds weaker than shift operators.
193 Expect.equals((a & (b << c)) ^ d, a & b << c ^ d); 193 Expect.equals((a & (b << c)) ^ d, a & b << c ^ d);
194 Expect.notEquals((a & b) << (c ^ d), a & b << c ^ d); 194 Expect.notEquals((a & b) << (c ^ d), a & b << c ^ d);
195 } 195 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698