TEST_C(DequeTests, DequeCapacity) { DequeConf conf; deque_conf_init(&conf); conf.capacity = 2; Deque *deque; deque_new_conf(&conf, &deque); CHECK_EQUAL_C_INT(2, deque_capacity(deque)); int a = 1; int b = 2; int c = 3; deque_add(deque, &a); deque_add(deque, &b); deque_add(deque, &c); CHECK_EQUAL_C_INT(4, deque_capacity(deque)); }
/** * Creates a new empty deque and returns a status code. * * @param[out] out Pointer to where the newly created Deque is to be stored * * @return CC_OK if the creation was successful, or CC_ERR_ALLOC if the * memory allocation for the new Deque structure failed. */ enum cc_stat deque_new(Deque **deque) { DequeConf conf; deque_conf_init(&conf); return deque_new_conf(&conf, deque); }
/** * Returns a new empty deque, or NULL if the allocation fails. * * @return a new deque if the allocation was successful, or NULL if it was not. */ Deque *deque_new() { DequeConf conf; deque_conf_init(&conf); return deque_new_conf(&conf); }
/** * Initializes the fields of the QueueConf struct to default values. * * @param[in, out] conf the configuration struct that is being initialized */ void queue_conf_init(QueueConf *conf) { deque_conf_init(conf); }