Beispiel #1
0
static void verify_property_1(node *n) {
    if (node_color(n) != L_RED_NODE && node_color(n) != L_BLACK_NODE) {
        L_ERROR("color neither RED nor BLACK\n", "verify_property_1");
        return;
    }
    if (n == NULL) return;
    verify_property_1(n->left);
    verify_property_1(n->right);
}
Beispiel #2
0
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
}
Beispiel #3
0
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
}
Beispiel #4
0
void verify_property_1(node n) {
    assert(node_color(n) == RED || node_color(n) == BLACK);
    if (n == NULL) return;
    verify_property_1(n->left);
    verify_property_1(n->right);
}