您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CU_ASSERT_PTR_EQUAL函数代码示例

51自学网 2021-06-01 20:07:28
  C++
这篇教程C++ CU_ASSERT_PTR_EQUAL函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CU_ASSERT_PTR_EQUAL函数的典型用法代码示例。如果您正苦于以下问题:C++ CU_ASSERT_PTR_EQUAL函数的具体用法?C++ CU_ASSERT_PTR_EQUAL怎么用?C++ CU_ASSERT_PTR_EQUAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CU_ASSERT_PTR_EQUAL函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例11: test_layout_locate

PRIVATE voidtest_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,


示例12: test_dequeue_back

voidtest_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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例21: test_loc_sector_end

PRIVATE voidtest_loc_sector_end(void){	const struct flash_layout *l = &__test_layout;	struct flash_loc loc= {0};	struct flash_loc s;		loc.ly = l;	loc.abs = 0x302010;	loc.s   = 0x30;	loc.p   = 0x20;	loc.o   = 0x10;	CU_ASSERT_EQUAL( flash_loc__sector_end(&loc, &s), E_GOOD );	CU_ASSERT_EQUAL( loc.s, s.s );	CU_ASSERT_EQUAL( s.p, 0xFF );	CU_ASSERT_EQUAL( s.o, 0xFF );	CU_ASSERT_EQUAL( s.abs, 0x30FFFF );	CU_ASSERT_PTR_EQUAL( loc.ly, s.ly );		loc.abs = 0xF0FFFF;	loc.s   = 0xF0;	loc.p   = 0xFF;	loc.o   = 0xFF;	CU_ASSERT_EQUAL( flash_loc__sector_end(&loc, &s), E_GOOD );	CU_ASSERT_EQUAL( loc.abs, s.abs );	CU_ASSERT_EQUAL( s.s, 0xF0 );	CU_ASSERT_EQUAL( s.p, 0xFF );	CU_ASSERT_EQUAL( s.o, 0xFF );	loc.s = 0x100;	CU_ASSERT_NOT_EQUAL( flash_loc__sector_end(&loc, &s), E_GOOD );}
开发者ID:FlexCOS,项目名称:code,代码行数:32,


示例22: test_free_block_reallouable

void test_free_block_reallouable() {	void* ptr = mymalloc(4);	myfree(ptr);	void* ptr2= mymalloc(4);	CU_ASSERT_PTR_EQUAL(ptr, ptr2);	myfree(ptr2);}
开发者ID:CelineDknp,项目名称:Projet1-C,代码行数:7,


示例23: ASSERT_BUFFER_EQUALS

//Buffer e array hanno la stessa dimensionevoid ASSERT_BUFFER_EQUALS(buffer_t* buffer, msg_t* messages[]) {    int i;    for(i=0; i<buffer->size; i++) {        CU_ASSERT_PTR_EQUAL(buffer->queue[buffer->T].content,messages[i]->content);        buffer->T=(buffer->T+1)%(buffer->size);    }}
开发者ID:danielev86,项目名称:ThreadCConcurrentProgram,代码行数:8,


示例24: test_pointer_function_registry

void test_pointer_function_registry(){  function_registry* fr = pointer_function_registry();  int* tester = (int*)&fr;  /* start the tests */  printf("Test pointer_function_registry: ");  CU_ASSERT_TRUE(!strcmp(fr->name, "pointer"));  /* test the copy function */  void** cpy = (void**)fr->copy(&tester);  CU_ASSERT_PTR_EQUAL(*cpy, tester);  /* test to be sure that it is actually a copy */  tester = (int*)&tester;  CU_ASSERT_PTR_NOT_EQUAL(*cpy, tester);  /* free memory */  fr->destroy(cpy);  free(fr);  /* finish the test */  test_failure();  printf("/n");}
开发者ID:Triangled,项目名称:fossology,代码行数:25,


示例25: test_find_file

void test_find_file(void){	FILENODE *node;	FILENODE *keeper_node;	GtkTreeIter iter;	GtkTreeIter keeper_iter;	init_file_list();	node = append_file("file1", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node);	node = append_file("file2", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node);	node = append_file("file3", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node);	node = append_file("file4", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node);	keeper_node = append_file("file5", "schema", "table", "geom_column", "-1", 'c', &keeper_iter);	CU_ASSERT_PTR_NOT_NULL(node);	node = append_file("file6", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node);	node = append_file("file7", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node);	node = append_file("file8", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node);	node = find_file_by_iter(&keeper_iter);	CU_ASSERT_PTR_NOT_NULL(node);	CU_ASSERT_PTR_EQUAL(node, keeper_node);	destroy_file_list();}
开发者ID:bnordgren,项目名称:postgis,代码行数:35,


示例26: test_traversal

void test_traversal(void){	FILENODE *node[5];	FILENODE *current_node;	GtkTreeIter iter;	int i = 0;	init_file_list();	node[0] = append_file("file1", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node[0]);	node[1] = append_file("file2", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node[1]);	node[2] = append_file("file3", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node[2]);	node[3] = append_file("file4", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node[3]);	node[4] = append_file("file5", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node[4]);	current_node = get_next_node(NULL);	CU_ASSERT_PTR_NOT_NULL(current_node);	while (current_node != NULL)	{		CU_ASSERT_NOT_EQUAL(i, 5);		CU_ASSERT_PTR_EQUAL(current_node, node[i]);		current_node = get_next_node(current_node);		i++;	}}
开发者ID:bnordgren,项目名称:postgis,代码行数:29,


示例27: testNewSpecBin

void testNewSpecBin(void){    char *error = NULL;    union {        uint16_t num;        char bytes[2];    } n16;    n16.num = 5;    n16.num = bswap16(n16.num);    union {        uint32_t num;        char bytes[4];    } n32;    n32.num = 5;    n32.num = bswap32(n32.num);    char buf[] = {'/x93', /* 10010011 */        '/xc4', (uint8_t)5, 'H', 'e', 'l', 'l', 'o',        '/xc5', n16.bytes[0], n16.bytes[1], 'H', 'e', 'l', 'l', 'o',        '/xc6', n32.bytes[0], n32.bytes[1], n32.bytes[2], n32.bytes[3],                                                    'H', 'e', 'l', 'l', 'o',    };    size_t n = sizeof(buf);    CU_ASSERT_EQUAL(msgpackclen_buf_read (buf, n, &error), n);    CU_ASSERT_PTR_EQUAL(error, NULL);    if (error)        free(error);}
开发者ID:orofarne,项目名称:msgpack-c-len,代码行数:34,


示例28: test_find_index

void test_find_index(void){	FILENODE *node[5];	FILENODE *current_node;	GtkTreeIter iter;	int index[11] = {4, 3, 2, 1, 0, 3, 2, 4, 0, 1, 1};	int i = 0;	init_file_list();	node[0] = append_file("file1", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node[0]);	node[1] = append_file("file2", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node[1]);	node[2] = append_file("file3", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node[2]);	node[3] = append_file("file4", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node[3]);	node[4] = append_file("file5", "schema", "table", "geom_column", "-1", 'c', &iter);	CU_ASSERT_PTR_NOT_NULL(node[4]);	for (i = 0; i < 11; i++)	{		current_node = find_file_by_index(index[i]);		CU_ASSERT_PTR_EQUAL(node[index[i]], current_node);	}	destroy_file_list();}
开发者ID:bnordgren,项目名称:postgis,代码行数:29,


示例29: test_pop

void test_pop(void) {	Stack s = NULL;	Stack scomp;	char* a = "sdfghjklm";	char* b = "azerty";	char* res;	S_push(&s, a);	scomp = s;	S_push(&s, b);	res = (char*)S_pop(&s);	CU_ASSERT_STRING_EQUAL(res, b);	CU_ASSERT_PTR_EQUAL(s, scomp);	res = (char*)S_pop(&s);	CU_ASSERT_STRING_EQUAL(res, a);	CU_ASSERT_PTR_EQUAL(s, NULL);}
开发者ID:npmiller,项目名称:comp,代码行数:16,


示例30: case_cmd_expireat_stress

void case_cmd_expireat_stress(){        int i;        answer_t *ans;        static char buf[10000+128];                kv_uninit();        kv_init(NULL);        ans = kv_ask("set key value", strlen("set key value"));        CU_ASSERT_EQUAL(ans->errnum, ERR_NONE);        answer_release(ans);                for (i = 10000; i >= 1; i--) {                snprintf(buf, sizeof(buf), "expireat key %ld", time(NULL) + i);                ans = kv_ask(buf, strlen(buf));                CU_ASSERT_STRING_EQUAL(answer_value_to_string(answer_first_value(ans)), "1");                answer_release(ans);        }        ans = kv_ask("get key", strlen("get key"));        CU_ASSERT_EQUAL(ans->errnum, ERR_NONE);        CU_ASSERT_STRING_EQUAL(answer_value_to_string(answer_first_value(ans)), "value");        answer_release(ans);        sleep(2);        ans = kv_ask("get key", strlen("get key"));        CU_ASSERT_EQUAL(ans->errnum, ERR_NIL);        CU_ASSERT_PTR_EQUAL(answer_value_to_string(answer_first_value(ans)), NULL);        answer_release(ans);                kv_uninit();        CU_ASSERT_EQUAL(kv_get_used_memory(), 0);}
开发者ID:jianzi123,项目名称:my_libucmq,代码行数:33,



注:本文中的CU_ASSERT_PTR_EQUAL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CU_ASSERT_PTR_NOT_NULL函数代码示例
C++ CU_ASSERT_FATAL函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。