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

Side by Side Diff: test/cctest/test-transitions.cc

Issue 1506753002: [test] Test expectations in cctest should use CHECK and not DCHECK. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « test/cctest/test-strings.cc ('k') | test/cctest/test-unboxed-doubles.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 // TODO(mythria): Remove this define after this flag is turned on globally 5 // TODO(mythria): Remove this define after this flag is turned on globally
6 #define V8_IMMINENT_DEPRECATION_WARNINGS 6 #define V8_IMMINENT_DEPRECATION_WARNINGS
7 7
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 CHECK_EQ(*map2, 80 CHECK_EQ(*map2,
81 TransitionArray::SearchTransition(*map0, kData, *name2, attributes)); 81 TransitionArray::SearchTransition(*map0, kData, *name2, attributes));
82 CHECK_EQ(2, TransitionArray::NumberOfTransitions(map0->raw_transitions())); 82 CHECK_EQ(2, TransitionArray::NumberOfTransitions(map0->raw_transitions()));
83 for (int i = 0; i < 2; i++) { 83 for (int i = 0; i < 2; i++) {
84 Name* key = TransitionArray::GetKey(map0->raw_transitions(), i); 84 Name* key = TransitionArray::GetKey(map0->raw_transitions(), i);
85 Map* target = TransitionArray::GetTarget(map0->raw_transitions(), i); 85 Map* target = TransitionArray::GetTarget(map0->raw_transitions(), i);
86 CHECK((key == *name1 && target == *map1) || 86 CHECK((key == *name1 && target == *map1) ||
87 (key == *name2 && target == *map2)); 87 (key == *name2 && target == *map2));
88 } 88 }
89 89
90 DCHECK(TransitionArray::IsSortedNoDuplicates(*map0)); 90 #ifdef DEBUG
91 CHECK(TransitionArray::IsSortedNoDuplicates(*map0));
92 #endif
91 } 93 }
92 94
93 95
94 TEST(TransitionArray_FullFieldTransitions) { 96 TEST(TransitionArray_FullFieldTransitions) {
95 CcTest::InitializeVM(); 97 CcTest::InitializeVM();
96 v8::HandleScope scope(CcTest::isolate()); 98 v8::HandleScope scope(CcTest::isolate());
97 Isolate* isolate = CcTest::i_isolate(); 99 Isolate* isolate = CcTest::i_isolate();
98 Factory* factory = isolate->factory(); 100 Factory* factory = isolate->factory();
99 101
100 Handle<String> name1 = factory->InternalizeUtf8String("foo"); 102 Handle<String> name1 = factory->InternalizeUtf8String("foo");
(...skipping 28 matching lines...) Expand all
129 CHECK_EQ(*map2, 131 CHECK_EQ(*map2,
130 TransitionArray::SearchTransition(*map0, kData, *name2, attributes)); 132 TransitionArray::SearchTransition(*map0, kData, *name2, attributes));
131 CHECK_EQ(2, TransitionArray::NumberOfTransitions(map0->raw_transitions())); 133 CHECK_EQ(2, TransitionArray::NumberOfTransitions(map0->raw_transitions()));
132 for (int i = 0; i < 2; i++) { 134 for (int i = 0; i < 2; i++) {
133 Name* key = TransitionArray::GetKey(map0->raw_transitions(), i); 135 Name* key = TransitionArray::GetKey(map0->raw_transitions(), i);
134 Map* target = TransitionArray::GetTarget(map0->raw_transitions(), i); 136 Map* target = TransitionArray::GetTarget(map0->raw_transitions(), i);
135 CHECK((key == *name1 && target == *map1) || 137 CHECK((key == *name1 && target == *map1) ||
136 (key == *name2 && target == *map2)); 138 (key == *name2 && target == *map2));
137 } 139 }
138 140
139 DCHECK(TransitionArray::IsSortedNoDuplicates(*map0)); 141 #ifdef DEBUG
142 CHECK(TransitionArray::IsSortedNoDuplicates(*map0));
143 #endif
140 } 144 }
141 145
142 146
143 TEST(TransitionArray_DifferentFieldNames) { 147 TEST(TransitionArray_DifferentFieldNames) {
144 CcTest::InitializeVM(); 148 CcTest::InitializeVM();
145 v8::HandleScope scope(CcTest::isolate()); 149 v8::HandleScope scope(CcTest::isolate());
146 Isolate* isolate = CcTest::i_isolate(); 150 Isolate* isolate = CcTest::i_isolate();
147 Factory* factory = isolate->factory(); 151 Factory* factory = isolate->factory();
148 152
149 const int PROPS_COUNT = 10; 153 const int PROPS_COUNT = 10;
(...skipping 26 matching lines...) Expand all
176 Name* key = TransitionArray::GetKey(map0->raw_transitions(), i); 180 Name* key = TransitionArray::GetKey(map0->raw_transitions(), i);
177 Map* target = TransitionArray::GetTarget(map0->raw_transitions(), i); 181 Map* target = TransitionArray::GetTarget(map0->raw_transitions(), i);
178 for (int j = 0; j < PROPS_COUNT; j++) { 182 for (int j = 0; j < PROPS_COUNT; j++) {
179 if (*names[i] == key) { 183 if (*names[i] == key) {
180 CHECK_EQ(*maps[i], target); 184 CHECK_EQ(*maps[i], target);
181 break; 185 break;
182 } 186 }
183 } 187 }
184 } 188 }
185 189
186 DCHECK(TransitionArray::IsSortedNoDuplicates(*map0)); 190 #ifdef DEBUG
191 CHECK(TransitionArray::IsSortedNoDuplicates(*map0));
192 #endif
187 } 193 }
188 194
189 195
190 TEST(TransitionArray_SameFieldNamesDifferentAttributesSimple) { 196 TEST(TransitionArray_SameFieldNamesDifferentAttributesSimple) {
191 CcTest::InitializeVM(); 197 CcTest::InitializeVM();
192 v8::HandleScope scope(CcTest::isolate()); 198 v8::HandleScope scope(CcTest::isolate());
193 Isolate* isolate = CcTest::i_isolate(); 199 Isolate* isolate = CcTest::i_isolate();
194 Factory* factory = isolate->factory(); 200 Factory* factory = isolate->factory();
195 201
196 Handle<Map> map0 = Map::Create(isolate, 0); 202 Handle<Map> map0 = Map::Create(isolate, 0);
(...skipping 20 matching lines...) Expand all
217 // Ensure that transitions for |name| field are valid. 223 // Ensure that transitions for |name| field are valid.
218 for (int i = 0; i < ATTRS_COUNT; i++) { 224 for (int i = 0; i < ATTRS_COUNT; i++) {
219 PropertyAttributes attributes = static_cast<PropertyAttributes>(i); 225 PropertyAttributes attributes = static_cast<PropertyAttributes>(i);
220 CHECK_EQ(*attr_maps[i], TransitionArray::SearchTransition( 226 CHECK_EQ(*attr_maps[i], TransitionArray::SearchTransition(
221 *map0, kData, *name, attributes)); 227 *map0, kData, *name, attributes));
222 // All transitions use the same key, so this check doesn't need to 228 // All transitions use the same key, so this check doesn't need to
223 // care about ordering. 229 // care about ordering.
224 CHECK_EQ(*name, TransitionArray::GetKey(map0->raw_transitions(), i)); 230 CHECK_EQ(*name, TransitionArray::GetKey(map0->raw_transitions(), i));
225 } 231 }
226 232
227 DCHECK(TransitionArray::IsSortedNoDuplicates(*map0)); 233 #ifdef DEBUG
234 CHECK(TransitionArray::IsSortedNoDuplicates(*map0));
235 #endif
228 } 236 }
229 237
230 238
231 TEST(TransitionArray_SameFieldNamesDifferentAttributes) { 239 TEST(TransitionArray_SameFieldNamesDifferentAttributes) {
232 CcTest::InitializeVM(); 240 CcTest::InitializeVM();
233 v8::HandleScope scope(CcTest::isolate()); 241 v8::HandleScope scope(CcTest::isolate());
234 Isolate* isolate = CcTest::i_isolate(); 242 Isolate* isolate = CcTest::i_isolate();
235 Factory* factory = isolate->factory(); 243 Factory* factory = isolate->factory();
236 244
237 const int PROPS_COUNT = 10; 245 const int PROPS_COUNT = 10;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } else { 303 } else {
296 for (int j = 0; j < PROPS_COUNT; j++) { 304 for (int j = 0; j < PROPS_COUNT; j++) {
297 if (*names[j] == key) { 305 if (*names[j] == key) {
298 CHECK_EQ(*maps[j], target); 306 CHECK_EQ(*maps[j], target);
299 break; 307 break;
300 } 308 }
301 } 309 }
302 } 310 }
303 } 311 }
304 312
305 DCHECK(TransitionArray::IsSortedNoDuplicates(*map0)); 313 #ifdef DEBUG
314 CHECK(TransitionArray::IsSortedNoDuplicates(*map0));
315 #endif
306 } 316 }
OLDNEW
« no previous file with comments | « test/cctest/test-strings.cc ('k') | test/cctest/test-unboxed-doubles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698