本文整理汇总了C++中CU_ASSERT_PTR_EQUAL函数的典型用法代码示例。如果您正苦于以下问题:C++ CU_ASSERT_PTR_EQUAL函数的具体用法?C++ CU_ASSERT_PTR_EQUAL怎么用?C++ CU_ASSERT_PTR_EQUAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CU_ASSERT_PTR_EQUAL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_next_nonEmptyList
void test_next_nonEmptyList(void) {
list_t* lista = list_init();
addElement(lista, (void*)a);
addElement(lista, (void*)b);
addElement(lista, (void*)c);
iterator_t* i=iterator_init(lista);
payload_t * corrente = next(i);
CU_ASSERT_PTR_NOT_NULL(corrente);
CU_ASSERT_PTR_EQUAL(corrente, lista->head->payload);
corrente = next(i);
CU_ASSERT_PTR_NOT_NULL(corrente);
CU_ASSERT_PTR_EQUAL(corrente, lista->head->next->payload);
corrente = next(i);
CU_ASSERT_PTR_NOT_NULL(corrente);
CU_ASSERT_PTR_EQUAL(corrente, lista->tail->payload);
corrente = next(i);
CU_ASSERT_PTR_NULL(corrente);
iterator_destroy(i);
list_destroy(lista);
}
示例2: test_pl_create_delete
void test_pl_create_delete(void) {
int rc;
pooled_list *pl = NULL;
rc = pl_create(&pl, sizeof(my_message_t), ELEM_COUNT_DEFAULT);
/* make sure object creation successful before proceeding */
CU_ASSERT_EQUAL_FATAL(rc, PL_SUCCESS);
CU_ASSERT_PTR_NOT_NULL_FATAL(pl);
/* Check all default internal values */
CU_ASSERT((int)pl->elem_size == (int)sizeof(my_message_t));
CU_ASSERT(pl->elem_count == ELEM_COUNT_DEFAULT);
CU_ASSERT(pl->count_free == ELEM_COUNT_DEFAULT);
CU_ASSERT(pl->count_total == ELEM_COUNT_DEFAULT);
CU_ASSERT(pl->count_current == 0);
/* Check address node list */
CU_ASSERT_PTR_NOT_NULL(pl->addr_list); /* address node exists */
CU_ASSERT_PTR_NULL(pl->addr_list->next); /* no second node */
CU_ASSERT_PTR_NOT_NULL(pl->addr_list->addr); /* memory block allocated */
CU_ASSERT_PTR_EQUAL(pl->active_memblock, pl->addr_list); /*active blk set*/
/* check datablock pointers */
CU_ASSERT_PTR_NULL(pl->head); /* head pointer unset */
CU_ASSERT_PTR_NULL(pl->tail); /* tail pointer unset */
CU_ASSERT_PTR_EQUAL(pl->next_free, pl->addr_list->addr); /* next_free set */
destroy_pl_object(&pl);
}
示例3: t_sendqueue9
void t_sendqueue9(void)
{
coap_queue_t *tmp_node;
struct coap_context_t ctx;
/* Initialize a fake context that points to our global sendqueue
* Note that all changes happen on ctx.sendqueue. */
ctx.sendqueue = sendqueue;
tmp_node = coap_peek_next(&ctx);
sendqueue = ctx.sendqueue; /* must update global sendqueue for correct result */
CU_ASSERT_PTR_NOT_NULL(tmp_node);
CU_ASSERT_PTR_EQUAL(tmp_node, node[1]);
CU_ASSERT_PTR_EQUAL(tmp_node, ctx.sendqueue);
tmp_node = coap_pop_next(&ctx);
sendqueue = ctx.sendqueue; /* must update global sendqueue for correct result */
CU_ASSERT_PTR_NOT_NULL(tmp_node);
CU_ASSERT_PTR_EQUAL(tmp_node, node[1]);
CU_ASSERT_PTR_NOT_NULL(sendqueue);
CU_ASSERT_PTR_EQUAL(sendqueue, node[2]);
CU_ASSERT(tmp_node->t == timestamp[1]);
CU_ASSERT(sendqueue->t == timestamp[2]);
CU_ASSERT_PTR_NULL(sendqueue->next);
}
示例4: bi_list_test_remove
void bi_list_test_remove(void)
{
TBiList list;
TBiElement head;
TBiElement element;
TBiElement tail;
bi_list_ctor(&list);
bi_element_ctor(&head);
bi_element_ctor(&element);
bi_element_ctor(&tail);
bi_list_push_back(&list, &head);
bi_list_push_back(&list, &element);
bi_list_push_back(&list, &tail);
bi_list_remove(&list, &element);
/* check if head is predecessor of tail */
CU_ASSERT_PTR_EQUAL(&head, tail.prev);
/* check if tail is successor of head */
CU_ASSERT_PTR_EQUAL(&tail, head.next);
}
示例5: bi_list_test_push_back_next
void bi_list_test_push_back_next(void)
{
TBiList list;
TBiElement head;
TBiElement next;
bi_list_ctor(&list);
bi_element_ctor(&head);
bi_element_ctor(&next);
bi_list_push_back(&list, &head);
TBiElement* oldTail = list.tail;
bi_list_push_back(&list, &next);
/* check if list is not empty */
CU_ASSERT_EQUAL(0, bi_list_empty(&list));
/* check if next is a new tail of the list */
CU_ASSERT_PTR_EQUAL(&next, list.tail);
/* check if on the list are more than one element */
CU_ASSERT_PTR_NOT_EQUAL(list.head, list.tail);
/* check if oldTail is the predecessor of next */
CU_ASSERT_PTR_EQUAL(oldTail, next.prev);
/* check if next is a successor of the oldTail */
CU_ASSERT_PTR_EQUAL(&next, oldTail->next);
}
示例6: bi_list_test_pop_front_head
void bi_list_test_pop_front_head(void)
{
TBiList list;
TBiElement head;
TBiElement tail;
bi_list_ctor(&list);
bi_element_ctor(&head);
bi_element_ctor(&tail);
bi_list_push_front(&list, &head);
bi_list_push_front(&list, &tail);
TBiElement* old_head = list.head;
TBiElement* old_head_next = old_head->next;
TBiElement* front = bi_list_pop_front(&list);
/* check if front is not 0 */
CU_ASSERT_PTR_NOT_EQUAL(0, front);
/* check if front is the old_head */
CU_ASSERT_PTR_EQUAL(front, old_head);
/* check if new head is the successor of the old_head */
CU_ASSERT_PTR_EQUAL(old_head_next, list.head);
}
示例7: bi_list_test_insert
void bi_list_test_insert(void)
{
TBiList list;
TBiElement head;
TBiElement tail;
TBiElement element;
bi_list_ctor(&list);
bi_element_ctor(&head);
bi_element_ctor(&tail);
bi_element_ctor(&element);
bi_list_push_back(&list, &head);
bi_list_push_back(&list, &tail);
bi_list_insert(&list, &head, &element);
/* check if element is successor of head */
CU_ASSERT_PTR_EQUAL(head.next, &element);
/* check if head is predecessor of element */
CU_ASSERT_PTR_EQUAL(&head, element.prev);
/* check if element is predecessor of tail */
CU_ASSERT_PTR_EQUAL(tail.prev, &element);
/* check if tail is successor of element */
CU_ASSERT_PTR_EQUAL(&tail, element.next);
}
示例8: bi_list_test_pop_back_tail
void bi_list_test_pop_back_tail(void)
{
TBiList list;
TBiElement head;
TBiElement tail;
bi_list_ctor(&list);
bi_element_ctor(&head);
bi_element_ctor(&tail);
bi_list_push_back(&list, &head);
bi_list_push_back(&list, &tail);
TBiElement* old_tail = list.tail;
TBiElement* old_tail_prev = old_tail->prev;
TBiElement* back = bi_list_pop_back(&list);
/* check if back is not 0 */
CU_ASSERT_PTR_NOT_EQUAL(0, back);
/* check if back is the old_tail */
CU_ASSERT_PTR_EQUAL(back, old_tail);
/* check if new tail is the predecessor of the old_tail */
CU_ASSERT_PTR_EQUAL(old_tail_prev, list.tail);
}
示例9: bi_list_test_push_front_next
void bi_list_test_push_front_next(void)
{
TBiList list;
TBiElement head;
TBiElement next;
bi_list_ctor(&list);
bi_element_ctor(&head);
bi_element_ctor(&next);
bi_list_push_front(&list, &head);
TBiElement* old_head = list.head;
bi_list_push_front(&list, &next);
/* check if list is not empty */
CU_ASSERT_EQUAL(0, bi_list_empty(&list));
/* check if next is a new head of the list */
CU_ASSERT_PTR_EQUAL(&next, list.head);
/* check if on the list are more than one element */
CU_ASSERT_PTR_NOT_EQUAL(list.head, list.tail);
/* check if old_head is the successor of next */
CU_ASSERT_PTR_EQUAL(old_head, next.next);
/* check if next is a predecessor of the old_head */
CU_ASSERT_PTR_EQUAL(&next, old_head->prev);
}
示例10: t_sendqueue4
/* insert new node as fourth element in queue */
void t_sendqueue4(void)
{
int result;
result = coap_insert_node(&sendqueue, node[4]);
CU_ASSERT(result > 0);
CU_ASSERT_PTR_EQUAL(sendqueue, node[3]);
CU_ASSERT_PTR_NOT_NULL(sendqueue->next);
CU_ASSERT_PTR_EQUAL(sendqueue->next, node[1]);
CU_ASSERT_PTR_NOT_NULL(sendqueue->next->next);
CU_ASSERT_PTR_EQUAL(sendqueue->next->next, node[4]);
CU_ASSERT_PTR_NOT_NULL(sendqueue->next->next->next);
CU_ASSERT_PTR_EQUAL(sendqueue->next->next->next, node[2]);
CU_ASSERT(sendqueue->next->t == timestamp[1] - timestamp[3]);
CU_ASSERT(add_timestamps(sendqueue, 1) == timestamp[3]);
CU_ASSERT(add_timestamps(sendqueue, 2) == timestamp[1]);
CU_ASSERT(add_timestamps(sendqueue, 3) == timestamp[4]);
CU_ASSERT(add_timestamps(sendqueue, 4) == timestamp[2]);
}
示例11: test_layout_locate
PRIVATE void
test_layout_locate(void)
{
const struct flash_layout *l = &__test_layout;
struct flash_loc loc = {0xFF};
CU_ASSERT_EQUAL( flash_layout__locate(l, 0, &loc), E_GOOD );
CU_ASSERT_EQUAL( loc.abs, 0 );
CU_ASSERT_EQUAL( loc.c, 0 );
CU_ASSERT_EQUAL( loc.s, 0 );
CU_ASSERT_EQUAL( loc.p, 0 );
CU_ASSERT_EQUAL( loc.o, 0 );
CU_ASSERT_PTR_EQUAL(loc.ly, l);
CU_ASSERT_EQUAL( flash_layout__locate(l, 4, &loc), E_GOOD );
CU_ASSERT_EQUAL( loc.c, 0 );
CU_ASSERT_EQUAL( loc.s, 0 );
CU_ASSERT_EQUAL( loc.p, 0 );
CU_ASSERT_EQUAL( loc.o, 4 );
CU_ASSERT_PTR_EQUAL(loc.ly, l);
CU_ASSERT_EQUAL( flash_layout__locate(l, 0x020405, &loc), E_GOOD);
CU_ASSERT_EQUAL( loc.abs, 0x020405 );
CU_ASSERT_EQUAL( loc.c, 0 );
CU_ASSERT_EQUAL( loc.s, 2 );
CU_ASSERT_EQUAL( loc.p, 4 );
CU_ASSERT_EQUAL( loc.o, 5 );
CU_ASSERT_PTR_EQUAL(loc.ly, l);
CU_ASSERT_NOT_EQUAL( flash_layout__locate(l, 0x01000000, &loc), E_GOOD );
}
示例12: test_dequeue_back
void
test_dequeue_back() {
Dequeue *dequeue = createDequeue();
int value1 = 1;
int value2 = 2;
int value3 = 3;
dequeue = enqueueBackDequeue(dequeue, &value1);
dequeue = enqueueBackDequeue(dequeue, &value2);
dequeue = enqueueBackDequeue(dequeue, &value3);
CU_ASSERT_EQUAL(3, sizeDequeue(dequeue));
int *position3 = (int *)dequeueBackDequeue(dequeue);
int *position2 = (int *)dequeueBackDequeue(dequeue);
int *position1 = (int *)dequeueBackDequeue(dequeue);
CU_ASSERT_EQUAL(0, sizeDequeue(dequeue));
printf("\nPosition%d (back): %d\n", 3, *position3);
printf("\nPosition%d (back): %d\n", 2, *position2);
printf("\nPosition%d (back): %d\n", 1, *position1);
CU_ASSERT_PTR_EQUAL(position3, &value3);
CU_ASSERT_PTR_EQUAL(position2, &value2);
CU_ASSERT_PTR_EQUAL(position1, &value1);
}
示例13: test_queue
static void test_queue(void)
{
struct ofp_ifqueue ifq;
struct ifq_entry e;
ifq.ifq_tail = NULL;
ifq.ifq_len = 0;
e.next = NULL;
odp_packet_t m = odp_packet_alloc(ofp_packet_pool, 0);
IF_ENQUEUE(&ifq, m) while (0);
CU_ASSERT_PTR_NOT_NULL(ifq.ifq_head);
CU_ASSERT_PTR_EQUAL(ifq.ifq_head, ifq.ifq_tail);
CU_ASSERT_PTR_NULL(ifq.ifq_tail->next);
CU_ASSERT_EQUAL(ifq.ifq_len, 1);
ifq.ifq_head = ifq.ifq_tail = &e;
IF_ENQUEUE(&ifq, m) while (0);
CU_ASSERT_PTR_NOT_NULL(ifq.ifq_head);
CU_ASSERT_PTR_NOT_NULL(ifq.ifq_tail);
CU_ASSERT_PTR_NOT_EQUAL(ifq.ifq_head, ifq.ifq_tail);
CU_ASSERT_PTR_EQUAL(ifq.ifq_head->next, ifq.ifq_tail);
CU_ASSERT_PTR_NULL(ifq.ifq_tail->next);
CU_ASSERT_EQUAL(ifq.ifq_len, 2);
odp_packet_free(m);
}
示例14: case_cmd_expireat_invalid_param
void case_cmd_expireat_invalid_param()
{
answer_t *ans;
CU_ASSERT_EQUAL(kv_init(NULL), ERR_NONE);
ans = kv_ask("expireat", strlen("expireat"));
CU_ASSERT_EQUAL(ans->errnum, ERR_ARGUMENTS);
CU_ASSERT_PTR_EQUAL(answer_value_to_string(answer_first_value(ans)), NULL);
answer_release(ans);
ans = kv_ask("expireat key", strlen("expireat key"));
CU_ASSERT_EQUAL(ans->errnum, ERR_ARGUMENTS);
CU_ASSERT_PTR_EQUAL(answer_value_to_string(answer_first_value(ans)), NULL);
answer_release(ans);
ans = kv_ask("expireat key 10 20", strlen("expireat key 10 20"));
CU_ASSERT_EQUAL(ans->errnum, ERR_ARGUMENTS);
CU_ASSERT_PTR_EQUAL(answer_value_to_string(answer_first_value(ans)), NULL);
answer_release(ans);
ans = kv_ask("expireat key 123456789012345678901234567890", strlen("expireat key 123456789012345678901234567890"));
CU_ASSERT_EQUAL(ans->errnum, ERR_VALUE);
CU_ASSERT_PTR_EQUAL(answer_value_to_string(answer_first_value(ans)), NULL);
answer_release(ans);
kv_uninit();
}
示例15: ASSERT_LIST_EQUAL2
void ASSERT_LIST_EQUAL2(list_t *list, void *exp1, void *exp2) {
CU_ASSERT_PTR_NOT_NULL(list->tail);
CU_ASSERT_PTR_NOT_NULL(list->head);
CU_ASSERT_PTR_EQUAL(list->head->payload,exp1);
CU_ASSERT_PTR_EQUAL(list->tail->payload,exp2);
CU_ASSERT_PTR_EQUAL(list->tail, list->head->next);
CU_ASSERT_PTR_NULL(list->tail->next);
}