本文整理汇总了C++中CU_ASSERT_PTR_NULL函数的典型用法代码示例。如果您正苦于以下问题:C++ CU_ASSERT_PTR_NULL函数的具体用法?C++ CU_ASSERT_PTR_NULL怎么用?C++ CU_ASSERT_PTR_NULL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CU_ASSERT_PTR_NULL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_mb_p_iter_create_filtered
/* Test MB_Iterator_CreateFiltered */
void test_mb_p_iter_create_filtered(void) {
int rc;
MBIt_Board *board;
MBIt_Iterator *iterator;
filter_params fp;
fp.lb = TEST_FILTER_LB;
fp.ub = TEST_FILTER_UB;
/* Try invalid mboard */
mb_f = 99999999;
rc = MB_Iterator_CreateFiltered(mb_f, &itr_f, &my_filter, &fp);
CU_ASSERT_EQUAL(rc, MB_ERR_INVALID);
CU_ASSERT_EQUAL(itr_f, MB_NULL_ITERATOR);
/* Try NULL mboard */
mb_f = MB_NULL_MBOARD;
rc = MB_Iterator_CreateFiltered(mb_f, &itr_f, &my_filter, &fp);
CU_ASSERT_EQUAL(rc, MB_ERR_INVALID);
CU_ASSERT_EQUAL(itr_f, MB_NULL_ITERATOR);
/* Populate mboard. Abort on failure */
rc = init_mb_with_content(&mb_f);
CU_ASSERT_EQUAL_FATAL(rc, MB_SUCCESS);
/* Try locked board */
board = (MBIt_Board *)MBI_getMBoardRef(mb_f);
CU_ASSERT_PTR_NOT_NULL_FATAL(board);
board->locked = MB_TRUE;
rc = MB_Iterator_CreateFiltered(mb_f, &itr_f, &my_filter, &fp);
CU_ASSERT_EQUAL(rc, MB_ERR_LOCKED);
CU_ASSERT_EQUAL(itr_f, MB_NULL_ITERATOR);
board->locked = MB_FALSE;
/* Try on "unreadable" boards */
board->is_reader = MB_FALSE;
rc = MB_Iterator_Create(mb_f, &itr_f);
CU_ASSERT_EQUAL(rc, MB_ERR_DISABLED);
CU_ASSERT_EQUAL(itr_f, MB_NULL_ITERATOR);
board->is_reader = MB_TRUE;
/* Create sorted Iterator */
itr_f = MB_NULL_ITERATOR;
rc = MB_Iterator_CreateFiltered(mb_f, &itr_f, &my_filter, &fp);
CU_ASSERT_EQUAL(rc, MB_SUCCESS);
CU_ASSERT_NOT_EQUAL(itr_f, MB_NULL_ITERATOR);
board = (MBIt_Board *)MBI_getMBoardRef(mb_f);
iterator = (MBIt_Iterator *)MBI_getIteratorRef(itr_f);
CU_ASSERT_PTR_NOT_NULL_FATAL(board);
CU_ASSERT_PTR_NOT_NULL_FATAL(iterator);
CU_ASSERT_EQUAL(board->data->elem_size, iterator->msgsize);
CU_ASSERT_EQUAL(iterator->iterating, 0);
CU_ASSERT_PTR_NULL(iterator->cursor);
CU_ASSERT_EQUAL(iterator->mb, mb_f);
}
开发者ID:somebloke,项目名称:flame-libmboard,代码行数:58,代码来源:test_mb_p_iterator_createfiltered.c
示例2: test_strpart_2
void test_strpart_2()
{
const char tmp[] = "x";
const char *res;
res = strpart(tmp, NULL);
CU_ASSERT_PTR_NULL(res);
}
开发者ID:takeneco,项目名称:uniqos,代码行数:9,代码来源:cmdparse_ut.c
示例3: test_success_with_entity
static void test_success_with_entity(void)
{
char* data = malloc(32);
struct result* result = 0;
sprintf(data, "some entity data");
result = success_result((void*)data, &free_data, 0, 0);
CU_ASSERT_PTR_NOT_NULL_FATAL(result);
CU_ASSERT_PTR_NULL(result->error);
CU_ASSERT_PTR_EQUAL(result->data, data);
CU_ASSERT_PTR_EQUAL(result->free_data, &free_data);
CU_ASSERT_PTR_NULL(result->location);
free_result(result);
free(data);
}
开发者ID:tps12,项目名称:tripping-sansa,代码行数:18,代码来源:test_result.c
示例4: s_test_create_tree_fail
void s_test_create_tree_fail(void){
int sizeOfElement = sizeof(int);
Tree tree = new_tree(sizeOfElement, NULL, NULL, NULL, NULL);
CU_ASSERT_PTR_NULL(tree);
if (tree != NULL) {
destroy_tree(&tree);
}
}
开发者ID:Tw1stedL0gic,项目名称:IOOPM-jojoca,代码行数:9,代码来源:treeTest.c
示例5: test_string_n_split_is_empty
static void test_string_n_split_is_empty() {
char* line = "";
char** substrings = string_n_split(line, 10, ";");
CU_ASSERT_PTR_NOT_NULL(substrings);
CU_ASSERT_PTR_NULL(substrings[0]);
free(substrings);
}
开发者ID:nnico15m,项目名称:so-commons-library,代码行数:9,代码来源:test_string.c
示例6: test_pop_stack_empty
void
test_pop_stack_empty() {
stack *stack = stackCreate();
int *poppedValue = (int*)stackPop(stack);
CU_ASSERT_EQUAL(stack -> size, 0);
CU_ASSERT_PTR_NULL(poppedValue);
}
开发者ID:CJPoll,项目名称:data_structures,代码行数:9,代码来源:stack_tests.c
示例7: test_peek_stack_empty
void
test_peek_stack_empty() {
stack *stack = stackCreate();
int *position1 = stackPeek(stack);
CU_ASSERT_EQUAL(stack -> size, 0);
CU_ASSERT_PTR_NULL(position1);
}
开发者ID:CJPoll,项目名称:data_structures,代码行数:9,代码来源:stack_tests.c
示例8: test_tt_getcount_col
/* test test_tt_getcount_col() */
void test_tt_getcount_col(void) {
int i, j, rc;
int count = 999;
int rows = 10;
int cols = rows * 8;
tag_table *tt = NULL;
char octet1 = (char)0x00;
char octet2 = (char)0xff;
/* create the tt object */
rc = tt_create(&tt, rows, cols);
CU_ASSERT_EQUAL_FATAL(rc, TT_SUCCESS);
CU_ASSERT_PTR_NOT_NULL_FATAL(tt);
/* check count for newly created table */
for (i = 0; i < cols; i++)
{
rc = tt_getcount_col(tt, i, &count);
if (rc != TT_SUCCESS) CU_FAIL("tt_getcount() returned with an error");
if (count != 0) CU_FAIL("count != 0");
}
/* systematically set various bits within the table */
for (i = 0; i < rows; i++)
{
for (j = 0; j < (int)tt->row_size; j++)
{
if (i % 2 == 0)
{
rc = tt_setbyte(tt, i, j, octet1);
if (rc != TT_SUCCESS) CU_FAIL("tt_setbits() returned an error code");
}
else
{
rc = tt_setbyte(tt, i, j, octet2);
if (rc != TT_SUCCESS) CU_FAIL("tt_setbits() returned an error code");
}
}
}
/* recheck count for table */
for (i = 0; i < cols; i++)
{
rc = tt_getcount_col(tt, i, &count);
if (rc != TT_SUCCESS) CU_FAIL("tt_getcount() returned with an error");
if (count != (rows / 2)) CU_FAIL("count != rows/2");
}
/* destroy tt object */
rc = tt_delete(&tt);
CU_ASSERT_EQUAL(rc, TT_SUCCESS);
CU_ASSERT_PTR_NULL(tt);
}
开发者ID:somebloke,项目名称:flame-libmboard,代码行数:58,代码来源:test_tt_getcount_col.c
示例9: test_strpart_1
void test_strpart_1()
{
const char tmp[] = "x";
const char *res;
res = strpart(NULL, tmp);
CU_ASSERT_PTR_NULL(res);
}
开发者ID:takeneco,项目名称:uniqos,代码行数:9,代码来源:cmdparse_ut.c
示例10: test_avl_insert_withptr
/* we expect _getnode() to have been tested before this test is called */
void test_avl_insert_withptr(void) {
int i, errcount;
int *data;
int testvals[TEST_AVL_TREESIZE];
MBIt_AVLtree *tree = NULL;
MBIt_AVLnode *node = NULL;
/* create tree */
tree = MBI_AVLtree_create();
CU_ASSERT_PTR_NOT_NULL_FATAL(tree);
CU_ASSERT_EQUAL(tree->count, 0);
CU_ASSERT_PTR_NULL(tree->root);
/* it shouldn't matter if we do get duplicate values in the tree */
for (i = 0; i < TEST_AVL_TREESIZE; i++)
{
testvals[i] = i * 10; /* remember values used */
MBI_AVLtree_insert(tree, i, &testvals[i]);
}
/* use getnode to retrieve node pointer and inspect key value */
errcount = 0;
for (i = 0; i < TEST_AVL_TREESIZE; i++)
{
node = MBI_AVLtree_getnode(tree, i);
if (node == NULL)
{
errcount += 1;
continue;
}
if (node->key != i) errcount += 1;
if (node->data == NULL) {errcount += 1; continue;}
data = (int*)node->data;
if (*data != (i * 10)) errcount += 1;
}
CU_ASSERT_EQUAL(errcount, 0);
/* destroy tree */
MBI_AVLtree_destroy(&tree);
CU_ASSERT_PTR_NULL(tree);
}
开发者ID:somebloke,项目名称:flame-libmboard,代码行数:45,代码来源:test_avl_insert.c
示例11: simple_log_test
void simple_log_test(void)
{
struct commit* commit_list = NULL;
int retval;
retval = beargit_init();
CU_ASSERT(0==retval);
FILE* asdf = fopen("asdf.txt", "w");
fclose(asdf);
retval = beargit_add("asdf.txt");
CU_ASSERT(0==retval);
run_commit(&commit_list, "GO BEARS!1");
run_commit(&commit_list, "GO BEARS!2");
run_commit(&commit_list, "GO BEARS!3");
retval = beargit_log(INT_MAX);
CU_ASSERT(0==retval);
struct commit* cur_commit = commit_list;
const int LINE_SIZE = 512;
char line[LINE_SIZE];
FILE* fstdout = fopen("TEST_STDOUT", "r");
CU_ASSERT_PTR_NOT_NULL(fstdout);
while (cur_commit != NULL) {
char refline[LINE_SIZE];
// First line is empty
CU_ASSERT_PTR_NOT_NULL(fgets(line, LINE_SIZE, fstdout));
CU_ASSERT(!strcmp(line,"\n"));
// Second line is commit -- don't check the ID.
CU_ASSERT_PTR_NOT_NULL(fgets(line, LINE_SIZE, fstdout));
CU_ASSERT(!strncmp(line,"commit", strlen("commit")));
// Third line is msg
sprintf(refline, " %s\n", cur_commit->msg);
CU_ASSERT_PTR_NOT_NULL(fgets(line, LINE_SIZE, fstdout));
CU_ASSERT_STRING_EQUAL(line, refline);
cur_commit = cur_commit->next;
}
// Last line is empty
CU_ASSERT_PTR_NOT_NULL(fgets(line, LINE_SIZE, fstdout));
CU_ASSERT(!strcmp(line,"\n"));
CU_ASSERT_PTR_NULL(fgets(line, LINE_SIZE, fstdout));
// It's the end of output
CU_ASSERT(feof(fstdout));
fclose(fstdout);
free_commit_list(&commit_list);
}
开发者ID:StephenFang,项目名称:Berkeley-version-of-Git,代码行数:56,代码来源:cunittests.c
示例12: test_strpart_5
void test_strpart_5()
{
const char tmp1[] = "abcdefg";
const char tmp2[] = "abc";
const char *res;
res = strpart(tmp1, tmp2);
CU_ASSERT_PTR_NULL(res);
}
开发者ID:takeneco,项目名称:uniqos,代码行数:10,代码来源:cmdparse_ut.c
示例13: test_Destory
void test_Destory(void) {
Status status = ERROR;
GENERALIZED_LIST_TYPE list = getGeneralizedList("(1,2,3,4)");
if (list == NULL)
return;
status = Destory(&list);
CU_ASSERT_EQUAL(status, OK);
CU_ASSERT_PTR_NULL(list);
}
开发者ID:yuandong1222,项目名称:DataStructureInC,代码行数:10,代码来源:generalized_list_test.c
示例14: test_avl_memberof
void test_avl_memberof(void) {
int i, errcount, v;
int testvals[TEST_AVL_TREESIZE];
MBIt_AVLtree *tree = NULL;
tree = MBI_AVLtree_create();
CU_ASSERT_PTR_NOT_NULL_FATAL(tree);
CU_ASSERT_EQUAL(tree->count, 0);
CU_ASSERT_PTR_NULL(tree->root);
/* get list of unique random ints */
generate_random_unique_ints(testvals, TEST_AVL_TREESIZE);
/* add nodes */
for (i = 0; i < TEST_AVL_TREESIZE; i++)
{
MBI_AVLtree_insert(tree, testvals[i], NULL);
}
check_tree_integrity(tree);
/* try checking with 2 * TEST_AVL_TREESIZE random values */
errcount = 0;
for (i = 0; i < TEST_AVL_TREESIZE * 2; i++)
{
v = rand();
if (_in_array(testvals, TEST_AVL_TREESIZE, v) !=
MBI_AVLtree_memberof(tree, v)) errcount++;
}
CU_ASSERT_EQUAL(errcount, 0);
/* check againts all actual values */
for (i = 0; i < TEST_AVL_TREESIZE; i++)
{
v = testvals[i];
if (! MBI_AVLtree_memberof(tree, v)) errcount++;
}
CU_ASSERT_EQUAL(errcount, 0);
MBI_AVLtree_destroy(&tree);
CU_ASSERT_PTR_NULL(tree);
}
开发者ID:somebloke,项目名称:flame-libmboard,代码行数:43,代码来源:test_avl_memberof.c
示例15: test_string_n_split_when_separator_isnt_included
static void test_string_n_split_when_separator_isnt_included() {
char *line = "Hola planeta tierra";
char ** substrings = string_n_split(line, 5, ";");
CU_ASSERT_PTR_NOT_NULL(substrings);
CU_ASSERT_STRING_EQUAL(substrings[0], line);
CU_ASSERT_PTR_NULL(substrings[1]);
string_iterate_lines(substrings, (void *) free);
free(substrings);
}
开发者ID:nnico15m,项目名称:so-commons-library,代码行数:11,代码来源:test_string.c
示例16: ms_tester_create_filters
void ms_tester_create_filters(unsigned int filter_mask) {
MSSndCardManager *manager;
MSSndCard *playcard;
MSSndCard *captcard;
CREATE_FILTER(FILTER_MASK_FILEPLAY, ms_tester_fileplay, MS_FILE_PLAYER_ID);
CREATE_FILTER(FILTER_MASK_FILEREC, ms_tester_filerec, MS_FILE_REC_ID);
CREATE_FILTER(FILTER_MASK_DTMFGEN, ms_tester_dtmfgen, MS_DTMF_GEN_ID);
CREATE_FILTER(FILTER_MASK_TONEDET, ms_tester_tonedet, MS_TONE_DETECTOR_ID);
CREATE_FILTER(FILTER_MASK_VOIDSOURCE, ms_tester_voidsource, MS_VOID_SOURCE_ID);
CREATE_FILTER(FILTER_MASK_VOIDSINK, ms_tester_voidsink, MS_VOID_SINK_ID);
if (filter_mask & FILTER_MASK_ENCODER) {
CU_ASSERT_PTR_NULL(ms_tester_encoder);
ms_tester_encoder = ms_filter_create_encoder(ms_tester_codec_mime);
CU_ASSERT_PTR_NOT_NULL_FATAL(ms_tester_encoder);
}
if (filter_mask & FILTER_MASK_DECODER) {
CU_ASSERT_PTR_NULL(ms_tester_decoder);
ms_tester_decoder = ms_filter_create_decoder(ms_tester_codec_mime);
CU_ASSERT_PTR_NOT_NULL_FATAL(ms_tester_decoder);
}
CREATE_FILTER(FILTER_MASK_RTPRECV, ms_tester_rtprecv, MS_RTP_RECV_ID);
CREATE_FILTER(FILTER_MASK_RTPSEND, ms_tester_rtpsend, MS_RTP_SEND_ID);
CREATE_FILTER(FILTER_MASK_RESAMPLER, ms_tester_resampler, MS_RESAMPLE_ID);
if (filter_mask & FILTER_MASK_SOUNDWRITE) {
CU_ASSERT_PTR_NULL(ms_tester_soundwrite);
manager = ms_snd_card_manager_get();
playcard = ms_snd_card_manager_get_default_playback_card(manager);
CU_ASSERT_PTR_NOT_NULL_FATAL(playcard);
ms_tester_soundwrite = ms_snd_card_create_writer(playcard);
CU_ASSERT_PTR_NOT_NULL_FATAL(ms_tester_soundwrite);
}
if (filter_mask & FILTER_MASK_SOUNDREAD) {
CU_ASSERT_PTR_NULL(ms_tester_soundread);
manager = ms_snd_card_manager_get();
captcard = ms_snd_card_manager_get_default_capture_card(manager);
CU_ASSERT_PTR_NOT_NULL_FATAL(captcard);
ms_tester_soundread = ms_snd_card_create_reader(captcard);
CU_ASSERT_PTR_NOT_NULL_FATAL(ms_tester_soundread);
}
}
开发者ID:brenttsai1148,项目名称:linphone-android,代码行数:41,代码来源:mediastreamer2_tester_private.c
示例17: test_string_n_split_when_n_is_less_than_splitted_elements
static void test_string_n_split_when_n_is_less_than_splitted_elements() {
char *line = "Hola planeta tierra";
char** substrings = string_n_split(line, 2, " ");
CU_ASSERT_PTR_NOT_NULL(substrings);
CU_ASSERT_STRING_EQUAL(substrings[0], "Hola");
CU_ASSERT_STRING_EQUAL(substrings[1], "planeta tierra");
CU_ASSERT_PTR_NULL(substrings[2]);
string_iterate_lines(substrings, (void*) free);
free(substrings);
}
开发者ID:nnico15m,项目名称:so-commons-library,代码行数:12,代码来源:test_string.c
示例18: make_new_list
void test_get_tail
(
void
)
{
uint32_t arr[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
uint32_t i;
list * new_list = make_new_list();
node * cur = get_tail(new_list);
CU_ASSERT_PTR_NOT_NULL(new_list);
CU_ASSERT_PTR_NULL(cur);
for(i = 0; i < 10; i++)
{
add(new_list, &(arr[i]));
}
cur = get_tail(new_list);
CU_ASSERT_PTR_NOT_NULL(cur);
CU_ASSERT_EQUAL(*(uint32_t *)cur->data, arr[9]);
CU_ASSERT_PTR_NULL(cur->next);
CU_ASSERT_PTR_NOT_NULL(cur->prev);
}
开发者ID:Tepman2,项目名称:project_euler,代码行数:21,代码来源:test_list.c
示例19: test_init_list
/**
* init_lsit原型:
* bool init_list(seq_list *s_list, const int element_size)
*
* init_list函数检查说明:
* 1. element_size的有效值是正整数.
* 2. 当element_size输入无效参数时, 返回值为NULL.
*/
static void test_init_list(void)
{
int element_size = 0;
/* case 1: element_size = 0 */
element_size = 0;
ps_list = init_list(element_size);
CU_ASSERT_PTR_NULL(ps_list);
/* case 2: element_size < 0 */
element_size = -1;
ps_list = init_list(element_size);
CU_ASSERT_PTR_NULL(ps_list);
/* case 3: element_size > 0 */
element_size = 1;
ps_list = init_list(element_size);
CU_ASSERT_PTR_NOT_NULL(ps_list);
CU_ASSERT_EQUAL(ps_list->element_size, element_size);
CU_ASSERT_EQUAL(ps_list->length, 0);
}
开发者ID:kxk120,项目名称:data_struct_impl,代码行数:29,代码来源:suite_seq_list.c
示例20: test_find_opcode_new
void test_find_opcode_new(void) {
CSOUND* csound = csoundCreate(NULL);
CU_ASSERT_PTR_NOT_NULL(find_opcode_new(csound, "##error", "i", "i"));
CU_ASSERT_PTR_NULL(find_opcode_new(csound, "##error", NULL, "i"));
CU_ASSERT_PTR_NOT_NULL(find_opcode_new(csound, "##xin64", "i", NULL));
CU_ASSERT_PTR_NOT_NULL(find_opcode_new(csound, "##xin256", "i", NULL));
CU_ASSERT_PTR_NOT_NULL(find_opcode_new(csound, "##userOpcode", NULL, NULL));
CU_ASSERT_PTR_NOT_NULL(find_opcode_new(csound, "##array_set", NULL, "k[]k"));
CU_ASSERT_PTR_NOT_NULL(find_opcode_new(csound, ">=", "B", "kc"));
}
开发者ID:amitkumar3968,项目名称:csound,代码行数:12,代码来源:csound_orc_semantics_test.c
注:本文中的CU_ASSERT_PTR_NULL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论