summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-10-17 01:18:05 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-10-17 01:18:10 +0900
commit5023c62efdd5749f3edcaa3055cd17ba8a05af13 (patch)
treedcd327e7d418ddae92667552b744a7c32a95080b
parent0cb3b295ec82357162fe625d82b439ecbbe5f2a2 (diff)
downloadsystemd-5023c62efdd5749f3edcaa3055cd17ba8a05af13.tar.gz
systemd-5023c62efdd5749f3edcaa3055cd17ba8a05af13.tar.bz2
systemd-5023c62efdd5749f3edcaa3055cd17ba8a05af13.zip
test: add one more test for prioq_remove()
This adds a testcase for e6e637a11a6c62eff31d36f5fc4b49c2a10c7ea8.
-rw-r--r--src/test/test-prioq.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/test/test-prioq.c b/src/test/test-prioq.c
index b2ee70bca6..a93d37d460 100644
--- a/src/test/test-prioq.c
+++ b/src/test/test-prioq.c
@@ -16,7 +16,7 @@ static int unsigned_compare(const unsigned *a, const unsigned *b) {
static void test_unsigned(void) {
_cleanup_(prioq_freep) Prioq *q = NULL;
- unsigned buffer[SET_SIZE], i, u;
+ unsigned buffer[SET_SIZE], i, u, n;
srand(0);
@@ -26,6 +26,9 @@ static void test_unsigned(void) {
u = (unsigned) rand();
buffer[i] = u;
assert_se(prioq_put(q, UINT_TO_PTR(u), NULL) >= 0);
+
+ n = prioq_size(q);
+ assert_se(prioq_remove(q, UINT_TO_PTR(u), &n) == 0);
}
typesafe_qsort(buffer, ELEMENTSOF(buffer), unsigned_compare);