chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sd-bus: add missing format attribute
[elogind.git]
/
src
/
test
/
test-hashmap-plain.c
diff --git
a/src/test/test-hashmap-plain.c
b/src/test/test-hashmap-plain.c
index 63f2f3e8ff0671b6b047fa60c5386225df79d5a6..84b508f874e754efd7d8f72b1cd41a8828e8d141 100644
(file)
--- a/
src/test/test-hashmap-plain.c
+++ b/
src/test/test-hashmap-plain.c
@@
-245,14
+245,19
@@
static void test_hashmap_put(void) {
Hashmap *m = NULL;
int valid_hashmap_put;
void *val1 = (void*) "val 1";
Hashmap *m = NULL;
int valid_hashmap_put;
void *val1 = (void*) "val 1";
+ void *val2 = (void*) "val 2";
+ _cleanup_free_ char* key1 = NULL;
-
hashmap_ensure_allocated(&m, &string_hash_ops
);
+
assert_se(hashmap_ensure_allocated(&m, &string_hash_ops) >= 0
);
assert_se(m);
valid_hashmap_put = hashmap_put(m, "key 1", val1);
assert_se(valid_hashmap_put == 1);
assert_se(hashmap_put(m, "key 1", val1) == 0);
assert_se(m);
valid_hashmap_put = hashmap_put(m, "key 1", val1);
assert_se(valid_hashmap_put == 1);
assert_se(hashmap_put(m, "key 1", val1) == 0);
- assert_se(hashmap_put(m, "key 1", (void *)"val 2") == -EEXIST);
+ assert_se(hashmap_put(m, "key 1", val2) == -EEXIST);
+ key1 = strdup("key 1");
+ assert_se(hashmap_put(m, key1, val1) == 0);
+ assert_se(hashmap_put(m, key1, val2) == -EEXIST);
hashmap_free(m);
}
hashmap_free(m);
}