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

Side by Side Diff: test/cctest/compiler/test-operator.cc

Issue 877753007: Reland "Initial switch to Chromium-style CHECK_* and DCHECK_* macros.". (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: VS201x now happy? Created 5 years, 10 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <sstream> 5 #include <sstream>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/compiler/operator.h" 9 #include "src/compiler/operator.h"
10 #include "test/cctest/cctest.h" 10 #include "test/cctest/cctest.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 std::ostringstream os; 73 std::ostringstream os;
74 os << *op; 74 os << *op;
75 return SmartArrayPointer<const char>(StrDup(os.str().c_str())); 75 return SmartArrayPointer<const char>(StrDup(os.str().c_str()));
76 } 76 }
77 77
78 78
79 TEST(TestOperator_Print) { 79 TEST(TestOperator_Print) {
80 Operator op1a(19, NONE, "Another1", 0, 0, 0, 0, 0, 0); 80 Operator op1a(19, NONE, "Another1", 0, 0, 0, 0, 0, 0);
81 Operator op1b(19, FOLD, "Another2", 2, 0, 0, 2, 0, 0); 81 Operator op1b(19, FOLD, "Another2", 2, 0, 0, 2, 0, 0);
82 82
83 CHECK_EQ("Another1", OperatorToString(&op1a).get()); 83 CHECK_EQ(0, strcmp("Another1", OperatorToString(&op1a).get()));
84 CHECK_EQ("Another2", OperatorToString(&op1b).get()); 84 CHECK_EQ(0, strcmp("Another2", OperatorToString(&op1b).get()));
85 85
86 Operator op2a(20, NONE, "Flog1", 0, 0, 0, 0, 0, 0); 86 Operator op2a(20, NONE, "Flog1", 0, 0, 0, 0, 0, 0);
87 Operator op2b(20, FOLD, "Flog2", 1, 0, 0, 1, 0, 0); 87 Operator op2b(20, FOLD, "Flog2", 1, 0, 0, 1, 0, 0);
88 88
89 CHECK_EQ("Flog1", OperatorToString(&op2a).get()); 89 CHECK_EQ(0, strcmp("Flog1", OperatorToString(&op2a).get()));
90 CHECK_EQ("Flog2", OperatorToString(&op2b).get()); 90 CHECK_EQ(0, strcmp("Flog2", OperatorToString(&op2b).get()));
91 } 91 }
92 92
93 93
94 TEST(TestOperator1int_Hash) { 94 TEST(TestOperator1int_Hash) {
95 Operator1<int> op1a(23, NONE, "Wolfie", 0, 0, 0, 0, 0, 0, 11); 95 Operator1<int> op1a(23, NONE, "Wolfie", 0, 0, 0, 0, 0, 0, 11);
96 Operator1<int> op1b(23, FOLD, "Doggie", 2, 0, 0, 2, 0, 0, 11); 96 Operator1<int> op1b(23, FOLD, "Doggie", 2, 0, 0, 2, 0, 0, 11);
97 97
98 CHECK(op1a.HashCode() == op1b.HashCode()); 98 CHECK(op1a.HashCode() == op1b.HashCode());
99 99
100 Operator1<int> op2a(24, NONE, "Arfie", 0, 0, 0, 0, 0, 0, 3); 100 Operator1<int> op2a(24, NONE, "Arfie", 0, 0, 0, 0, 0, 0, 3);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 CHECK(!op3.Equals(&op1a)); 142 CHECK(!op3.Equals(&op1a));
143 CHECK(!op3.Equals(&op1b)); 143 CHECK(!op3.Equals(&op1b));
144 CHECK(!op3.Equals(&op2a)); 144 CHECK(!op3.Equals(&op2a));
145 CHECK(!op3.Equals(&op2b)); 145 CHECK(!op3.Equals(&op2b));
146 } 146 }
147 147
148 148
149 TEST(TestOperator1int_Print) { 149 TEST(TestOperator1int_Print) {
150 Operator1<int> op1(12, NONE, "Op1Test", 0, 0, 0, 1, 0, 0, 0); 150 Operator1<int> op1(12, NONE, "Op1Test", 0, 0, 0, 1, 0, 0, 0);
151 CHECK_EQ("Op1Test[0]", OperatorToString(&op1).get()); 151 CHECK_EQ(0, strcmp("Op1Test[0]", OperatorToString(&op1).get()));
152 152
153 Operator1<int> op2(12, NONE, "Op1Test", 0, 0, 0, 1, 0, 0, 66666666); 153 Operator1<int> op2(12, NONE, "Op1Test", 0, 0, 0, 1, 0, 0, 66666666);
154 CHECK_EQ("Op1Test[66666666]", OperatorToString(&op2).get()); 154 CHECK_EQ(0, strcmp("Op1Test[66666666]", OperatorToString(&op2).get()));
155 155
156 Operator1<int> op3(12, NONE, "FooBar", 0, 0, 0, 1, 0, 0, 2347); 156 Operator1<int> op3(12, NONE, "FooBar", 0, 0, 0, 1, 0, 0, 2347);
157 CHECK_EQ("FooBar[2347]", OperatorToString(&op3).get()); 157 CHECK_EQ(0, strcmp("FooBar[2347]", OperatorToString(&op3).get()));
158 158
159 Operator1<int> op4(12, NONE, "BarFoo", 0, 0, 0, 1, 0, 0, -879); 159 Operator1<int> op4(12, NONE, "BarFoo", 0, 0, 0, 1, 0, 0, -879);
160 CHECK_EQ("BarFoo[-879]", OperatorToString(&op4).get()); 160 CHECK_EQ(0, strcmp("BarFoo[-879]", OperatorToString(&op4).get()));
161 } 161 }
162 162
163 163
164 TEST(TestOperator1double_Hash) { 164 TEST(TestOperator1double_Hash) {
165 Operator1<double> op1a(23, NONE, "Wolfie", 0, 0, 0, 0, 0, 0, 11.77); 165 Operator1<double> op1a(23, NONE, "Wolfie", 0, 0, 0, 0, 0, 0, 11.77);
166 Operator1<double> op1b(23, FOLD, "Doggie", 2, 0, 0, 2, 0, 0, 11.77); 166 Operator1<double> op1b(23, FOLD, "Doggie", 2, 0, 0, 2, 0, 0, 11.77);
167 167
168 CHECK(op1a.HashCode() == op1b.HashCode()); 168 CHECK(op1a.HashCode() == op1b.HashCode());
169 169
170 Operator1<double> op2a(24, NONE, "Arfie", 0, 0, 0, 0, 0, 0, -6.7); 170 Operator1<double> op2a(24, NONE, "Arfie", 0, 0, 0, 0, 0, 0, -6.7);
171 Operator1<double> op2b(24, NONE, "Arfie", 0, 0, 0, 0, 0, 0, -6.8); 171 Operator1<double> op2b(24, NONE, "Arfie", 0, 0, 0, 0, 0, 0, -6.8);
172 172
173 CHECK(op1a.HashCode() != op2a.HashCode()); 173 CHECK(op1a.HashCode() != op2a.HashCode());
174 CHECK(op2a.HashCode() != op2b.HashCode()); 174 CHECK(op2a.HashCode() != op2b.HashCode());
175 } 175 }
176 176
177 177
178 TEST(TestOperator1doublePrint) { 178 TEST(TestOperator1doublePrint) {
179 Operator1<double> op1a(23, NONE, "Canary", 0, 0, 0, 0, 0, 0, 0.5); 179 Operator1<double> op1a(23, NONE, "Canary", 0, 0, 0, 0, 0, 0, 0.5);
180 Operator1<double> op1b(23, FOLD, "Finch", 2, 0, 0, 2, 0, 0, -1.5); 180 Operator1<double> op1b(23, FOLD, "Finch", 2, 0, 0, 2, 0, 0, -1.5);
181 181
182 CHECK_EQ("Canary[0.5]", OperatorToString(&op1a).get()); 182 CHECK_EQ(0, strcmp("Canary[0.5]", OperatorToString(&op1a).get()));
183 CHECK_EQ("Finch[-1.5]", OperatorToString(&op1b).get()); 183 CHECK_EQ(0, strcmp("Finch[-1.5]", OperatorToString(&op1b).get()));
184 } 184 }
185 185
186 186
187 TEST(TestOperator1double_Equals) { 187 TEST(TestOperator1double_Equals) {
188 Operator1<double> op1a(23, NONE, "Scratchy", 0, 0, 0, 0, 0, 0, 11.77); 188 Operator1<double> op1a(23, NONE, "Scratchy", 0, 0, 0, 0, 0, 0, 11.77);
189 Operator1<double> op1b(23, FOLD, "Scratchy", 2, 0, 0, 2, 0, 0, 11.77); 189 Operator1<double> op1b(23, FOLD, "Scratchy", 2, 0, 0, 2, 0, 0, 11.77);
190 190
191 CHECK(op1a.Equals(&op1a)); 191 CHECK(op1a.Equals(&op1a));
192 CHECK(op1a.Equals(&op1b)); 192 CHECK(op1a.Equals(&op1b));
193 CHECK(op1b.Equals(&op1a)); 193 CHECK(op1b.Equals(&op1a));
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 TEST(Operator_CountsOrder) { 274 TEST(Operator_CountsOrder) {
275 Operator op(29, NONE, "Flashy", 11, 22, 33, 44, 55, 66); 275 Operator op(29, NONE, "Flashy", 11, 22, 33, 44, 55, 66);
276 CHECK_EQ(11, op.ValueInputCount()); 276 CHECK_EQ(11, op.ValueInputCount());
277 CHECK_EQ(22, op.EffectInputCount()); 277 CHECK_EQ(22, op.EffectInputCount());
278 CHECK_EQ(33, op.ControlInputCount()); 278 CHECK_EQ(33, op.ControlInputCount());
279 279
280 CHECK_EQ(44, op.ValueOutputCount()); 280 CHECK_EQ(44, op.ValueOutputCount());
281 CHECK_EQ(55, op.EffectOutputCount()); 281 CHECK_EQ(55, op.EffectOutputCount());
282 CHECK_EQ(66, op.ControlOutputCount()); 282 CHECK_EQ(66, op.ControlOutputCount());
283 } 283 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-node-cache.cc ('k') | test/cctest/compiler/test-representation-change.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698