From 1d15adcef8dde685664760cc600d6705cc7de07b Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Tue, 12 Dec 2017 21:57:59 +0100 Subject: [PATCH] Update --- m-prioqueue.h | 4 ++-- tests/test-mprioqueue.c | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/m-prioqueue.h b/m-prioqueue.h index 96b5ca7b..b3271713 100644 --- a/m-prioqueue.h +++ b/m-prioqueue.h @@ -140,7 +140,7 @@ static inline size_t \ M_C(name, _i_rchild)(size_t i) \ { \ - assert(i <= ((-(size_t)1)-2)/2); \ + assert(i <= ((-(size_t)1)-2)/2); \ return 2*i + 2; \ } \ \ @@ -181,7 +181,7 @@ static inline type * \ M_C(name, _front)(prioqueue_t p) \ { \ - return M_C(name, _array_get)(p->array, 0); \ + return M_C(name, _array_get)(p->array, 0); \ } \ \ static inline void \ diff --git a/tests/test-mprioqueue.c b/tests/test-mprioqueue.c index 087e4702..a8a2d25a 100644 --- a/tests/test-mprioqueue.c +++ b/tests/test-mprioqueue.c @@ -32,6 +32,13 @@ static void test1(void) assert (x == 60); assert (int_pqueue_empty_p(p)); assert (int_pqueue_size(p) == 0); + int_pqueue_push(p, 10); + int_pqueue_push(p, 30); + int_pqueue_pop(&x, p); + assert (x == 10); + int_pqueue_push(p, 5); + int_pqueue_pop(&x, p); + assert (x == 5); int_pqueue_clear(p); }