예제 #1
0
void test__create_list_auxiliary__unregisted_type(void** state)
{
    list_t* plist = malloc(sizeof(list_t));
    assert_false(_create_list_auxiliary(plist, "_test__create_list_auxiliary__unregisted_type_t"));

    free(plist);
}
예제 #2
0
void test__create_list_auxiliary__null_typename(void** state)
{
    list_t* plist = malloc(sizeof(list_t));
    expect_assert_failure(_create_list_auxiliary(plist, NULL));

    free(plist);
}
예제 #3
0
void test__create_list_auxiliary__libcstl_builtin(void** state)
{
    list_t* plist = malloc(sizeof(list_t));
    assert_true(_create_list_auxiliary(plist, "list_t<   vector_t     <     string_t>>       "));
    assert_true(strcmp(_GET_LIST_TYPE_NAME(plist), "list_t<vector_t<string_t>>") == 0);
    assert_true(_alloc_is_inited(&plist->_t_allocator));

    list_destroy(plist);
}
예제 #4
0
/* list_t */
void _type_init_list(const void* cpv_input, void* pv_output)
{
    bool_t b_result = false;
    assert(cpv_input != NULL && pv_output != NULL);

    b_result = _create_list_auxiliary((list_t*)cpv_input, (char*)pv_output);
    assert(b_result);
    /* initialize list_t */
    list_init((list_t*)cpv_input);
}
예제 #5
0
void test__create_list_auxiliary__user_defined_dup(void** state)
{
    list_t* plist = NULL;
    type_duplicate(struct _tag_test__create_list_auxiliary__user_defined, _test__create_list_auxiliary__user_defined_t);
    plist = malloc(sizeof(list_t));
    assert_true(_create_list_auxiliary(plist, "_test__create_list_auxiliary__user_defined_t"));
    assert_true(strcmp(_GET_LIST_TYPE_NAME(plist), "_test__create_list_auxiliary__user_defined_t") == 0);
    assert_true(_alloc_is_inited(&plist->_t_allocator));

    list_destroy(plist);
}
예제 #6
0
/**
 * Create stack container auxiliary function.
 */
bool_t _create_stack_auxiliary(stack_t* psk_stack, const char* s_typename)
{
    assert(psk_stack != NULL);
    assert(s_typename != NULL);

#if defined (CSTL_STACK_VECTOR_SEQUENCE)
    return _create_vector_auxiliary(&psk_stack->_t_sequence, s_typename);
#elif defined (CSTL_STACK_LIST_SEQUENCE)
    return _create_list_auxiliary(&psk_stack->_t_sequence, s_typename);
#else
    return _create_deque_auxiliary(&psk_stack->_t_sequence, s_typename);
#endif
}
예제 #7
0
void test__create_list_auxiliary__null_list_container(void** state)
{
    expect_assert_failure(_create_list_auxiliary(NULL, "int"));
}