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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // We then verify that it iterates through exactly the number of key/value | 165 // We then verify that it iterates through exactly the number of key/value |
166 // pairs we expect, and that they match one-for-one with what we would expect. | 166 // pairs we expect, and that they match one-for-one with what we would expect. |
167 // The ordering of the iteration does not matter... | 167 // The ordering of the iteration does not matter... |
168 | 168 |
169 // used to keep track of number of occurrences found for key/value pairs | 169 // used to keep track of number of occurrences found for key/value pairs |
170 int count[kDictionaryCapacity]; | 170 int count[kDictionaryCapacity]; |
171 memset(count, 0, sizeof(count)); | 171 memset(count, 0, sizeof(count)); |
172 | 172 |
173 int totalCount = 0; | 173 int totalCount = 0; |
174 | 174 |
175 const SimpleStringDictionary::Entry* entry; | 175 for (;;) { |
176 while ((entry = iter.Next())) { | 176 const SimpleStringDictionary::Entry* entry = iter.Next(); |
| 177 if (!entry) |
| 178 break; |
177 totalCount++; | 179 totalCount++; |
178 | 180 |
179 // Extract keyNumber from a string of the form key<keyNumber> | 181 // Extract keyNumber from a string of the form key<keyNumber> |
180 int keyNumber; | 182 int keyNumber; |
181 sscanf(entry->key, "key%d", &keyNumber); | 183 sscanf(entry->key, "key%d", &keyNumber); |
182 | 184 |
183 // Extract valueNumber from a string of the form value<valueNumber> | 185 // Extract valueNumber from a string of the form value<valueNumber> |
184 int valueNumber; | 186 int valueNumber; |
185 sscanf(entry->value, "value%d", &valueNumber); | 187 sscanf(entry->value, "value%d", &valueNumber); |
186 | 188 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 ASSERT_DEATH_CHECK(map.GetValueForKey(nullptr), "key"); | 291 ASSERT_DEATH_CHECK(map.GetValueForKey(nullptr), "key"); |
290 map.RemoveKey("hi"); | 292 map.RemoveKey("hi"); |
291 EXPECT_EQ(0u, map.GetCount()); | 293 EXPECT_EQ(0u, map.GetCount()); |
292 } | 294 } |
293 | 295 |
294 #endif | 296 #endif |
295 | 297 |
296 } // namespace | 298 } // namespace |
297 } // namespace test | 299 } // namespace test |
298 } // namespace crashpad | 300 } // namespace crashpad |
OLD | NEW |