示例#1
0
/**
 * Destroy set container auxiliary function.
 */
void _set_destroy_auxiliary(set_t* pset_set)
{
    assert(pset_set != NULL);

#ifdef CSTL_SET_AVL_TREE
    _avl_tree_destroy_auxiliary(&pset_set->_t_tree);
#else
    _rb_tree_destroy_auxiliary(&pset_set->_t_tree);
#endif
}
示例#2
0
void test__rb_tree_destroy_auxiliary__non_created(void** state)
{
    _rb_tree_t* pt_rb_tree = _create_rb_tree("int");

    pt_rb_tree->_t_rbroot._t_color = _COLOR_BLACK;
    expect_assert_failure(_rb_tree_destroy_auxiliary(pt_rb_tree));
    pt_rb_tree->_t_rbroot._t_color = _COLOR_RED;

    _rb_tree_destroy(pt_rb_tree);
}
示例#3
0
void test__rb_tree_destroy_auxiliary__empty(void** state)
{
    _rb_tree_t* pt_rb_tree = _create_rb_tree("int");
    _rb_tree_init(pt_rb_tree, NULL);

    _rb_tree_destroy_auxiliary(pt_rb_tree);
    assert_true(pt_rb_tree->_t_rbroot._pt_parent == NULL);
    assert_true(pt_rb_tree->_t_rbroot._pt_left == &pt_rb_tree->_t_rbroot);
    assert_true(pt_rb_tree->_t_rbroot._pt_right == &pt_rb_tree->_t_rbroot);
    assert_true(pt_rb_tree->_t_nodecount == 0);
    assert_true(pt_rb_tree->_t_compare == NULL);
    free(pt_rb_tree);
}
示例#4
0
/**
 * Destroy map container auxiliary function.
 */
void _map_destroy_auxiliary(map_t* pmap_map)
{
    assert(pmap_map != NULL);

    _pair_destroy_auxiliary(&pmap_map->_pair_temp);
#ifdef CSTL_MAP_AVL_TREE
    _avl_tree_destroy_auxiliary(&pmap_map->_t_tree);
#else
    _rb_tree_destroy_auxiliary(&pmap_map->_t_tree);
#endif

    pmap_map->_bfun_keycompare = NULL;
    pmap_map->_bfun_valuecompare = NULL;
}
示例#5
0
void test__rb_tree_destroy_auxiliary__null_rb_tree(void** state)
{
    expect_assert_failure(_rb_tree_destroy_auxiliary(NULL));
}