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

Side by Side Diff: test/codegen/expect/language/bool_test.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/bool_test', null, /* Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__bool_test(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 bool_test = Object.create(null);
11 let dynamicAnddynamicAnddynamicTodynamic = () => (dynamicAnddynamicAnddynamicT odynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, d art.dynamic, dart.dynamic])))();
12 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
13 bool_test.BoolTest = class BoolTest extends core.Object {
14 static testEquality() {
15 expect$.Expect.equals(true, true);
16 expect$.Expect.equals(false, false);
17 expect$.Expect.isTrue(core.identical(true, true));
18 expect$.Expect.isFalse(core.identical(true, false));
19 expect$.Expect.isTrue(core.identical(false, false));
20 expect$.Expect.isFalse(core.identical(false, true));
21 expect$.Expect.isFalse(!core.identical(true, true));
22 expect$.Expect.isTrue(!core.identical(true, false));
23 expect$.Expect.isFalse(!core.identical(false, false));
24 expect$.Expect.isTrue(!core.identical(false, true));
25 expect$.Expect.isTrue(true == true);
26 expect$.Expect.isFalse(true == false);
27 expect$.Expect.isTrue(false == false);
28 expect$.Expect.isFalse(false == true);
29 expect$.Expect.isFalse(true != true);
30 expect$.Expect.isTrue(true != false);
31 expect$.Expect.isFalse(false != false);
32 expect$.Expect.isTrue(false != true);
33 expect$.Expect.isTrue(core.identical(true, true == true));
34 expect$.Expect.isTrue(core.identical(false, true == false));
35 expect$.Expect.isTrue(core.identical(true, false == false));
36 expect$.Expect.isTrue(core.identical(false, false == true));
37 expect$.Expect.isFalse(!core.identical(true, true == true));
38 expect$.Expect.isFalse(!core.identical(false, true == false));
39 expect$.Expect.isFalse(!core.identical(true, false == false));
40 expect$.Expect.isFalse(!core.identical(false, false == true));
41 expect$.Expect.isFalse(core.identical(false, true == true));
42 expect$.Expect.isFalse(core.identical(true, true == false));
43 expect$.Expect.isFalse(core.identical(false, false == false));
44 expect$.Expect.isFalse(core.identical(true, false == true));
45 expect$.Expect.isTrue(!core.identical(false, true == true));
46 expect$.Expect.isTrue(!core.identical(true, true == false));
47 expect$.Expect.isTrue(!core.identical(false, false == false));
48 expect$.Expect.isTrue(!core.identical(true, false == true));
49 if (true == false) {
50 dart.throw("Expect.equals broken");
51 }
52 if (false == true) {
53 dart.throw("Expect.equals broken");
54 }
55 if (core.identical(true, false)) {
56 dart.throw("Expect.equals broken");
57 }
58 if (core.identical(false, true)) {
59 dart.throw("Expect.equals broken");
60 }
61 if (true == true) {
62 } else {
63 dart.throw("Expect.equals broken");
64 }
65 if (false == false) {
66 } else {
67 dart.throw("Expect.equals broken");
68 }
69 if (core.identical(true, true)) {
70 } else {
71 dart.throw("Expect.equals broken");
72 }
73 if (core.identical(false, false)) {
74 } else {
75 dart.throw("Expect.equals broken");
76 }
77 if (true != false) {
78 } else {
79 dart.throw("Expect.equals broken");
80 }
81 if (false != true) {
82 } else {
83 dart.throw("Expect.equals broken");
84 }
85 if (!core.identical(true, false)) {
86 } else {
87 dart.throw("Expect.equals broken");
88 }
89 if (!core.identical(false, true)) {
90 } else {
91 dart.throw("Expect.equals broken");
92 }
93 if (true != true) {
94 dart.throw("Expect.equals broken");
95 }
96 if (false != false) {
97 dart.throw("Expect.equals broken");
98 }
99 if (!core.identical(true, true)) {
100 dart.throw("Expect.equals broken");
101 }
102 if (!core.identical(false, false)) {
103 dart.throw("Expect.equals broken");
104 }
105 }
106 static testToString() {
107 expect$.Expect.equals("true", dart.toString(true));
108 expect$.Expect.equals("false", dart.toString(false));
109 }
110 static testNegate(isTrue, isFalse) {
111 expect$.Expect.equals(true, !false);
112 expect$.Expect.equals(false, !true);
113 expect$.Expect.equals(true, !dart.test(isFalse));
114 expect$.Expect.equals(false, !dart.test(isTrue));
115 }
116 static testLogicalOp() {
117 function testOr(a, b, onTypeError) {
118 try {
119 return dart.test(a) || dart.test(b);
120 } catch (t) {
121 if (core.TypeError.is(t)) {
122 return onTypeError;
123 } else
124 throw t;
125 }
126
127 }
128 dart.fn(testOr, dynamicAnddynamicAnddynamicTodynamic());
129 function testAnd(a, b, onTypeError) {
130 try {
131 return dart.test(a) && dart.test(b);
132 } catch (t) {
133 if (core.TypeError.is(t)) {
134 return onTypeError;
135 } else
136 throw t;
137 }
138
139 }
140 dart.fn(testAnd, dynamicAnddynamicAnddynamicTodynamic());
141 let isTrue = true;
142 let isFalse = false;
143 expect$.Expect.equals(true, testAnd(isTrue, isTrue, false));
144 expect$.Expect.equals(false, testAnd(isTrue, 0, false));
145 expect$.Expect.equals(false, testAnd(isTrue, 1, false));
146 expect$.Expect.equals(false, testAnd(isTrue, "true", false));
147 expect$.Expect.equals(false, testAnd(0, isTrue, false));
148 expect$.Expect.equals(false, testAnd(1, isTrue, false));
149 expect$.Expect.equals(true, testOr(isTrue, isTrue, false));
150 expect$.Expect.equals(true, testOr(isFalse, isTrue, false));
151 expect$.Expect.equals(true, testOr(isTrue, isFalse, false));
152 expect$.Expect.equals(true, testOr(isTrue, 0, true));
153 expect$.Expect.equals(true, testOr(isTrue, 1, true));
154 expect$.Expect.equals(false, testOr(isFalse, 0, false));
155 expect$.Expect.equals(false, testOr(isFalse, 1, false));
156 expect$.Expect.equals(true, testOr(0, isTrue, true));
157 expect$.Expect.equals(true, testOr(1, isTrue, true));
158 expect$.Expect.equals(false, testOr(0, isFalse, false));
159 expect$.Expect.equals(false, testOr(1, isFalse, false));
160 let trueCount = 0, falseCount = 0;
161 function trueFunc() {
162 trueCount = dart.notNull(trueCount) + 1;
163 return true;
164 }
165 dart.fn(trueFunc, VoidTodynamic());
166 function falseFunc() {
167 falseCount++;
168 return false;
169 }
170 dart.fn(falseFunc, VoidTodynamic());
171 expect$.Expect.equals(0, trueCount);
172 expect$.Expect.equals(0, falseCount);
173 dart.test(trueFunc()) && dart.test(trueFunc());
174 expect$.Expect.equals(2, trueCount);
175 expect$.Expect.equals(0, falseCount);
176 trueCount = falseCount = 0;
177 dart.test(falseFunc()) && dart.test(trueFunc());
178 expect$.Expect.equals(0, trueCount);
179 expect$.Expect.equals(1, falseCount);
180 trueCount = falseCount = 0;
181 dart.test(trueFunc()) && dart.test(falseFunc());
182 expect$.Expect.equals(1, trueCount);
183 expect$.Expect.equals(1, falseCount);
184 trueCount = falseCount = 0;
185 dart.test(falseFunc()) && dart.test(falseFunc());
186 expect$.Expect.equals(0, trueCount);
187 expect$.Expect.equals(1, falseCount);
188 trueCount = falseCount = 0;
189 dart.test(trueFunc()) || dart.test(trueFunc());
190 expect$.Expect.equals(1, trueCount);
191 expect$.Expect.equals(0, falseCount);
192 trueCount = falseCount = 0;
193 dart.test(falseFunc()) || dart.test(trueFunc());
194 expect$.Expect.equals(1, trueCount);
195 expect$.Expect.equals(1, falseCount);
196 trueCount = falseCount = 0;
197 dart.test(trueFunc()) || dart.test(falseFunc());
198 expect$.Expect.equals(1, trueCount);
199 expect$.Expect.equals(0, falseCount);
200 trueCount = falseCount = 0;
201 dart.test(falseFunc()) || dart.test(falseFunc());
202 expect$.Expect.equals(0, trueCount);
203 expect$.Expect.equals(2, falseCount);
204 }
205 static testMain() {
206 bool_test.BoolTest.testEquality();
207 bool_test.BoolTest.testNegate(true, false);
208 bool_test.BoolTest.testToString();
209 bool_test.BoolTest.testLogicalOp();
210 }
211 };
212 dart.setSignature(bool_test.BoolTest, {
213 statics: () => ({
214 testEquality: dart.definiteFunctionType(dart.void, []),
215 testToString: dart.definiteFunctionType(dart.void, []),
216 testNegate: dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynam ic]),
217 testLogicalOp: dart.definiteFunctionType(dart.void, []),
218 testMain: dart.definiteFunctionType(dart.void, [])
219 }),
220 names: ['testEquality', 'testToString', 'testNegate', 'testLogicalOp', 'test Main']
221 });
222 bool_test.main = function() {
223 bool_test.BoolTest.testMain();
224 };
225 dart.fn(bool_test.main, VoidTodynamic());
226 // Exports:
227 exports.bool_test = bool_test;
228 });
OLDNEW
« no previous file with comments | « test/codegen/expect/language/bool_condition_check_test_none_multi.js ('k') | test/codegen/expect/language/bootstrap_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698