diff options
author | Stephen Worley <sworley@cumulusnetworks.com> | 2019-07-23 22:33:48 +0200 |
---|---|---|
committer | Stephen Worley <sworley@cumulusnetworks.com> | 2019-07-31 17:35:21 +0200 |
commit | 7de7c75b29a4978cfae3cccd5192bb96a34dedd4 (patch) | |
tree | 9f1237fd1ff67626b8804aa21aa57ccc3d193179 /tests | |
parent | lib: Impelement the `*_del` list API. (diff) | |
download | frr-7de7c75b29a4978cfae3cccd5192bb96a34dedd4.tar.xz frr-7de7c75b29a4978cfae3cccd5192bb96a34dedd4.zip |
tests: Add asserts to check return on list *_del
Add some asserts where `list_del()` is called to verify they object
was found when it was deleted.
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/test_typelist.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/lib/test_typelist.h b/tests/lib/test_typelist.h index b288f0bd8..7ff210cae 100644 --- a/tests/lib/test_typelist.h +++ b/tests/lib/test_typelist.h @@ -209,7 +209,7 @@ static void concat(test_, TYPE)(void) assert(list_add(&head, &dummy) == &itm[j]); else { assert(list_add(&head, &dummy) == NULL); - list_del(&head, &dummy); + assert(list_del(&head, &dummy) != NULL); } } ts_hashx("add-dup", "a538546a6e6ab0484e925940aa8dd02fd934408bbaed8cb66a0721841584d838"); @@ -255,7 +255,7 @@ static void concat(test_, TYPE)(void) list_first(&head) == &dummy); } else if (list_next(&head, &dummy)) assert(list_next(&head, &dummy)->val > j); - list_del(&head, &dummy); + assert(list_del(&head, &dummy) != NULL); } ts_hash("add-dup+find_{lt,gteq}", "a538546a6e6ab0484e925940aa8dd02fd934408bbaed8cb66a0721841584d838"); #endif @@ -295,7 +295,7 @@ static void concat(test_, TYPE)(void) (void)prng_rand(prng); j = prng_rand(prng) % NITEM; if (itm[j].scratchpad == 1) { - list_del(&head, &itm[j]); + assert(list_del(&head, &itm[j]) != NULL); itm[j].scratchpad = 0; l++; } @@ -307,7 +307,7 @@ static void concat(test_, TYPE)(void) assert(item->scratchpad != 0); if (item->val & 1) { - list_del(&head, item); + assert(list_del(&head, item) != NULL); item->scratchpad = 0; l++; } @@ -333,7 +333,7 @@ static void concat(test_, TYPE)(void) for (i = 0; i < NITEM / 2; i++) { j = prng_rand(prng) % NITEM; if (itm[j].scratchpad == 1) { - list_del(&head, &itm[j]); + assert(list_del(&head, &itm[j]) != NULL); itm[j].scratchpad = 0; k--; } @@ -371,7 +371,7 @@ static void concat(test_, TYPE)(void) for (i = 0; i < NITEM / 2; i++) { j = prng_rand(prng) % NITEM; if (itm[j].scratchpad == 1) { - list_del(&head, &itm[j]); + assert(list_del(&head, &itm[j]) != NULL); itm[j].scratchpad = 0; k--; } @@ -424,7 +424,7 @@ static void concat(test_, TYPE)(void) item = &itm[j]; if (item->scratchpad == 0) continue; - list_del(&head, item); + assert(list_del(&head, item) != NULL); } item->scratchpad = 0; k--; @@ -469,7 +469,7 @@ static void concat(test_, TYPE)(void) item = &itm[j]; if (item->scratchpad == 0) continue; - list_del(&head, item); + assert(list_del(&head, item) != NULL); } item->scratchpad = 0; k--; |