示例#1
0
/**
 * Test the two pair is have the same type.
 */
bool_t _hash_multimap_same_pair_type(const pair_t* cppair_first, const pair_t* cppair_second)
{
    assert(cppair_first != NULL);
    assert(cppair_second != NULL);
    assert(_pair_is_inited(cppair_first) || _pair_is_created(cppair_first));
    assert(_pair_is_inited(cppair_second) || _pair_is_created(cppair_second));

    return (cppair_first->_t_typeinfofirst._pt_type == cppair_second->_t_typeinfofirst._pt_type) &&
           (cppair_first->_t_typeinfofirst._t_style == cppair_second->_t_typeinfofirst._t_style) &&
           (cppair_first->_t_typeinfosecond._pt_type == cppair_second->_t_typeinfosecond._pt_type) &&
           (cppair_first->_t_typeinfosecond._t_style == cppair_second->_t_typeinfosecond._t_style) &&
           _type_is_same(cppair_first->_t_typeinfofirst._s_typename, cppair_second->_t_typeinfofirst._s_typename) &&
           _type_is_same(cppair_first->_t_typeinfosecond._s_typename, cppair_second->_t_typeinfosecond._s_typename);
}
示例#2
0
/**
 * Test the two pair is have the same type.
 */
bool_t _pair_same_type(const pair_t* cppair_first, const pair_t* cppair_second)
{
    assert(cppair_first != NULL);
    assert(cppair_second != NULL);
    assert(_pair_is_inited(cppair_first) || _pair_is_created(cppair_first));
    assert(_pair_is_inited(cppair_second) || _pair_is_created(cppair_second));

    if (cppair_first == cppair_second) {
        return true;
    }

    return cppair_first->_t_typeinfofirst._pt_type == cppair_second->_t_typeinfofirst._pt_type &&
           cppair_first->_t_typeinfofirst._t_style == cppair_second->_t_typeinfofirst._t_style &&
           cppair_first->_t_typeinfosecond._pt_type == cppair_second->_t_typeinfosecond._pt_type &&
           cppair_first->_t_typeinfosecond._t_style == cppair_second->_t_typeinfosecond._t_style &&
           _type_is_same(cppair_first->_t_typeinfofirst._s_typename, cppair_second->_t_typeinfofirst._s_typename) &&
           _type_is_same(cppair_first->_t_typeinfosecond._s_typename, cppair_second->_t_typeinfosecond._s_typename);
}
示例#3
0
/**
 * Test whether two iterator point to same type element.
 */
bool_t _iterator_same_elem_type(iterator_t it_first, iterator_t it_second)
{
    _typeinfo_t* pt_first = _iterator_get_typeinfo(it_first);
    _typeinfo_t* pt_second = _iterator_get_typeinfo(it_second);

    if (pt_first == NULL || pt_second == NULL) {
        return false;
    }
    return (pt_first->_pt_type == pt_second->_pt_type) &&
           (pt_first->_t_style == pt_second->_t_style) &&
           _type_is_same(pt_first->_s_typename, pt_second->_s_typename);
}
示例#4
0
/**
 * Test the two pair is have the same type.
 */
bool_t _map_same_pair_type_ex(const pair_t* cppair_first, const pair_t* cppair_second)
{
    assert(cppair_first != NULL);
    assert(cppair_second != NULL);
    assert(_pair_is_inited(cppair_first) || _pair_is_created(cppair_first));
    assert(_pair_is_inited(cppair_second) || _pair_is_created(cppair_second));

    if(cppair_first == cppair_second)
    {
        return true;
    }

    return (cppair_first->_t_typeinfofirst._pt_type == cppair_second->_t_typeinfofirst._pt_type) &&
           (cppair_first->_t_typeinfofirst._t_style == cppair_second->_t_typeinfofirst._t_style) &&
           (cppair_first->_t_typeinfosecond._pt_type == cppair_second->_t_typeinfosecond._pt_type) &&
           (cppair_first->_t_typeinfosecond._t_style == cppair_second->_t_typeinfosecond._t_style) &&
           (cppair_first->_bfun_mapkeycompare == cppair_second->_bfun_mapkeycompare) &&
           (cppair_first->_bfun_mapvaluecompare == cppair_second->_bfun_mapvaluecompare) &&
           _type_is_same(cppair_first->_t_typeinfofirst._sz_typename, cppair_second->_t_typeinfofirst._sz_typename) &&
           _type_is_same(cppair_first->_t_typeinfosecond._sz_typename, cppair_second->_t_typeinfosecond._sz_typename);
}
示例#5
0
bool_t _type_is_same_ex(const _typeinfo_t* pt_first, const _typeinfo_t* pt_second)
{
    assert(pt_first != NULL);
    assert(pt_second != NULL);

    if (pt_first == pt_second) {
        return true;
    }

    return pt_first->_pt_type == pt_second->_pt_type &&
           pt_first->_t_style == pt_second->_t_style &&
           _type_is_same(pt_first->_s_typename, pt_second->_s_typename);
}
示例#6
0
/**
 * Test the type that saved in the avl tree container is same.
 */
bool_t _avl_tree_same_type(const _avl_tree_t* cpt_first, const _avl_tree_t* cpt_second)
{
    assert(cpt_first != NULL);
    assert(cpt_second != NULL);
    assert(_avl_tree_is_inited(cpt_first) || _avl_tree_is_created(cpt_first));
    assert(_avl_tree_is_inited(cpt_second) || _avl_tree_is_created(cpt_second));

    if (cpt_first == cpt_second) {
        return true;
    }

    return (cpt_first->_t_typeinfo._t_style == cpt_second->_t_typeinfo._t_style) &&
           (cpt_first->_t_typeinfo._pt_type == cpt_second->_t_typeinfo._pt_type) &&
           _type_is_same(_GET_AVL_TREE_TYPE_NAME(cpt_first), _GET_AVL_TREE_TYPE_NAME(cpt_second));
}
示例#7
0
/**
 * Test the type that saved in the vector container is same.
 */
bool_t _vector_same_type(const vector_t* cpvec_first, const vector_t* cpvec_second)
{
    assert(cpvec_first != NULL);
    assert(cpvec_second != NULL);
    assert(_vector_is_inited(cpvec_first) || _vector_is_created(cpvec_first));
    assert(_vector_is_inited(cpvec_second) || _vector_is_created(cpvec_second));

    if (cpvec_first == cpvec_second) {
        return true;
    }

    return (cpvec_first->_t_typeinfo._pt_type == cpvec_second->_t_typeinfo._pt_type) &&
           (cpvec_first->_t_typeinfo._t_style == cpvec_second->_t_typeinfo._t_style) &&
           _type_is_same(_GET_VECTOR_TYPE_NAME(cpvec_first), _GET_VECTOR_TYPE_NAME(cpvec_second));
}
示例#8
0
/**
 * Test the type that saved in the deque container is same.
 */
bool_t _deque_same_type(const deque_t* cpdeq_first, const deque_t* cpdeq_second)
{
    assert(cpdeq_first != NULL);
    assert(cpdeq_second != NULL);
    assert(_deque_is_inited(cpdeq_first) || _deque_is_created(cpdeq_first));
    assert(_deque_is_inited(cpdeq_second) || _deque_is_created(cpdeq_second));

    if(cpdeq_first == cpdeq_second)
    {
        return true;
    }

    return (cpdeq_first->_t_typeinfo._pt_type == cpdeq_second->_t_typeinfo._pt_type) &&
           (cpdeq_first->_t_typeinfo._t_style == cpdeq_second->_t_typeinfo._t_style) &&
           _type_is_same(_GET_DEQUE_TYPE_NAME(cpdeq_first), _GET_DEQUE_TYPE_NAME(cpdeq_second));
}
示例#9
0
/**
 * Test the type and compare function that saved in the hashtable container is same.
 */
bool_t _hashtable_same_type_ex(const _hashtable_t* cpt_first, const _hashtable_t* cpt_second)
{
    assert(cpt_first != NULL);
    assert(cpt_second != NULL);
    assert(_hashtable_is_inited(cpt_first) || _hashtable_is_created(cpt_first));
    assert(_hashtable_is_inited(cpt_second) || _hashtable_is_created(cpt_second));

    if (cpt_first == cpt_second) {
        return true;
    }

    return (cpt_first->_t_typeinfo._pt_type == cpt_second->_t_typeinfo._pt_type) &&
           (cpt_first->_t_typeinfo._t_style == cpt_second->_t_typeinfo._t_style) &&
           (cpt_first->_ufun_hash == cpt_second->_ufun_hash) &&
           (cpt_first->_bfun_compare == cpt_second->_bfun_compare) &&
           vector_size(&cpt_first->_vec_bucket) == vector_size(&cpt_second->_vec_bucket) &&
           _type_is_same(_GET_HASHTABLE_TYPE_NAME(cpt_first), _GET_HASHTABLE_TYPE_NAME(cpt_second));
}
示例#10
0
void test__type_is_same__cstl_cstl_same_complex(void** state)
{
    assert_true(_type_is_same("hash_set_t<pair_t<vector_t<_test__type_is_same_t>,list_t<queue_t<int>>>>",
                "hash_set_t<pair_t<vector_t<struct _test__type_is_same>,list_t<queue_t<signed int>>>>") == true);
}
示例#11
0
void test__type_is_same__cstl_cstl_rel_not_same(void** state)
{
    assert_true(_type_is_same("map_t<int,double>", "hash_map_t<int,double>") == false);
}
示例#12
0
void test__type_is_same__cstl_cstl_second_not_same(void** state)
{
    assert_true(_type_is_same("map_t<int,double>", "map_t<int,short>") == false);
}
示例#13
0
void test__type_is_same__cstl_cstl_first_not_same(void** state)
{
    assert_true(_type_is_same("map_t<int,double>", "map_t<long,double>") == false);
}
示例#14
0
void test__type_is_same__cstl_cstl_seq_rel_not_same(void** state)
{
    assert_true(_type_is_same("set_t<int>", "map_t<int,int>") == false);
}
示例#15
0
void test__type_is_same__cstl_cstl_container_not_same(void** state)
{
    assert_true(_type_is_same("set_t<int>", "stack_t<int>") == false);
}
示例#16
0
void test__type_is_same__c_iterator_not_same(void** state)
{
    assert_true(_type_is_same("int", "iterator_t") == false);
}
示例#17
0
void test__type_is_same__c_user_not_same(void** state)
{
    type_register(struct _test__type_is_same, NULL, NULL, NULL, NULL);
    assert_true(_type_is_same("int", "struct _test__type_is_same") == false);
}
示例#18
0
void test__type_is_same__user_user_duplicate(void** state)
{
    type_duplicate(struct _test__type_is_same, _test__type_is_same_t);
    assert_true(_type_is_same("_test__type_is_same_t", "struct _test__type_is_same") == true);
}
示例#19
0
void test__type_is_same__user_cstl_not_same(void** state)
{
    assert_true(_type_is_same("_test__type_is_same_t", "list_t<int>") == false);
}
示例#20
0
void test__type_is_same__user_user_not_same(void** state)
{
    assert_true(_type_is_same("struct _test__type_is_same", "_test__type_is_same_t") == false);
}
示例#21
0
void test__type_is_same__user_user_same(void** state)
{
    assert_true(_type_is_same("struct _test__type_is_same", "struct _test__type_is_same") == true);
}
示例#22
0
void test__type_is_same__c_cstl_not_same(void** state)
{
    assert_true(_type_is_same("int", "vector_t<int>") == false);
}
示例#23
0
void test__type_is_same__cstl_cstl_invalid(void** state)
{
    assert_true(_type_is_same("pair_t<int<abcdefg,abc>>>>>>,long<pair_t,vector_t<int>,double>", "pair_t<int<dddd>abcdefg") == false);
}
示例#24
0
void test__type_is_same__c_c_duplicate(void** state)
{
    assert_true(_type_is_same("int", "signed") == true);
}
示例#25
0
void test__type_is_same__c_c_not_same(void** state)
{
    assert_true(_type_is_same("int", "long") == false);
}
示例#26
0
void test__type_is_same__c_string_not_same(void** state)
{
    assert_true(_type_is_same("int", "string_t") == false);
}
示例#27
0
void test__type_is_same__cstl_cstl_same(void** state)
{
    assert_true(_type_is_same("deque_t<int>", "deque_t<signed>") == true);
}
示例#28
0
void test__type_is_same__cstl_cstl_elem_not_same(void** state)
{
    assert_true(_type_is_same("slist_t<long>", "slist_t<double>") == false);
}
示例#29
0
void test__type_is_same__string_iterator_not_same(void** state)
{
    assert_true(_type_is_same("string_t", "vector_iterator_t") == false);
}
示例#30
0
void test__type_is_same__c_c_same(void** state)
{
    assert_true(_type_is_same("int", "int") == true);
}