void test__create_deque_auxiliary__unregisted_type(void** state) { deque_t* pdeq = malloc(sizeof(deque_t)); assert_false(_create_deque_auxiliary(pdeq, "_test__create_deque_auxiliary__unregisted_type_t")); free(pdeq); }
void test__create_deque_auxiliary__null_typename(void** state) { deque_t* pdeq = malloc(sizeof(deque_t)); expect_assert_failure(_create_deque_auxiliary(pdeq, NULL)); free(pdeq); }
void test__create_deque_auxiliary__libcstl_builtin(void** state) { deque_t* pdeq = malloc(sizeof(deque_t)); assert_true(_create_deque_auxiliary(pdeq, "deque_t< vector_t < string_t>> ")); assert_true(strcmp(_GET_DEQUE_TYPE_NAME(pdeq), "deque_t<vector_t<string_t>>") == 0); assert_true(_alloc_is_inited(&pdeq->_t_allocator)); assert_true(_deque_is_created(pdeq)); deque_destroy(pdeq); }
/* deque_t */ void _type_init_deque(const void* cpv_input, void* pv_output) { bool_t b_result = false; assert(cpv_input != NULL && pv_output != NULL); b_result = _create_deque_auxiliary((deque_t*)cpv_input, (char*)pv_output); assert(b_result); /* initialize deque_t */ deque_init((deque_t*)cpv_input); }
void test__create_deque_auxiliary__user_defined_dup(void** state) { deque_t* pdeq = NULL; type_duplicate(struct _tag_test__create_deque_auxiliary__user_defined, _test__create_deque_auxiliary__user_defined_t); pdeq = malloc(sizeof(deque_t)); assert_true(_create_deque_auxiliary(pdeq, "_test__create_deque_auxiliary__user_defined_t")); assert_true(strcmp(_GET_DEQUE_TYPE_NAME(pdeq), "_test__create_deque_auxiliary__user_defined_t") == 0); assert_true(_alloc_is_inited(&pdeq->_t_allocator)); assert_true(_deque_is_created(pdeq)); deque_destroy(pdeq); }
/** * 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 }
void test__create_deque_auxiliary__null_deque_container(void** state) { expect_assert_failure(_create_deque_auxiliary(NULL, "int")); }