aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-06-19 16:45:09 -0700
committerFlorin Coras <fcoras@cisco.com>2019-06-19 16:50:30 -0700
commitd314963d0f1d12c45c55c7fd210f93c5cac3a8fc (patch)
tree70e630d04046e8a4c5e1fe261bdae402ce4f6798 /src/plugins
parent6ac96762dc2631bb1c720057f2b9dd854c69b767 (diff)
vppinfra: fix rbtree node delete
Type:fix Make sure tnil color is black and that the right node colors are updated. Change-Id: Ibd9d7ea9438df4dab977202955957824723a865d Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/unittest/rbtree_test.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/unittest/rbtree_test.c b/src/plugins/unittest/rbtree_test.c
index 490be9c156e..bfab98c3cd7 100644
--- a/src/plugins/unittest/rbtree_test.c
+++ b/src/plugins/unittest/rbtree_test.c
@@ -160,7 +160,11 @@ rbtree_test_basic (vlib_main_t * vm, unformat_input_t * input)
* Delete all keys
*/
for (i = 0; i < n_keys; i++)
- rb_tree_del (rt, i);
+ {
+ rb_tree_del (rt, i);
+ if (rt->nodes[RBTREE_TNIL_INDEX].color != RBTREE_BLACK)
+ RBTREE_TEST (0, "tnil should be black");
+ }
RBTREE_TEST (rb_tree_n_nodes (rt) == 1, "number nodes %u is %u",
1, rb_tree_n_nodes (rt));