test: add one more test for prioq_remove()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 16 Oct 2018 16:18:05 +0000 (01:18 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 16 Oct 2018 16:18:10 +0000 (01:18 +0900)
This adds a testcase for e6e637a11a6c62eff31d36f5fc4b49c2a10c7ea8.

src/test/test-prioq.c

index b2ee70b..a93d37d 100644 (file)
@@ -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);