| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |