mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-05 19:54:09 +00:00
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>
This commit is contained in:
parent
da098d78bb
commit
7de7c75b29
@ -209,7 +209,7 @@ static void concat(test_, TYPE)(void)
|
|||||||
assert(list_add(&head, &dummy) == &itm[j]);
|
assert(list_add(&head, &dummy) == &itm[j]);
|
||||||
else {
|
else {
|
||||||
assert(list_add(&head, &dummy) == NULL);
|
assert(list_add(&head, &dummy) == NULL);
|
||||||
list_del(&head, &dummy);
|
assert(list_del(&head, &dummy) != NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ts_hashx("add-dup", "a538546a6e6ab0484e925940aa8dd02fd934408bbaed8cb66a0721841584d838");
|
ts_hashx("add-dup", "a538546a6e6ab0484e925940aa8dd02fd934408bbaed8cb66a0721841584d838");
|
||||||
@ -255,7 +255,7 @@ static void concat(test_, TYPE)(void)
|
|||||||
list_first(&head) == &dummy);
|
list_first(&head) == &dummy);
|
||||||
} else if (list_next(&head, &dummy))
|
} else if (list_next(&head, &dummy))
|
||||||
assert(list_next(&head, &dummy)->val > j);
|
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");
|
ts_hash("add-dup+find_{lt,gteq}", "a538546a6e6ab0484e925940aa8dd02fd934408bbaed8cb66a0721841584d838");
|
||||||
#endif
|
#endif
|
||||||
@ -295,7 +295,7 @@ static void concat(test_, TYPE)(void)
|
|||||||
(void)prng_rand(prng);
|
(void)prng_rand(prng);
|
||||||
j = prng_rand(prng) % NITEM;
|
j = prng_rand(prng) % NITEM;
|
||||||
if (itm[j].scratchpad == 1) {
|
if (itm[j].scratchpad == 1) {
|
||||||
list_del(&head, &itm[j]);
|
assert(list_del(&head, &itm[j]) != NULL);
|
||||||
itm[j].scratchpad = 0;
|
itm[j].scratchpad = 0;
|
||||||
l++;
|
l++;
|
||||||
}
|
}
|
||||||
@ -307,7 +307,7 @@ static void concat(test_, TYPE)(void)
|
|||||||
assert(item->scratchpad != 0);
|
assert(item->scratchpad != 0);
|
||||||
|
|
||||||
if (item->val & 1) {
|
if (item->val & 1) {
|
||||||
list_del(&head, item);
|
assert(list_del(&head, item) != NULL);
|
||||||
item->scratchpad = 0;
|
item->scratchpad = 0;
|
||||||
l++;
|
l++;
|
||||||
}
|
}
|
||||||
@ -333,7 +333,7 @@ static void concat(test_, TYPE)(void)
|
|||||||
for (i = 0; i < NITEM / 2; i++) {
|
for (i = 0; i < NITEM / 2; i++) {
|
||||||
j = prng_rand(prng) % NITEM;
|
j = prng_rand(prng) % NITEM;
|
||||||
if (itm[j].scratchpad == 1) {
|
if (itm[j].scratchpad == 1) {
|
||||||
list_del(&head, &itm[j]);
|
assert(list_del(&head, &itm[j]) != NULL);
|
||||||
itm[j].scratchpad = 0;
|
itm[j].scratchpad = 0;
|
||||||
k--;
|
k--;
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ static void concat(test_, TYPE)(void)
|
|||||||
for (i = 0; i < NITEM / 2; i++) {
|
for (i = 0; i < NITEM / 2; i++) {
|
||||||
j = prng_rand(prng) % NITEM;
|
j = prng_rand(prng) % NITEM;
|
||||||
if (itm[j].scratchpad == 1) {
|
if (itm[j].scratchpad == 1) {
|
||||||
list_del(&head, &itm[j]);
|
assert(list_del(&head, &itm[j]) != NULL);
|
||||||
itm[j].scratchpad = 0;
|
itm[j].scratchpad = 0;
|
||||||
k--;
|
k--;
|
||||||
}
|
}
|
||||||
@ -424,7 +424,7 @@ static void concat(test_, TYPE)(void)
|
|||||||
item = &itm[j];
|
item = &itm[j];
|
||||||
if (item->scratchpad == 0)
|
if (item->scratchpad == 0)
|
||||||
continue;
|
continue;
|
||||||
list_del(&head, item);
|
assert(list_del(&head, item) != NULL);
|
||||||
}
|
}
|
||||||
item->scratchpad = 0;
|
item->scratchpad = 0;
|
||||||
k--;
|
k--;
|
||||||
@ -469,7 +469,7 @@ static void concat(test_, TYPE)(void)
|
|||||||
item = &itm[j];
|
item = &itm[j];
|
||||||
if (item->scratchpad == 0)
|
if (item->scratchpad == 0)
|
||||||
continue;
|
continue;
|
||||||
list_del(&head, item);
|
assert(list_del(&head, item) != NULL);
|
||||||
}
|
}
|
||||||
item->scratchpad = 0;
|
item->scratchpad = 0;
|
||||||
k--;
|
k--;
|
||||||
|
Loading…
Reference in New Issue
Block a user