예제 #1
0
void test__type_get_type_pair__invalid(void** state)
{
    _typeinfo_t t_first;
    _typeinfo_t t_second;
    _type_get_type_pair(&t_first, &t_second, "hash_map_t<double,slist_t<pair_t<int,_test__type_get_type_t>>>pair_t<int,vector_t<stack_t<deque_t<int>>>>");
    assert_true(t_first._t_style == _TYPE_INVALID);
    assert_true(t_first._pt_type == NULL);
    assert_true(t_second._t_style == _TYPE_INVALID);
    assert_true(t_second._pt_type == NULL);
}
예제 #2
0
void test__type_get_type_pair__complex(void** state)
{
    _typeinfo_t t_first;
    _typeinfo_t t_second;
    _type_get_type_pair(&t_first, &t_second, "hash_map_t<double,slist_t<pair_t<int,_test__type_get_type_t>>>,pair_t<int,vector_t<stack_t<deque_t<int>>>>");
    assert_true(t_first._t_style == _TYPE_CSTL_BUILTIN);
    assert_true(strncmp(t_first._s_typename, "hash_map_t<double,slist_t<pair_t<int,_test__type_get_type_t>>>", _TYPE_NAME_SIZE) == 0);
    assert_true(t_first._pt_type != NULL);
    assert_true(t_second._t_style == _TYPE_CSTL_BUILTIN);
    assert_true(strncmp(t_second._s_typename, "pair_t<int,vector_t<stack_t<deque_t<int>>>>", _TYPE_NAME_SIZE) == 0);
    assert_true(t_second._pt_type != NULL);
}
예제 #3
0
void test__type_get_type_pair__seq_seq(void** state)
{
    _typeinfo_t t_first;
    _typeinfo_t t_second;
    _type_get_type_pair(&t_first, &t_second, "vector_t<int>,slist_t<int>");
    assert_true(t_first._t_style == _TYPE_CSTL_BUILTIN);
    assert_true(strncmp(t_first._s_typename, "vector_t<int>", _TYPE_NAME_SIZE) == 0);
    assert_true(t_first._pt_type != NULL);
    assert_true(t_second._t_style == _TYPE_CSTL_BUILTIN);
    assert_true(strncmp(t_second._s_typename, "slist_t<int>", _TYPE_NAME_SIZE) == 0);
    assert_true(t_second._pt_type != NULL);
}
예제 #4
0
void test__type_get_type_pair__rel_rel(void** state)
{
    _typeinfo_t t_first;
    _typeinfo_t t_second;
    _type_get_type_pair(&t_first, &t_second, "hash_map_t<double,int>,pair_t<int,int>");
    assert_true(t_first._t_style == _TYPE_CSTL_BUILTIN);
    assert_true(strncmp(t_first._s_typename, "hash_map_t<double,int>", _TYPE_NAME_SIZE) == 0);
    assert_true(t_first._pt_type != NULL);
    assert_true(t_second._t_style == _TYPE_CSTL_BUILTIN);
    assert_true(strncmp(t_second._s_typename, "pair_t<int,int>", _TYPE_NAME_SIZE) == 0);
    assert_true(t_second._pt_type != NULL);
}
예제 #5
0
void test__type_get_type_pair__c_rel(void** state)
{
    _typeinfo_t t_first;
    _typeinfo_t t_second;
    _type_get_type_pair(&t_first, &t_second, "bool_t,map_t<int,double>");
    assert_true(t_first._t_style == _TYPE_C_BUILTIN);
    assert_true(strncmp(t_first._s_typename, "bool_t", _TYPE_NAME_SIZE) == 0);
    assert_true(t_first._pt_type != NULL);
    assert_true(t_second._t_style == _TYPE_CSTL_BUILTIN);
    assert_true(strncmp(t_second._s_typename, "map_t<int,double>", _TYPE_NAME_SIZE) == 0);
    assert_true(t_second._pt_type != NULL);
}
예제 #6
0
void test__type_get_type_pair__usr_string(void** state)
{
    _typeinfo_t t_first;
    _typeinfo_t t_second;
    _type_get_type_pair(&t_first, &t_second, "_test__type_get_type_t,string_t");
    assert_true(t_first._t_style == _TYPE_USER_DEFINE);
    assert_true(strncmp(t_first._s_typename, "_test__type_get_type_t", _TYPE_NAME_SIZE) == 0);
    assert_true(t_first._pt_type != NULL);
    assert_true(t_second._t_style == _TYPE_CSTL_BUILTIN);
    assert_true(strncmp(t_second._s_typename, "string_t", _TYPE_NAME_SIZE) == 0);
    assert_true(t_second._pt_type != NULL);
}
예제 #7
0
void test__type_get_type_pair__c_iterator(void** state)
{
    _typeinfo_t t_first;
    _typeinfo_t t_second;
    _type_get_type_pair(&t_first, &t_second, "bool_t,deque_iterator_t");
    assert_true(t_first._t_style == _TYPE_C_BUILTIN);
    assert_true(strncmp(t_first._s_typename, "bool_t", _TYPE_NAME_SIZE) == 0);
    assert_true(t_first._pt_type != NULL);
    assert_true(t_second._t_style == _TYPE_CSTL_BUILTIN);
    assert_true(strncmp(t_second._s_typename, "deque_iterator_t", _TYPE_NAME_SIZE) == 0);
    assert_true(t_second._pt_type != NULL);
}
예제 #8
0
void test__type_get_type_pair__c_c(void** state)
{
    _typeinfo_t t_first;
    _typeinfo_t t_second;
    _type_get_type_pair(&t_first, &t_second, "int,double");
    assert_true(t_first._t_style == _TYPE_C_BUILTIN);
    assert_true(strncmp(t_first._s_typename, "int", _TYPE_NAME_SIZE) == 0);
    assert_true(t_first._pt_type != NULL);
    assert_true(t_second._t_style == _TYPE_C_BUILTIN);
    assert_true(strncmp(t_second._s_typename, "double", _TYPE_NAME_SIZE) == 0);
    assert_true(t_second._pt_type != NULL);
}
예제 #9
0
/**
 * Create pair container auxiliary function.
 */
bool_t _create_pair_auxiliary(pair_t* ppair_pair, const char* s_typename)
{
    assert(ppair_pair != NULL);
    assert(s_typename != NULL);

    _type_get_type_pair(&ppair_pair->_t_typeinfofirst, &ppair_pair->_t_typeinfosecond, s_typename);
    if (ppair_pair->_t_typeinfofirst._t_style == _TYPE_INVALID ||
        ppair_pair->_t_typeinfosecond._t_style == _TYPE_INVALID) {
        return false;
    }

    ppair_pair->_pv_first = NULL;
    ppair_pair->_pv_second = NULL;

    /* this two members are only used for map key and value compare. */
    ppair_pair->_bfun_mapkeycompare = NULL;
    ppair_pair->_bfun_mapvaluecompare = NULL;

    return true;
}
예제 #10
0
void test__type_get_type_pair__null_typename(void** state)
{
    _typeinfo_t t_first;
    _typeinfo_t t_second;
    expect_assert_failure(_type_get_type_pair(&t_first, &t_second, NULL));
}
예제 #11
0
void test__type_get_type_pair__null_second(void** state)
{
    _typeinfo_t t_info;
    expect_assert_failure(_type_get_type_pair(&t_info, NULL, "int,int"));
}
예제 #12
0
void test__type_get_type_pair__null_first(void** state)
{
    _typeinfo_t t_info;
    expect_assert_failure(_type_get_type_pair(NULL, &t_info, "int,int"));
}