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

Side by Side Diff: test/codegen/expect/language/bit_operations_test_none_multi.js

Issue 2128353002: Check in codegen test expectations. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 5 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
(Empty)
1 dart_library.library('language/bit_operations_test_none_multi', null, /* Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__bit_operations_test_none_multi(exports, dart_sdk, expect) {
5 'use strict';
6 const core = dart_sdk.core;
7 const dart = dart_sdk.dart;
8 const dartx = dart_sdk.dartx;
9 const expect$ = expect.expect;
10 const bit_operations_test_none_multi = Object.create(null);
11 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da rt.void, [])))();
12 let dynamicAnddynamicTobool = () => (dynamicAnddynamicTobool = dart.constFn(da rt.definiteFunctionType(core.bool, [dart.dynamic, dart.dynamic])))();
13 let intAndintToint = () => (intAndintToint = dart.constFn(dart.definiteFunctio nType(core.int, [core.int, core.int])))();
14 let intAndintAndint__Tovoid = () => (intAndintAndint__Tovoid = dart.constFn(da rt.definiteFunctionType(dart.void, [core.int, core.int, core.int, core.int])))() ;
15 bit_operations_test_none_multi.main = function() {
16 for (let i = 0; i < 4; i++) {
17 bit_operations_test_none_multi.test();
18 }
19 };
20 dart.fn(bit_operations_test_none_multi.main, VoidTovoid());
21 bit_operations_test_none_multi.test = function() {
22 expect$.Expect.equals(3, 3 & 7);
23 expect$.Expect.equals(7, 3 | 7);
24 expect$.Expect.equals(4, 3 ^ 7);
25 expect$.Expect.equals(25, 100 >> 2);
26 expect$.Expect.equals(400, 100 << 2);
27 expect$.Expect.equals(-25, (-100)[dartx['>>']](2));
28 expect$.Expect.equals(-101, ~100 >>> 0);
29 expect$.Expect.equals(18446744073709551616, (1)[dartx['<<']](64));
30 expect$.Expect.equals(-18446744073709551616, (-1)[dartx['<<']](64));
31 expect$.Expect.equals(1073741824, 67108864 << 4);
32 expect$.Expect.equals(4611686018427387904, 288230376151711744 << 4 >>> 0);
33 expect$.Expect.equals(0, ~-1 >>> 0);
34 expect$.Expect.equals(-1, ~0 >>> 0);
35 expect$.Expect.equals(0, (1)[dartx['>>']](160));
36 expect$.Expect.equals(-1, (-1)[dartx['>>']](160));
37 expect$.Expect.equals(295147905179352825857, (295147905179352825857 & 295147 922835963379713) >>> 0);
38 expect$.Expect.equals(1, 1 & 295147922835963379713);
39 expect$.Expect.equals(1, 295147922835963379713 & 1);
40 expect$.Expect.equals(295147922835963379713, (295147905179352825857 | 295147 922835963379713) >>> 0);
41 expect$.Expect.equals(295147922835963379729, (17 | 295147922835963379713) >> > 0);
42 expect$.Expect.equals(295147922835963379729, (295147922835963379713 | 17) >> > 0);
43 expect$.Expect.equals(70836578106955247124480, (4428299441600861306881 ^ 752 62715820734970593281) >>> 0);
44 expect$.Expect.equals(49, (4428299441600861306881 ^ 4428299441600861306928) >>> 0);
45 expect$.Expect.equals(4428299441600861306929, (4428299441600861306881 ^ 48) >>> 0);
46 expect$.Expect.equals(4428299441600861306929, (48 ^ 4428299441600861306881) >>> 0);
47 expect$.Expect.equals(4427218577690292387855, 70835497243044678205687 >>> 4) ;
48 expect$.Expect.equals(15, (64424509440)[dartx['>>']](32));
49 expect$.Expect.equals(1030792151040, 16492674416655 >>> 4);
50 expect$.Expect.equals(70835497243044678205680, 4427218577690292387855 << 4 > >> 0);
51 expect$.Expect.equals(64424509440, (15)[dartx['<<']](32));
52 bit_operations_test_none_multi.testNegativeValueShifts();
53 bit_operations_test_none_multi.testPositiveValueShifts();
54 bit_operations_test_none_multi.testNoMaskingOfShiftCount();
55 bit_operations_test_none_multi.testNegativeCountShifts();
56 for (let i = 0; i < 20; i++) {
57 bit_operations_test_none_multi.testCornerCasesRightShifts();
58 bit_operations_test_none_multi.testRightShift64Bit();
59 bit_operations_test_none_multi.testLeftShift64Bit();
60 bit_operations_test_none_multi.testLeftShift64BitWithOverflow1();
61 bit_operations_test_none_multi.testLeftShift64BitWithOverflow2();
62 bit_operations_test_none_multi.testLeftShift64BitWithOverflow3();
63 }
64 bit_operations_test_none_multi.testPrecedence(4, 5, 3, 1);
65 bit_operations_test_none_multi.testPrecedence(3, 4, 5, 9);
66 bit_operations_test_none_multi.testPrecedence(23665, 27538, 30292, 32040);
67 };
68 dart.fn(bit_operations_test_none_multi.test, VoidTovoid());
69 bit_operations_test_none_multi.testCornerCasesRightShifts = function() {
70 let v32 = 4278190080;
71 let v64 = 18374686479671623680;
72 expect$.Expect.equals(3, v32[dartx['>>']](30));
73 expect$.Expect.equals(1, v32[dartx['>>']](31));
74 expect$.Expect.equals(0, v32[dartx['>>']](32));
75 expect$.Expect.equals(3, v64[dartx['>>']](62));
76 expect$.Expect.equals(1, v64[dartx['>>']](63));
77 expect$.Expect.equals(0, v64[dartx['>>']](64));
78 };
79 dart.fn(bit_operations_test_none_multi.testCornerCasesRightShifts, VoidTovoid( ));
80 bit_operations_test_none_multi.testRightShift64Bit = function() {
81 let t = 8589934591;
82 expect$.Expect.equals(4294967295, t[dartx['>>']](1));
83 };
84 dart.fn(bit_operations_test_none_multi.testRightShift64Bit, VoidTovoid());
85 bit_operations_test_none_multi.testLeftShift64Bit = function() {
86 let t = 4294967295;
87 expect$.Expect.equals(4294967295, t << 0 >>> 0);
88 expect$.Expect.equals(8589934590, t << 1 >>> 0);
89 expect$.Expect.equals(9223372034707292160, t << 31 >>> 0);
90 expect$.Expect.equals(9223372036854775808, t + 1 << 31 >>> 0);
91 };
92 dart.fn(bit_operations_test_none_multi.testLeftShift64Bit, VoidTovoid());
93 bit_operations_test_none_multi.testLeftShift64BitWithOverflow1 = function() {
94 let t = 4294967295;
95 };
96 dart.fn(bit_operations_test_none_multi.testLeftShift64BitWithOverflow1, VoidTo void());
97 bit_operations_test_none_multi.testLeftShift64BitWithOverflow2 = function() {
98 let t = 4294967295;
99 };
100 dart.fn(bit_operations_test_none_multi.testLeftShift64BitWithOverflow2, VoidTo void());
101 bit_operations_test_none_multi.testLeftShift64BitWithOverflow3 = function() {
102 let t = 4294967295;
103 expect$.Expect.equals(9223372036854775808, t + 1 << 31 >>> 0);
104 };
105 dart.fn(bit_operations_test_none_multi.testLeftShift64BitWithOverflow3, VoidTo void());
106 bit_operations_test_none_multi.testNegativeCountShifts = function() {
107 function throwOnLeft(a, b) {
108 try {
109 let x = dart.dsend(a, '<<', b);
110 return false;
111 } catch (e) {
112 return true;
113 }
114
115 }
116 dart.fn(throwOnLeft, dynamicAnddynamicTobool());
117 function throwOnRight(a, b) {
118 try {
119 let x = dart.dsend(a, '>>', b);
120 return false;
121 } catch (e) {
122 return true;
123 }
124
125 }
126 dart.fn(throwOnRight, dynamicAnddynamicTobool());
127 expect$.Expect.isTrue(throwOnLeft(12, -3));
128 expect$.Expect.isTrue(throwOnRight(12, -3));
129 for (let i = 0; i < 20; i++) {
130 expect$.Expect.isFalse(throwOnLeft(12, 3));
131 expect$.Expect.isFalse(throwOnRight(12, 3));
132 }
133 };
134 dart.fn(bit_operations_test_none_multi.testNegativeCountShifts, VoidTovoid());
135 bit_operations_test_none_multi.testNegativeValueShifts = function() {
136 for (let value = 0; value > -100; value--) {
137 for (let i = 0; i < 300; i++) {
138 let b = value[dartx['<<']](i)[dartx['>>']](i);
139 expect$.Expect.equals(value, b);
140 }
141 }
142 };
143 dart.fn(bit_operations_test_none_multi.testNegativeValueShifts, VoidTovoid());
144 bit_operations_test_none_multi.testPositiveValueShifts = function() {
145 for (let value = 0; value < 100; value++) {
146 for (let i = 0; i < 300; i++) {
147 let b = value[dartx['<<']](i)[dartx['>>']](i);
148 expect$.Expect.equals(value, b);
149 }
150 }
151 };
152 dart.fn(bit_operations_test_none_multi.testPositiveValueShifts, VoidTovoid());
153 bit_operations_test_none_multi.testNoMaskingOfShiftCount = function() {
154 expect$.Expect.equals(0, (0)[dartx['>>']](256));
155 expect$.Expect.equals(0, (1)[dartx['>>']](256));
156 expect$.Expect.equals(0, (2)[dartx['>>']](256));
157 expect$.Expect.equals(0, bit_operations_test_none_multi.shiftRight(0, 256));
158 expect$.Expect.equals(0, bit_operations_test_none_multi.shiftRight(1, 256));
159 expect$.Expect.equals(0, bit_operations_test_none_multi.shiftRight(2, 256));
160 for (let shift = 1; shift <= 256; shift++) {
161 expect$.Expect.equals(0, bit_operations_test_none_multi.shiftRight(1, shif t));
162 expect$.Expect.equals(-1, bit_operations_test_none_multi.shiftRight(-1, sh ift));
163 expect$.Expect.equals(true, dart.notNull(bit_operations_test_none_multi.sh iftLeft(1, shift)) > dart.notNull(bit_operations_test_none_multi.shiftLeft(1, sh ift - 1)));
164 }
165 };
166 dart.fn(bit_operations_test_none_multi.testNoMaskingOfShiftCount, VoidTovoid() );
167 bit_operations_test_none_multi.shiftLeft = function(a, b) {
168 return a[dartx['<<']](b);
169 };
170 dart.fn(bit_operations_test_none_multi.shiftLeft, intAndintToint());
171 bit_operations_test_none_multi.shiftRight = function(a, b) {
172 return a[dartx['>>']](b);
173 };
174 dart.fn(bit_operations_test_none_multi.shiftRight, intAndintToint());
175 bit_operations_test_none_multi.testPrecedence = function(a, b, c, d) {
176 let result = (dart.notNull(a) & dart.notNull(b) ^ dart.notNull(c) | dart.not Null(d) & dart.notNull(b) ^ dart.notNull(c)) >>> 0;
177 expect$.Expect.equals((dart.notNull(a) & dart.notNull(b) ^ dart.notNull(c) | dart.notNull(d) & dart.notNull(b) ^ dart.notNull(c)) >>> 0, result);
178 expect$.Expect.notEquals((dart.notNull(a) & (dart.notNull(b) ^ dart.notNull( c)) | dart.notNull(d) & (dart.notNull(b) ^ dart.notNull(c))) >>> 0, result);
179 expect$.Expect.notEquals((dart.notNull(a) & dart.notNull(b) ^ (dart.notNull( c) | dart.notNull(d) & dart.notNull(b)) ^ dart.notNull(c)) >>> 0, result);
180 expect$.Expect.notEquals((dart.notNull(a) & dart.notNull(b) ^ (dart.notNull( c) | dart.notNull(d)) & dart.notNull(b) ^ dart.notNull(c)) >>> 0, result);
181 expect$.Expect.notEquals((dart.notNull(a) & (dart.notNull(b) ^ (dart.notNull (c) | dart.notNull(d))) & (dart.notNull(b) ^ dart.notNull(c))) >>> 0, result);
182 expect$.Expect.notEquals((dart.notNull(a) & (dart.notNull(b) ^ dart.notNull( c) | dart.notNull(d)) & (dart.notNull(b) ^ dart.notNull(c))) >>> 0, result);
183 expect$.Expect.equals((dart.notNull(a) & dart.notNull(b)) >>> 0 < (dart.notN ull(c) & dart.notNull(d)) >>> 0, (dart.notNull(a) & dart.notNull(b)) >>> 0 < (da rt.notNull(c) & dart.notNull(d)) >>> 0);
184 expect$.Expect.equals((dart.notNull(a) & b[dartx['<<']](c) ^ dart.notNull(d) ) >>> 0, (dart.notNull(a) & b[dartx['<<']](c) ^ dart.notNull(d)) >>> 0);
185 expect$.Expect.notEquals(((dart.notNull(a) & dart.notNull(b)) >>> 0)[dartx[' <<']]((dart.notNull(c) ^ dart.notNull(d)) >>> 0), (dart.notNull(a) & b[dartx['<< ']](c) ^ dart.notNull(d)) >>> 0);
186 };
187 dart.fn(bit_operations_test_none_multi.testPrecedence, intAndintAndint__Tovoid ());
188 // Exports:
189 exports.bit_operations_test_none_multi = bit_operations_test_none_multi;
190 });
OLDNEW
« no previous file with comments | « test/codegen/expect/language/bit_operations_test_04_multi.js ('k') | test/codegen/expect/language/bit_shift_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698