From: Yu Watanabe Date: Tue, 16 Oct 2018 16:18:05 +0000 (+0900) Subject: test: add one more test for prioq_remove() X-Git-Tag: v240~535^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F10419%2Fhead;p=thirdparty%2Fsystemd.git test: add one more test for prioq_remove() This adds a testcase for e6e637a11a6c62eff31d36f5fc4b49c2a10c7ea8. --- diff --git a/src/test/test-prioq.c b/src/test/test-prioq.c index b2ee70bca6a..a93d37d4602 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);