void verify_property_4(node n) { if (node_color(n) == RED) { assert (node_color(n->left) == BLACK); assert (node_color(n->right) == BLACK); assert (node_color(n->parent) == BLACK); } if (n == NULL) return; verify_property_4(n->left); verify_property_4(n->right); }
static void verify_property_4(node *n) { if (node_color(n) == L_RED_NODE) { if (node_color(n->left) != L_BLACK_NODE || node_color(n->right) != L_BLACK_NODE || node_color(n->parent) != L_BLACK_NODE) { L_ERROR("children & parent not all BLACK", "verify_property_4"); return; } } if (n == NULL) return; verify_property_4(n->left); verify_property_4(n->right); }
static void verify_properties(L_RBTREE *t) { #if VERIFY_RBTREE verify_property_1(t->root); verify_property_2(t->root); /* Property 3 is implicit */ verify_property_4(t->root); verify_property_5(t->root); #endif }
void verify_properties(rbtree t) { #ifdef VERIFY_RBTREE verify_property_1(t->root); verify_property_2(t->root); /* Property 3 is implicit */ verify_property_4(t->root); verify_property_5(t->root); #endif }