当前位置: 首页>>代码示例>>C++>>正文


C++ CU_ASSERT_PTR_NOT_NULL函数代码示例

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


在下文中一共展示了CU_ASSERT_PTR_NOT_NULL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test_func_syslog

static void test_func_syslog(void)
{
	struct filter_context_t ctx;
	struct property_list_t properties;
	struct message_t msg_in;
	struct message_t msg_out;

	const char SCRIPT[] =
		"function filter(mout, min)\n"
		"	syslog(LOG_NOTICE, 'executing filter: testing syslog')\n"
		"	return FILTER_DISCARD\n"
		"end\n"
		"\n"
		;

	memset(&msg_in, 0, sizeof(msg_in));
	memset(&msg_out, 0, sizeof(msg_out));

	CU_ASSERT_PTR_NOT_NULL(filter);
	CU_ASSERT_PTR_NOT_NULL(filter->init);
	CU_ASSERT_PTR_NOT_NULL(filter->func);
	CU_ASSERT_PTR_NOT_NULL(filter->exit);

	proplist_init(&properties);
	proplist_set(&properties, "script", tmpfilename);

	prepare_script(SCRIPT);

	CU_ASSERT_EQUAL_FATAL(filter->init(&ctx, &properties), EXIT_SUCCESS);

	CU_ASSERT_EQUAL(filter->func(&msg_out, &msg_in, &ctx, &properties), FILTER_DISCARD);

	CU_ASSERT_EQUAL(filter->exit(&ctx), FILTER_SUCCESS);
	proplist_free(&properties);
}
开发者ID:mariokonrad,项目名称:navd,代码行数:35,代码来源:test_filter_lua.c

示例2: test_existance

static void test_existance(void)
{
	CU_ASSERT_PTR_NOT_NULL(filter);
	CU_ASSERT_PTR_NOT_NULL(filter->init);
	CU_ASSERT_PTR_NOT_NULL(filter->exit);
	CU_ASSERT_PTR_NOT_NULL(filter->func);
}
开发者ID:mariokonrad,项目名称:navd,代码行数:7,代码来源:test_filter_lua.c

示例3: 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,代码来源:cu_list.c

示例4: t_mutable_string_parse_int

void t_mutable_string_parse_int(void) {
	mutable_string_t a;

	CU_ASSERT_PTR_NOT_NULL(
		mutable_string_init_with_value(
			&a, TEST_STR_NUMERIC_1
		)
	);
	CU_ASSERT_EQUAL(
		mutable_string_parse_int(&a),
		123
	);
	CU_ASSERT_EQUAL(
		mutable_string_parse_long(&a),
		123
	);
	CU_ASSERT_EQUAL(
		mutable_string_parse_long_long(&a),
		123
	);
	
	CU_ASSERT_PTR_NOT_NULL(
		mutable_string_assign(
			&a, TEST_STR_NUMERIC_2
		)
	);
	CU_ASSERT_EQUAL(
		mutable_string_parse_double(&a),
		1.23
	);
	mutable_string_free(&a);
}
开发者ID:manchicken,项目名称:libmanchicken,代码行数:32,代码来源:t_mutable_string.c

示例5: 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

示例6: test_existance

static void test_existance(void)
{
	CU_ASSERT_PTR_NOT_NULL(proc);
	CU_ASSERT_PTR_NOT_NULL(proc->init);
	CU_ASSERT_PTR_NOT_NULL(proc->func);
	CU_ASSERT_PTR_NOT_NULL(proc->exit);
}
开发者ID:mariokonrad,项目名称:navd,代码行数:7,代码来源:test_destination_logbook.c

示例7: test_file_path

static void test_file_path() {
	belle_generic_uri_t* source_uri = belle_generic_uri_parse("/index.html");
	char* source_uri_raw = belle_sip_object_to_string(source_uri);
	belle_generic_uri_t* first_uri = belle_generic_uri_parse(source_uri_raw);
	belle_generic_uri_t* uri=BELLE_GENERIC_URI(belle_sip_object_clone(BELLE_SIP_OBJECT(first_uri)));
	belle_sip_free(source_uri_raw);
	belle_sip_object_unref(source_uri);
	belle_sip_object_unref(first_uri);

	CU_ASSERT_PTR_NULL(belle_generic_uri_get_scheme(uri));
	CU_ASSERT_PTR_NULL(belle_generic_uri_get_host(uri));
	CU_ASSERT_STRING_EQUAL(belle_generic_uri_get_path(uri),"/index.html");

	belle_sip_object_unref(uri);

	source_uri = belle_generic_uri_parse("file:///tmp/absolute-file");
	CU_ASSERT_PTR_NOT_NULL(source_uri);
	if (source_uri!=NULL){
		CU_ASSERT_STRING_EQUAL(belle_generic_uri_get_scheme(source_uri),"file");
		CU_ASSERT_PTR_NULL(belle_generic_uri_get_host(source_uri));
		CU_ASSERT_STRING_EQUAL(belle_generic_uri_get_path(source_uri),"/tmp/absolute-file");
		belle_sip_object_unref(source_uri);
	}

	/*this is INVALID*/
	source_uri = belle_generic_uri_parse("file://./relative-file");
	CU_ASSERT_PTR_NOT_NULL(source_uri);

	/* PATH segment always start by / */
	source_uri = belle_generic_uri_parse("./relative-file");
	CU_ASSERT_PTR_NULL(source_uri);
	if (source_uri!=NULL){
		belle_sip_object_unref(source_uri);
	}
}
开发者ID:HackLinux,项目名称:VideoCallVoIP,代码行数:35,代码来源:belle_generic_uri_tester.c

示例8: 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

示例9: __db_result_list_next

db_result_t* __db_result_list_next(void* data, int finish) {
    db_value_set_t* value_set;
    db_result_t* result;

    CU_ASSERT_FATAL(data == &fake_pointer);

    if (finish) {
        return NULL;
    }

    if (__db_result_list_next_count > 2) {
        return NULL;
    }

    CU_ASSERT_PTR_NOT_NULL_FATAL((value_set = db_value_set_new(2)));
    CU_ASSERT(db_value_set_size(value_set) == 2);
    CU_ASSERT_PTR_NOT_NULL(db_value_set_at(value_set, 0));
    CU_ASSERT_PTR_NOT_NULL(db_value_set_at(value_set, 1));
    CU_ASSERT_PTR_NULL(db_value_set_at(value_set, 2));
    CU_ASSERT_PTR_NOT_NULL(db_value_set_get(value_set, 0));
    CU_ASSERT_PTR_NOT_NULL(db_value_set_get(value_set, 1));
    CU_ASSERT_PTR_NULL(db_value_set_get(value_set, 2));

    CU_ASSERT_PTR_NOT_NULL_FATAL((result = db_result_new()));
    CU_ASSERT(!db_result_set_value_set(result, value_set));
    CU_ASSERT(!db_result_not_empty(result));

    __db_result_list_next_count++;

    return result;
}
开发者ID:jelu,项目名称:dbo,代码行数:31,代码来源:test_classes.c

示例10: test_class_db_result_list

void test_class_db_result_list(void) {
    db_result_t* local_result = result;
    db_result_t* local_result2 = result2;

    CU_ASSERT_PTR_NOT_NULL_FATAL((result_list = db_result_list_new()));

    CU_ASSERT_FATAL(!db_result_list_add(result_list, result));
    result = NULL;
    CU_ASSERT_FATAL(!db_result_list_add(result_list, result2));
    result2 = NULL;

    CU_ASSERT(db_result_list_size(result_list) == 2);
    CU_ASSERT(db_result_list_begin(result_list) == local_result);
    CU_ASSERT(db_result_list_next(result_list) == local_result2);

    db_result_list_free(result_list);
    result_list = NULL;
    CU_PASS("db_result_list_free");
    CU_PASS("db_result_free");

    CU_ASSERT_PTR_NOT_NULL_FATAL((result_list = db_result_list_new()));

    CU_ASSERT_FATAL(!db_result_list_set_next(result_list, __db_result_list_next, &fake_pointer, 2));

    CU_ASSERT(db_result_list_size(result_list) == 2);
    CU_ASSERT_PTR_NOT_NULL(db_result_list_begin(result_list));
    CU_ASSERT_PTR_NOT_NULL(db_result_list_next(result_list));

    db_result_list_free(result_list);
    result_list = NULL;
    CU_PASS("db_result_list_free");
    CU_PASS("db_result_free");
}
开发者ID:jelu,项目名称:dbo,代码行数:33,代码来源:test_classes.c

示例11: test_class_db_clause

void test_class_db_clause(void) {
    CU_ASSERT_PTR_NOT_NULL_FATAL((clause = db_clause_new()));

    CU_ASSERT(!db_clause_set_table(clause, "table"));
    CU_ASSERT(!db_clause_set_field(clause, "field"));
    CU_ASSERT(!db_clause_set_type(clause, DB_CLAUSE_NOT_EQUAL));
    CU_ASSERT(!db_clause_set_operator(clause, DB_CLAUSE_OPERATOR_OR));
    CU_ASSERT_PTR_NOT_NULL_FATAL(db_clause_get_value(clause));
    CU_ASSERT(!db_value_from_int32(db_clause_get_value(clause), 1));
    CU_ASSERT(!db_clause_not_empty(clause));

    CU_ASSERT_PTR_NOT_NULL_FATAL(db_clause_table(clause));
    CU_ASSERT(!strcmp(db_clause_table(clause), "table"));
    CU_ASSERT_PTR_NOT_NULL_FATAL(db_clause_field(clause));
    CU_ASSERT(!strcmp(db_clause_field(clause), "field"));
    CU_ASSERT(db_clause_type(clause) == DB_CLAUSE_NOT_EQUAL);
    CU_ASSERT(db_clause_operator(clause) == DB_CLAUSE_OPERATOR_OR);
    CU_ASSERT_PTR_NOT_NULL(db_clause_value(clause));
    CU_ASSERT_PTR_NULL(db_clause_next(clause));

    CU_ASSERT_PTR_NOT_NULL_FATAL((clause2 = db_clause_new()));

    CU_ASSERT(!db_clause_set_type(clause2, DB_CLAUSE_NESTED));
    CU_ASSERT(!db_clause_set_operator(clause2, DB_CLAUSE_OPERATOR_OR));
    CU_ASSERT(!db_clause_set_list(clause2, (db_clause_list_t*)&fake_pointer));
    CU_ASSERT(!db_clause_not_empty(clause2));

    CU_ASSERT(db_clause_type(clause2) == DB_CLAUSE_NESTED);
    CU_ASSERT(db_clause_operator(clause2) == DB_CLAUSE_OPERATOR_OR);
    CU_ASSERT(db_clause_list(clause2) == (db_clause_list_t*)&fake_pointer);
    CU_ASSERT_PTR_NOT_NULL(db_clause_value(clause2));
}
开发者ID:jelu,项目名称:dbo,代码行数:32,代码来源:test_classes.c

示例12: test_class_db_backend_meta_data_list

void test_class_db_backend_meta_data_list(void) {
    db_backend_meta_data_t* local_backend_meta_data = backend_meta_data;
    db_backend_meta_data_t* local_backend_meta_data2 = backend_meta_data2;
    db_backend_meta_data_t* local_backend_meta_data3 = backend_meta_data3;
    db_backend_meta_data_t* local_backend_meta_data4 = backend_meta_data4;

    CU_ASSERT_PTR_NOT_NULL_FATAL((backend_meta_data_list = db_backend_meta_data_list_new()));
    CU_ASSERT_FATAL(!db_backend_meta_data_list_add(backend_meta_data_list, backend_meta_data));
    backend_meta_data = NULL;
    CU_ASSERT_FATAL(!db_backend_meta_data_list_add(backend_meta_data_list, backend_meta_data2));
    backend_meta_data2 = NULL;
    CU_ASSERT(db_backend_meta_data_list_find(backend_meta_data_list, "name1") == local_backend_meta_data);
    CU_ASSERT(db_backend_meta_data_list_find(backend_meta_data_list, "name2") == local_backend_meta_data2);

    CU_ASSERT_PTR_NOT_NULL_FATAL((backend_meta_data_list2 = db_backend_meta_data_list_new()));
    CU_ASSERT_FATAL(!db_backend_meta_data_list_copy(backend_meta_data_list2, backend_meta_data_list));
    CU_ASSERT_PTR_NOT_NULL(db_backend_meta_data_list_find(backend_meta_data_list2, "name1"));
    CU_ASSERT_PTR_NOT_NULL(db_backend_meta_data_list_find(backend_meta_data_list2, "name2"));
    db_backend_meta_data_list_free(backend_meta_data_list2);
    backend_meta_data_list2 = NULL;
    CU_PASS("db_backend_meta_data_list_free");

    CU_ASSERT_PTR_NOT_NULL_FATAL((backend_meta_data_list2 = db_backend_meta_data_list_new()));
    CU_ASSERT_FATAL(!db_backend_meta_data_list_add(backend_meta_data_list2, backend_meta_data3));
    backend_meta_data3 = NULL;
    CU_ASSERT_FATAL(!db_backend_meta_data_list_add(backend_meta_data_list2, backend_meta_data4));
    backend_meta_data4 = NULL;
    CU_ASSERT(db_backend_meta_data_list_find(backend_meta_data_list2, "name3") == local_backend_meta_data3);
    CU_ASSERT(db_backend_meta_data_list_find(backend_meta_data_list2, "name4") == local_backend_meta_data4);
}
开发者ID:jelu,项目名称:dbo,代码行数:30,代码来源:test_classes.c

示例13: testItemMove

static void testItemMove (void)
{
	Inventory inv;
	const objDef_t* od;
	const invDef_t* container, *containerTo;
	Item* addedItem;

	ResetInventoryList();

	od = INVSH_GetItemByIDSilent("assault");
	CU_ASSERT_PTR_NOT_NULL(od);

	container = INVSH_GetInventoryDefinitionByID("right");
	CU_ASSERT_PTR_NOT_NULL(container);

	Item item(od);

	CU_ASSERT(inv.containsItem(container->id, &item) == false);

	addedItem = i.addToInventory(&inv, &item, container, NONE, NONE, 1);
	CU_ASSERT_PTR_NOT_NULL(addedItem);

	CU_ASSERT(inv.containsItem(container->id, &item) == true);

	containerTo = INVSH_GetInventoryDefinitionByID("backpack");
	CU_ASSERT_PTR_NOT_NULL(containerTo);

	CU_ASSERT_EQUAL(IA_MOVE, i.moveInInventory(&inv, container, addedItem, containerTo, NONE, NONE, nullptr, nullptr));

	CU_ASSERT(inv.containsItem(container->id, &item) == false);
	CU_ASSERT(inv.containsItem(containerTo->id, &item) == true);
}
开发者ID:cigo,项目名称:ufoai,代码行数:32,代码来源:test_inventory.cpp

示例14: testItemDel

static void testItemDel (void)
{
	Inventory inv;
	const objDef_t* od;
	const invDef_t* container;
	Item* addedItem;

	ResetInventoryList();

	od = INVSH_GetItemByIDSilent("assault");
	CU_ASSERT_PTR_NOT_NULL(od);

	container = INVSH_GetInventoryDefinitionByID("right");
	CU_ASSERT_PTR_NOT_NULL(container);

	Item item(od);

	CU_ASSERT(inv.containsItem(container->id, &item) == false);

	addedItem = i.addToInventory(&inv, &item, container, NONE, NONE, 1);

	CU_ASSERT(inv.containsItem(container->id, &item) == true);

	CU_ASSERT(i.removeFromInventory(&inv, container, addedItem));

	CU_ASSERT(inv.containsItem(container->id, &item) == false);
}
开发者ID:cigo,项目名称:ufoai,代码行数:27,代码来源:test_inventory.cpp

示例15: test_create_new_program_with_broken_fragment_shader

static void test_create_new_program_with_broken_fragment_shader(void)
{
	char *vertexShader = pgTestsCreateAssetPath("test_01.vsh");
	char *fragmentShader = pgTestsCreateAssetPath("test_02_broken.fsh");
	PGProgram program = NULL;
	
	PGResult result = pgProgramCreateAndBuild(&program, vertexShader, fragmentShader);
	
	CU_ASSERT_EQUAL(result, PGR_CouldNotCompileShader);
	
	CU_ASSERT_NOT_EQUAL(pgProgramVertexShader(program), 0);
	CU_ASSERT_EQUAL(pgProgramFragmentShader(program), 0);
	CU_ASSERT_EQUAL(pgProgramGlHandle(program), 0);
	
	CU_ASSERT_PTR_NOT_NULL(pgProgramVertexShaderCompileLog(program));
	CU_ASSERT_PTR_NOT_NULL(pgProgramFragmentShaderCompileLog(program));
	CU_ASSERT_PTR_NOT_NULL(pgProgramLinkLog(program));
	
	CU_ASSERT_EQUAL(strlen(pgProgramVertexShaderCompileLog(program)), 0);
	CU_ASSERT_NOT_EQUAL(strlen(pgProgramFragmentShaderCompileLog(program)), 0);
	CU_ASSERT_EQUAL(strlen(pgProgramLinkLog(program)), 0);
	
	pgProgramDestroy(&program);
	
	CU_ASSERT_PTR_NULL(program);
	
	free(vertexShader);
	free(fragmentShader);
}
开发者ID:mnem,项目名称:pictogram,代码行数:29,代码来源:PGProgramCompiler.c


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