summaryrefslogtreecommitdiff
path: root/src/test/test-set.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test-set.c')
-rw-r--r--src/test/test-set.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/test-set.c b/src/test/test-set.c
index ac292ed680..0ee5ddcc9f 100644
--- a/src/test/test-set.c
+++ b/src/test/test-set.c
@@ -39,8 +39,25 @@ static void test_set_steal_first(void) {
assert_se(set_isempty(m));
}
+static void test_set_put(void) {
+ _cleanup_set_free_ Set *m = NULL;
+
+ m = set_new(&string_hash_ops);
+ assert_se(m);
+
+ assert_se(set_put(m, (void*) "1") == 1);
+ assert_se(set_put(m, (void*) "22") == 1);
+ assert_se(set_put(m, (void*) "333") == 1);
+ assert_se(set_put(m, (void*) "333") == 0);
+ assert_se(set_remove(m, (void*) "333"));
+ assert_se(set_put(m, (void*) "333") == 1);
+ assert_se(set_put(m, (void*) "333") == 0);
+ assert_se(set_put(m, (void*) "22") == 0);
+}
+
int main(int argc, const char *argv[]) {
test_set_steal_first();
+ test_set_put();
return 0;
}