本文整理汇总了C++中CU_ASSERT_PTR_EQUAL函数的典型用法代码示例。如果您正苦于以下问题:C++ CU_ASSERT_PTR_EQUAL函数的具体用法?C++ CU_ASSERT_PTR_EQUAL怎么用?C++ CU_ASSERT_PTR_EQUAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CU_ASSERT_PTR_EQUAL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:andijcr,项目名称:tsar_lib,代码行数:26,代码来源:testList.c
示例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);
}
开发者ID:somebloke,项目名称:flame-libmboard,代码行数:31,代码来源:test_pl_create.c
示例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);
}
开发者ID:EmuxEvans,项目名称:iotivity,代码行数:29,代码来源:test_sendqueue.c
示例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);
}
开发者ID:norethel,项目名称:BiList,代码行数:25,代码来源:bi_list_test.c
示例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);
}
开发者ID:norethel,项目名称:BiList,代码行数:27,代码来源:bi_list_test.c
示例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);
}
开发者ID:norethel,项目名称:BiList,代码行数:25,代码来源:bi_list_test.c
示例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);
}
开发者ID:norethel,项目名称:BiList,代码行数:27,代码来源:bi_list_test.c
示例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);
}
开发者ID:norethel,项目名称:BiList,代码行数:25,代码来源:bi_list_test.c
示例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);
}
开发者ID:norethel,项目名称:BiList,代码行数:27,代码来源:bi_list_test.c
示例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]);
}
开发者ID:EmuxEvans,项目名称:iotivity,代码行数:26,代码来源:test_sendqueue.c
示例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 );
}
开发者ID:FlexCOS,项目名称:code,代码行数:31,代码来源:suite_flash_layout.c
示例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);
}
开发者ID:CJPoll,项目名称:data_structures,代码行数:28,代码来源:dequeue_test.c
示例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);
}
开发者ID:biddyweb,项目名称:ofp,代码行数:29,代码来源:ofp_test_port_conf.c
示例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();
}
开发者ID:jianzi123,项目名称:my_libucmq,代码行数:27,代码来源:ut_expireat.c
示例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);
}
开发者ID:andijcr,项目名称:tsar_lib,代码行数:8,代码来源:testList.c
示例16: test_phalcon_cpy_wrt
void test_phalcon_cpy_wrt(void)
{
startup_php(__func__);
zend_first_try {
zval* dest;
zval* src;
PHALCON_MM_GROW();
/* dest is not observed by Phalcon */
MAKE_STD_ZVAL(dest);
ZVAL_STRING(dest, "R^itaM cha svAdhyAyapravachane cha", 1);
PHALCON_INIT_VAR(src);
ZVAL_STRING(src, "satyaM cha svAdhyAyapravachane cha", 1);
PHALCON_CPY_WRT(dest, src);
CU_ASSERT_PTR_EQUAL(dest, src);
CU_ASSERT_EQUAL(Z_REFCOUNT_P(src), 2);
CU_ASSERT_EQUAL(Z_TYPE_P(src), IS_STRING);
PHALCON_MM_RESTORE();
CU_ASSERT_EQUAL(_mem_block_check(dest, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC), 1);
CU_ASSERT_PTR_EQUAL(dest, src);
CU_ASSERT_EQUAL(Z_REFCOUNT_P(dest), 1);
CU_ASSERT_EQUAL(Z_TYPE_P(src), IS_STRING);
CU_ASSERT_STRING_EQUAL(Z_STRVAL_P(src), "satyaM cha svAdhyAyapravachane cha");
zval_ptr_dtor(&dest);
PHALCON_MM_GROW();
/* dest will be observed by Phalcon */
dest = NULL;
PHALCON_INIT_VAR(src);
ZVAL_STRING(src, "satyaM cha svAdhyAyapravachane cha", 1);
PHALCON_CPY_WRT(dest, src);
CU_ASSERT_PTR_EQUAL(dest, src);
CU_ASSERT_EQUAL(Z_REFCOUNT_P(src), 2);
CU_ASSERT_EQUAL(Z_TYPE_P(src), IS_STRING);
PHALCON_MM_RESTORE();
/* At this point dest will be destroyed */
}
zend_catch {
CU_ASSERT(0);
}
zend_end_try();
shutdown_php();
CU_ASSERT_EQUAL(leaks, 0);
}
开发者ID:ubraz,项目名称:phalcon-kernel-test,代码行数:53,代码来源:test_memory.c
示例17: test_iterator_init_destroy
void test_iterator_init_destroy(void) {
list_t* list = list_init();
iterator_t* i=iterator_init(list);
CU_ASSERT_PTR_NOT_NULL(i);
CU_ASSERT_PTR_EQUAL(i->list, list);
CU_ASSERT_PTR_EQUAL(i->currentNode, list->head);
iterator_destroy(i);
list_destroy(list);
}
开发者ID:andijcr,项目名称:tsar_lib,代码行数:12,代码来源:testList.c
示例18: test_helper_strdup
static void test_helper_strdup() {
// Check for only one strdup. helper_strdup is only needed as long as strdup is not defined anyway.
CU_ASSERT_PTR_EQUAL(strdup, helper_strdup);
char* str = "a test string";
char* got = helper_strdup(str);
CU_ASSERT_STRING_EQUAL(str, got);
CU_ASSERT_PTR_NOT_EQUAL(str, got);
free(got);
// Test returning NULL
CU_ASSERT_PTR_EQUAL(helper_strdup(NULL), NULL);
}
开发者ID:ghuntley,项目名称:axel,代码行数:13,代码来源:test_helper.c
示例19: t_sendqueue2
void t_sendqueue2(void)
{
int result;
result = coap_insert_node(&sendqueue, node[2]);
CU_ASSERT(result > 0);
CU_ASSERT_PTR_EQUAL(sendqueue, node[1]);
CU_ASSERT_PTR_EQUAL(sendqueue->next, node[2]);
CU_ASSERT(sendqueue->t == timestamp[1]);
CU_ASSERT(node[2]->t == timestamp[2] - timestamp[1]);
}
开发者ID:EmuxEvans,项目名称:iotivity,代码行数:13,代码来源:test_sendqueue.c
示例20: test_q_dequeue
static void test_q_dequeue(void)
{
Queue* q = q_new();
int first;
int status = q_enqueue(q, &first);
int second;
status = q_enqueue(q, &second);
CU_ASSERT_PTR_EQUAL(q_dequeue(q), &first);
CU_ASSERT_EQUAL(q_size(q), 1);
CU_ASSERT_PTR_EQUAL(q_dequeue(q), &second);
CU_ASSERT_EQUAL(q_size(q), 0);
q_free(q);
}
开发者ID:Unidata,项目名称:LDM,代码行数:13,代码来源:queue_test.c
注:本文中的CU_ASSERT_PTR_EQUAL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论