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

Side by Side Diff: client/simple_string_dictionary_test.cc

Issue 1287043005: DCHECK_IS_ON needs ()'s (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad.git@master
Patch Set: Fix all the places Created 5 years, 4 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
« no previous file with comments | « no previous file | util/misc/initialization_state_dcheck.h » ('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 Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // Running out of space shouldn't crash. 269 // Running out of space shouldn't crash.
270 TEST(SimpleStringDictionary, OutOfSpace) { 270 TEST(SimpleStringDictionary, OutOfSpace) {
271 TSimpleStringDictionary<3, 2, 2> map; 271 TSimpleStringDictionary<3, 2, 2> map;
272 map.SetKeyValue("a", "1"); 272 map.SetKeyValue("a", "1");
273 map.SetKeyValue("b", "2"); 273 map.SetKeyValue("b", "2");
274 map.SetKeyValue("c", "3"); 274 map.SetKeyValue("c", "3");
275 EXPECT_EQ(2u, map.GetCount()); 275 EXPECT_EQ(2u, map.GetCount());
276 EXPECT_FALSE(map.GetValueForKey("c")); 276 EXPECT_FALSE(map.GetValueForKey("c"));
277 } 277 }
278 278
279 #if DCHECK_IS_ON 279 #if DCHECK_IS_ON()
280 280
281 TEST(SimpleStringDictionaryDeathTest, NullKey) { 281 TEST(SimpleStringDictionaryDeathTest, NullKey) {
282 TSimpleStringDictionary<4, 6, 6> map; 282 TSimpleStringDictionary<4, 6, 6> map;
283 ASSERT_DEATH_CHECK(map.SetKeyValue(nullptr, "hello"), "key"); 283 ASSERT_DEATH_CHECK(map.SetKeyValue(nullptr, "hello"), "key");
284 284
285 map.SetKeyValue("hi", "there"); 285 map.SetKeyValue("hi", "there");
286 ASSERT_DEATH_CHECK(map.GetValueForKey(nullptr), "key"); 286 ASSERT_DEATH_CHECK(map.GetValueForKey(nullptr), "key");
287 EXPECT_STREQ("there", map.GetValueForKey("hi")); 287 EXPECT_STREQ("there", map.GetValueForKey("hi"));
288 288
289 ASSERT_DEATH_CHECK(map.GetValueForKey(nullptr), "key"); 289 ASSERT_DEATH_CHECK(map.GetValueForKey(nullptr), "key");
290 map.RemoveKey("hi"); 290 map.RemoveKey("hi");
291 EXPECT_EQ(0u, map.GetCount()); 291 EXPECT_EQ(0u, map.GetCount());
292 } 292 }
293 293
294 #endif 294 #endif
295 295
296 } // namespace 296 } // namespace
297 } // namespace test 297 } // namespace test
298 } // namespace crashpad 298 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | util/misc/initialization_state_dcheck.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698