hashmap: check if identical hash_ops is specified if already allocated
This commit is contained in:
@@ -419,17 +419,10 @@ TEST(hashmap_remove_and_replace) {
|
||||
|
||||
TEST(hashmap_ensure_allocated) {
|
||||
_cleanup_hashmap_free_ Hashmap *m = NULL;
|
||||
int r;
|
||||
|
||||
r = hashmap_ensure_allocated(&m, &string_hash_ops);
|
||||
assert_se(r == 1);
|
||||
|
||||
r = hashmap_ensure_allocated(&m, &string_hash_ops);
|
||||
assert_se(r == 0);
|
||||
|
||||
/* different hash ops shouldn't matter at this point */
|
||||
r = hashmap_ensure_allocated(&m, &trivial_hash_ops);
|
||||
assert_se(r == 0);
|
||||
ASSERT_OK_POSITIVE(hashmap_ensure_allocated(&m, &string_hash_ops));
|
||||
ASSERT_OK_ZERO(hashmap_ensure_allocated(&m, &string_hash_ops));
|
||||
ASSERT_SIGNAL(hashmap_ensure_allocated(&m, &trivial_hash_ops), SIGABRT);
|
||||
}
|
||||
|
||||
TEST(hashmap_foreach_key) {
|
||||
|
||||
Reference in New Issue
Block a user