TC_ASSERT_EQ("putenv", ret_chk, OK);
psz_getvalue = getenv("PATH");
- TC_ASSERT_NOT_NULL("getenv", psz_getvalue);
+ TC_ASSERT_NEQ("getenv", psz_getvalue, NULL);
TC_ASSERT_EQ("getenv", strcmp(psz_getvalue, "C:"), 0);
/* Changing the value of already existing PATH variable */
}
env_ptr = get_environ_ptr(&env_size);
- TC_ASSERT_NOT_NULL("get_environ_ptr", env_ptr);
+ TC_ASSERT_NEQ("get_environ_ptr", env_ptr, NULL);
/* env_size is set to length of all env name and val pair */
#endif
ret_err = (char *)strerror(ret_chk);
- TC_ASSERT_NOT_NULL("strerror", ret_err);
+ TC_ASSERT_NEQ("strerror", ret_err, NULL);
TC_ASSERT_EQ("strerror", strncmp(ret_err, errstr_arr[err_index - 1], strlen(ret_err)), 0);
#if !defined(CONFIG_BUILD_PROTECTED)
ret_err = (char *)strerror(ret_ptr_chk);
- TC_ASSERT_NOT_NULL("strerror", ret_err);
+ TC_ASSERT_NEQ("strerror", ret_err, NULL);
TC_ASSERT_EQ("strerror", strncmp(ret_err, errstr_arr[err_index - 1], strlen(ret_err)), 0);
#endif
}
pid_t child_pid;
st_tcb = sched_self();
- TC_ASSERT_NOT_NULL("sched_self", st_tcb);
+ TC_ASSERT_NEQ("sched_self", st_tcb, NULL);
group = st_tcb->group;
- TC_ASSERT_NOT_NULL("sched_self", group);
+ TC_ASSERT_NEQ("sched_self", group, NULL);
child = group_allocchild();
- TC_ASSERT_NOT_NULL("group_allocchild", child);
+ TC_ASSERT_NEQ("group_allocchild", child, NULL);
child_pid = -1;
child->ch_flags = TCB_FLAG_TTYPE_TASK;
struct child_status_s child_dummy;
st_tcb = sched_self();
- TC_ASSERT_NOT_NULL("sched_self", st_tcb);
+ TC_ASSERT_NEQ("sched_self", st_tcb, NULL);
group = st_tcb->group;
- TC_ASSERT_NOT_NULL("sched_self", group);
+ TC_ASSERT_NEQ("sched_self", group, NULL);
child = group_allocchild();
- TC_ASSERT_NOT_NULL("group_allocchild", child);
+ TC_ASSERT_NEQ("group_allocchild", child, NULL);
TC_ASSERT_EQ("group_allocchild", child->flink, NULL);
child->flink = &child_dummy;
pid_t child_pid;
st_tcb = sched_self();
- TC_ASSERT_NOT_NULL("sched_self", st_tcb);
+ TC_ASSERT_NEQ("sched_self", st_tcb, NULL);
group = st_tcb->group;
- TC_ASSERT_NOT_NULL("sched_self", group);
+ TC_ASSERT_NEQ("sched_self", group, NULL);
child_pid = task_create("group", SCHED_PRIORITY_DEFAULT, TASK_STACKSIZE, group_exitchild_func, (char *const *)NULL);
child = group_findchild(group, child_pid);
- TC_ASSERT_NOT_NULL("group_findchild", child);
+ TC_ASSERT_NEQ("group_findchild", child, NULL);
sleep(3);
pid_t child_pid;
st_tcb = sched_self();
- TC_ASSERT_NOT_NULL("sched_self", st_tcb);
+ TC_ASSERT_NEQ("sched_self", st_tcb, NULL);
group = st_tcb->group;
- TC_ASSERT_NOT_NULL("sched_self", group);
+ TC_ASSERT_NEQ("sched_self", group, NULL);
child = group_allocchild();
- TC_ASSERT_NOT_NULL("group_allocchild", child);
+ TC_ASSERT_NEQ("group_allocchild", child, NULL);
child_pid = -1;
child->ch_flags = TCB_FLAG_TTYPE_TASK;
ret_chk = posix_spawn_file_actions_addopen(&st_fileactions, 1, szfilepath, O_WRONLY, 0644);
TC_ASSERT_EQ("posix_spawn_file_actions_addopen", ret_chk, OK);
- TC_ASSERT_NOT_NULL("posix_spawn_file_actions_addopen", st_fileactions);
+ TC_ASSERT_NEQ("posix_spawn_file_actions_addopen", st_fileactions, NULL);
ret_chk = posix_spawn_file_actions_destroy(&st_fileactions);
TC_ASSERT_EQ("posix_spawn_file_actions_destroy", ret_chk, OK);
/* Allocate the action list entry of this size */
entry1 = (struct spawn_open_file_action_s *)zalloc(alloc_num);
- TC_ASSERT_NOT_NULL("zalloc", entry1);
+ TC_ASSERT_NEQ("zalloc", entry1, NULL);
/* And add it to the file action list */
add_file_action(st_fileactions, (struct spawn_general_file_action_s *)entry1);
entry2 = (struct spawn_open_file_action_s *)zalloc(alloc_num);
- TC_ASSERT_NOT_NULL("zalloc", entry2);
+ TC_ASSERT_NEQ("zalloc", entry2, NULL);
/* And add it to the file action list */
va_start(args, format);
ret_chk = avsprintf(&buffer, format, args);
va_end(args);
- TC_ASSERT_NOT_NULL("avsprintf", buffer);
+ TC_ASSERT_NEQ("avsprintf", buffer, NULL);
TC_ASSERT_EQ_CLEANUP("avsprintf",
ret_chk, strlen(printable_chars),
TC_FREE_MEMORY(buffer));
ret_chk = asprintf(&buffer, "%s", printable_chars);
- TC_ASSERT_NOT_NULL("asprintf", buffer);
+ TC_ASSERT_NEQ("asprintf", buffer, NULL);
TC_ASSERT_EQ_CLEANUP("asprintf",
ret_chk, strlen(printable_chars),
TC_FREE_MEMORY(buffer));
char *res_ptr = NULL;
res_ptr = (char *)memcpy(sz_dest, sz_src, BUFF_SIZE);
- TC_ASSERT_NOT_NULL("memcpy", res_ptr);
+ TC_ASSERT_NEQ("memcpy", res_ptr, NULL);
TC_ASSERT_EQ("memcpy", strncmp(sz_dest, res_ptr, BUFF_SIZE), 0);
TC_ASSERT_EQ("memcpy", strncmp(sz_dest, sz_src, BUFF_SIZE), 0);
char *res_ptr = NULL;
res_ptr = (char *)memset(buffer, 'a', BUFF_SIZE - 1);
- TC_ASSERT_NOT_NULL("memset", res_ptr);
+ TC_ASSERT_NEQ("memset", res_ptr, NULL);
TC_ASSERT_EQ("memset", strncmp(res_ptr, ctarget, BUFF_SIZE), 0);
TC_ASSERT_EQ("memset", strncmp(ctarget, buffer, BUFF_SIZE), 0);
char *res_ptr = NULL;
res_ptr = (char *)memchr(buffer, 's', BUFF_SIZE);
- TC_ASSERT_NOT_NULL("memchr", res_ptr);
+ TC_ASSERT_NEQ("memchr", res_ptr, NULL);
TC_ASSERT_EQ("memchr", *res_ptr, 's');
TC_SUCCESS_RESULT();
char *res_ptr = NULL;
res_ptr = (char *)memmove(buffer1, buffer2, sizeof(buffer1));
- TC_ASSERT_NOT_NULL("memmove", res_ptr);
+ TC_ASSERT_NEQ("memmove", res_ptr, NULL);
TC_ASSERT_EQ("memmove", strncmp(res_ptr, buffer2, BUFF_SIZE), 0);
TC_ASSERT_EQ("memmove", strncmp(buffer1, buffer2, BUFF_SIZE), 0);
res_ptr = (char *)memmove(buffer2, buffer1, sizeof(buffer1));
- TC_ASSERT_NOT_NULL("memmove", res_ptr);
+ TC_ASSERT_NEQ("memmove", res_ptr, NULL);
TC_ASSERT_EQ("memmove", strncmp(res_ptr, buffer1, BUFF_SIZE), 0);
TC_ASSERT_EQ("memmove", strncmp(buffer2, buffer1, BUFF_SIZE), 0);
char *res_ptr = NULL;
res_ptr = stpcpy(dest_arr, src_buf);
- TC_ASSERT_NOT_NULL("stpcpy", res_ptr);
+ TC_ASSERT_NEQ("stpcpy", res_ptr, NULL);
TC_ASSERT_EQ("stpcpy", *(res_ptr - 1), 'd');
TC_ASSERT_EQ("stpcpy", strncmp(dest_arr, src, BUFF_SIZE), 0);
char *res_ptr = NULL;
res_ptr = strcat(dest_arr, src);
- TC_ASSERT_NOT_NULL("strcat", res_ptr);
+ TC_ASSERT_NEQ("strcat", res_ptr, NULL);
TC_ASSERT_EQ("strcat", strncmp(res_ptr, final_arr, BUFF_SIZE_10), 0);
TC_ASSERT_EQ("strcat", strncmp(dest_arr, final_arr, BUFF_SIZE_10), 0);
TC_ASSERT_EQ("strchr", res_ptr, NULL);
res_ptr = strchr(dest_arr, 's');
- TC_ASSERT_NOT_NULL("strchr", res_ptr);
+ TC_ASSERT_NEQ("strchr", res_ptr, NULL);
TC_ASSERT_EQ("strchr", *res_ptr, 's');
TC_SUCCESS_RESULT();
char *res_ptr = NULL;
res_ptr = strcpy(dest_arr, src);
- TC_ASSERT_NOT_NULL("strcpy", res_ptr);
+ TC_ASSERT_NEQ("strcpy", res_ptr, NULL);
TC_ASSERT_EQ("strcpy", strncmp(res_ptr, src, BUFF_SIZE), 0);
TC_ASSERT_EQ("strcpy", strncmp(dest_arr, src, BUFF_SIZE), 0);
char src[BUFF_SIZE] = "test";
dest_arr = strdup(src);
- TC_ASSERT_NOT_NULL("strdup", dest_arr);
+ TC_ASSERT_NEQ("strdup", dest_arr, NULL);
TC_ASSERT_EQ_CLEANUP("strdup",
strncmp(dest_arr, src, BUFF_SIZE), OK,
TC_FREE_MEMORY(dest_arr));
/* EFAULT is defined as 14 which gives Bad address in strerror */
dest_arr = (char *)strerror(EFAULT);
- TC_ASSERT_NOT_NULL("strerror", dest_arr);
+ TC_ASSERT_NEQ("strerror", dest_arr, NULL);
TC_ASSERT_EQ("strerror", strncmp(dest_arr, src, BUFF_SIZE_12), 0);
TC_SUCCESS_RESULT();
char *res_ptr = NULL;
res_ptr = strncat(dest_arr, src, BUFF_SIZE);
- TC_ASSERT_NOT_NULL("strncat", res_ptr);
+ TC_ASSERT_NEQ("strncat", res_ptr, NULL);
TC_ASSERT_EQ("strncat", strncmp(res_ptr, final_arr, BUFF_SIZE_10), 0);
TC_ASSERT_EQ("strncat", strncmp(dest_arr, final_arr, BUFF_SIZE_10), 0);
char *res_ptr = NULL;
res_ptr = strncpy(dest_arr, src, BUFF_SIZE);
- TC_ASSERT_NOT_NULL("strncpy", res_ptr);
+ TC_ASSERT_NEQ("strncpy", res_ptr, NULL);
TC_ASSERT_EQ("strncpy", strncmp(res_ptr, src, BUFF_SIZE), 0);
TC_ASSERT_EQ("strncpy", strncmp(dest_arr, src, BUFF_SIZE), 0);
char src[BUFF_SIZE] = "test";
dest_arr = strndup(src, BUFF_SIZE);
- TC_ASSERT_NOT_NULL("strndup", dest_arr);
+ TC_ASSERT_NEQ("strndup", dest_arr, NULL);
TC_ASSERT_EQ_CLEANUP("strndup",
strncmp(dest_arr, src, BUFF_SIZE), 0,
TC_FREE_MEMORY(dest_arr));
char *res_ptrstr = "mple";
res_ptr = strpbrk(dest_arr, cbuf);
- TC_ASSERT_NOT_NULL("strpbrk", res_ptr);
+ TC_ASSERT_NEQ("strpbrk", res_ptr, NULL);
TC_ASSERT_EQ("strpbrk", strncmp(res_ptr, res_ptrstr, BUFF_SIZE_10), 0);
TC_ASSERT_EQ("strpbrk", *res_ptr, 'm');
char *res_ptrstr = "es";
res_ptr = strrchr(dest_arr, 'e');
- TC_ASSERT_NOT_NULL("strrchr", res_ptr);
+ TC_ASSERT_NEQ("strrchr", res_ptr, NULL);
TC_ASSERT_EQ("strrchr", strncmp(res_ptr, res_ptrstr, BUFF_SIZE), 0);
TC_ASSERT_EQ("strrchr", *res_ptr, 'e');
char *psz = "str";
res_ptr = strstr(dest_arr, psz);
- TC_ASSERT_NOT_NULL("strstr", res_ptr);
+ TC_ASSERT_NEQ("strstr", res_ptr, NULL);
TC_ASSERT_EQ("strstr", strncmp(res_ptr, dest_arr, BUFF_SIZE_10), 0);
psz = "test";
res_ptr = strstr(dest_arr, psz);
- TC_ASSERT_NOT_NULL("strstr", res_ptr);
+ TC_ASSERT_NEQ("strstr", res_ptr, NULL);
TC_ASSERT_EQ("strstr", strncmp(res_ptr, dest_arr + 4, BUFF_SIZE_10), 0);
psz = "notfound";
psz = "";
res_ptr = strstr(dest_arr, psz);
- TC_ASSERT_NOT_NULL("strstr", res_ptr);
+ TC_ASSERT_NEQ("strstr", res_ptr, NULL);
TC_ASSERT_EQ("strstr", strncmp(res_ptr, dest_arr, BUFF_SIZE_10), 0);
TC_SUCCESS_RESULT();
int arr_idx = 0;
char *res_ptr = NULL;
res_ptr = strtok(szbuffer, " ");
- TC_ASSERT_NOT_NULL("strtok", res_ptr);
+ TC_ASSERT_NEQ("strtok", res_ptr, NULL);
while (res_ptr != NULL) {
TC_ASSERT_EQ("strtok", strncmp(res_ptr, dest_arr[arr_idx], BUFF_SIZE_10), 0);
char *psz_save;
res_ptr = strtok_r(cbuf, " ", &psz_save);
- TC_ASSERT_NOT_NULL("strtok_r", res_ptr);
- TC_ASSERT_NOT_NULL("strtok_r", psz_save);
+ TC_ASSERT_NEQ("strtok_r", res_ptr, NULL);
+ TC_ASSERT_NEQ("strtok_r", psz_save, NULL);
while (res_ptr != NULL) {
TC_ASSERT_EQ("strtok_r", strncmp(res_ptr, dest_arr[arr_idx], BUFF_SIZE_10), 0);
char *psz = "str";
res_ptr = strcasestr(dest_arr, psz);
- TC_ASSERT_NOT_NULL("strcasestr", res_ptr);
+ TC_ASSERT_NEQ("strcasestr", res_ptr, NULL);
TC_ASSERT_EQ("strcasestr", strncmp(res_ptr, dest_arr, BUFF_SIZE_10), 0);
psz = "test";
res_ptr = strcasestr(dest_arr, psz);
- TC_ASSERT_NOT_NULL("strcasestr", res_ptr);
+ TC_ASSERT_NEQ("strcasestr", res_ptr, NULL);
TC_ASSERT_EQ("strcasestr", strncmp(res_ptr, dest_arr + 4, BUFF_SIZE_10), 0);
psz = "notfound";
psz = "";
res_ptr = strcasestr(dest_arr, psz);
- TC_ASSERT_NOT_NULL("strcasestr", res_ptr);
+ TC_ASSERT_NEQ("strcasestr", res_ptr, NULL);
TC_ASSERT_EQ("strcasestr", strncmp(res_ptr, dest_arr, BUFF_SIZE_10), 0);
TC_SUCCESS_RESULT();
memset(some_str, 0, sizeof(some_str));
res_ptr = (char *)memccpy(some_str, test1_src, 'g', strlen(test1_src));
- TC_ASSERT_NOT_NULL("memccpy", res_ptr);
+ TC_ASSERT_NEQ("memccpy", res_ptr, NULL);
TC_ASSERT_EQ("memccpy", strcmp(some_str, test_result), 0);
TC_SUCCESS_RESULT();
/* verifying the structures returned and filled by comparing their parameters */
st_rettime = gmtime_r(&test_time, &st_time);
- TC_ASSERT_NOT_NULL("gmtime_r", st_rettime);
+ TC_ASSERT_NEQ("gmtime_r", st_rettime, NULL);
TC_ASSERT_EQ("gmtime_r", st_rettime->tm_year, st_time.tm_year);
TC_ASSERT_EQ("gmtime_r", st_rettime->tm_mon, st_time.tm_mon);
TC_ASSERT_EQ("gmtime_r", year, st_time.tm_year);
TC_ASSERT_NEQ("time", ret_chk, (time_t)ERROR);
st_rettime = gmtime(&time1);
- TC_ASSERT_NOT_NULL("gmtime", st_rettime);
+ TC_ASSERT_NEQ("gmtime", st_rettime, NULL);
st_localtime = localtime(&time1);
- TC_ASSERT_NOT_NULL("localtime", st_localtime);
+ TC_ASSERT_NEQ("localtime", st_localtime, NULL);
TC_ASSERT_EQ("localtime", st_rettime->tm_year, st_localtime->tm_year);
TC_ASSERT_EQ("localtime", st_rettime->tm_mon, st_localtime->tm_mon);
/* verifying the returned structure's parameter, year should not be negative, month range is 0-11 */
st_rettime = gmtime(&time2);
- TC_ASSERT_NOT_NULL("gmtime", st_rettime);
+ TC_ASSERT_NEQ("gmtime", st_rettime, NULL);
TC_ASSERT_GEQ("gtime", st_rettime->tm_year, 0);
TC_ASSERT_GEQ("gtime", st_rettime->tm_mon, 0);
TC_ASSERT_LT("gtime", st_rettime->tm_mon, 12);
time(&test_time);
st_gmtime = gmtime(&test_time);
- TC_ASSERT_NOT_NULL("gmtime", st_gmtime);
+ TC_ASSERT_NEQ("gmtime", st_gmtime, NULL);
st_rettime = localtime(&test_time);
- TC_ASSERT_NOT_NULL("localtime", st_gmtime);
+ TC_ASSERT_NEQ("localtime", st_gmtime, NULL);
TC_ASSERT_EQ("localtime", st_rettime->tm_year, st_gmtime->tm_year);
TC_ASSERT_EQ("localtime", st_rettime->tm_mon, st_gmtime->tm_mon);
/* verifying the structures "returned and filled" by comparing their parameters */
st_rettime = localtime_r(&test_time, &st_time);
- TC_ASSERT_NOT_NULL("localtime_r", st_rettime);
+ TC_ASSERT_NEQ("localtime_r", st_rettime, NULL);
TC_ASSERT_EQ("localtime_r", st_rettime->tm_year, st_time.tm_year);
TC_ASSERT_EQ("localtime_r", st_rettime->tm_mon, st_time.tm_mon);
TC_ASSERT_EQ("localtime_r", st_gettime.tm_year, st_time.tm_year);
TC_ASSERT_EQ("sched_gettcb", tcb, NULL);
tcb = sched_gettcb(PID_IDLE);
- TC_ASSERT_NOT_NULL("sched_gettcb", tcb);
+ TC_ASSERT_NEQ("sched_gettcb", tcb, NULL);
TC_ASSERT_EQ("sched_gettcb", tcb->pid, PID_IDLE);
TC_SUCCESS_RESULT();
struct tcb_s *st_tcb = NULL;
st_tcb = sched_self();
- TC_ASSERT_NOT_NULL("sched_self", st_tcb);
+ TC_ASSERT_NEQ("sched_self", st_tcb, NULL);
cntlock = st_tcb->lockcount;
/* get process id */
st_tcbpid = sched_self();
- TC_ASSERT_NOT_NULL("sched_self", st_tcbpid);
+ TC_ASSERT_NEQ("sched_self", st_tcbpid, NULL);
/* should return tcb for current process */
st_tcbself = sched_self();
- TC_ASSERT_NOT_NULL("sched_self", st_tcbself);
+ TC_ASSERT_NEQ("sched_self", st_tcbself, NULL);
TC_ASSERT_EQ("sched_self", st_tcbself->pid, st_tcbpid->pid);
TC_SUCCESS_RESULT();
struct tcb_s *st_tcb = NULL;
st_tcb = sched_self();
- TC_ASSERT_NOT_NULL("sched_self", st_tcb);
+ TC_ASSERT_NEQ("sched_self", st_tcb, NULL);
prev_cnt = sched_lockcount();
ret_chk = sched_lock();
struct streamlist *stream;
stream = sched_getstreams();
- TC_ASSERT_NOT_NULL("sched_getstreams", stream);
+ TC_ASSERT_NEQ("sched_getstreams", stream, NULL);
TC_SUCCESS_RESULT();
}
ret_chk = timer_create(clockid, &st_sigevent, &timer_id);
TC_ASSERT_NEQ("timer_create", ret_chk, ERROR);
- TC_ASSERT_NOT_NULL("timer_create", timer_id);
+ TC_ASSERT_NEQ("timer_create", timer_id, NULL);
st_ret_prt = (struct posix_timer_s *)timer_id;
TC_ASSERT_EQ_CLEANUP("timer_create", st_ret_prt->pt_value.sival_ptr, st_sigevent.sigev_value.sival_ptr, timer_delete(timer_id));
st_sigevent.sigev_value.sival_ptr = &timer_id;
ret_chk = timer_create(clockid, &st_sigevent, &timer_id);
TC_ASSERT_NEQ("timer_create", ret_chk, ERROR);
- TC_ASSERT_NOT_NULL("timer_create", timer_id);
+ TC_ASSERT_NEQ("timer_create", timer_id, NULL);
st_timer_spec_set.it_interval.tv_sec = 1;
st_timer_spec_set.it_interval.tv_nsec = 0; /* interval; */
for (alloc_tc_cnt = 0; alloc_tc_cnt < TEST_TIMES; alloc_tc_cnt++) {
for (alloc_cnt = 0; alloc_cnt < ALLOC_FREE_TIMES; alloc_cnt++) {
mem_ptr[alloc_cnt] = (int *)malloc(ALLOC_SIZE_VAL * sizeof(int));
- TC_ASSERT_NOT_NULL("malloc", mem_ptr[alloc_cnt]);
+ TC_ASSERT_NEQ("malloc", mem_ptr[alloc_cnt], NULL);
}
TC_ASSERT_EQ_ERROR_CLEANUP("malloc", st_tcb->curr_alloc_size, TOTAL_ALLOC_SIZE, get_errno(), mem_deallocate_func(mem_ptr, ALLOC_FREE_TIMES));
mem_deallocate_func(mem_ptr, ALLOC_FREE_TIMES);
for (alloc_tc_cnt = 0; alloc_tc_cnt < TEST_TIMES; alloc_tc_cnt++) {
for (alloc_cnt = 0; alloc_cnt < ALLOC_FREE_TIMES; alloc_cnt++) {
mem_ptr[alloc_cnt] = (int *)calloc(ALLOC_SIZE_VAL, sizeof(int));
- TC_ASSERT_NOT_NULL("calloc", mem_ptr[alloc_cnt]);
+ TC_ASSERT_NEQ("calloc", mem_ptr[alloc_cnt], NULL);
}
TC_ASSERT_EQ_ERROR_CLEANUP("calloc", st_tcb->curr_alloc_size, TOTAL_ALLOC_SIZE, get_errno(), mem_deallocate_func(mem_ptr, ALLOC_FREE_TIMES));
for (alloc_tc_cnt = 0; alloc_tc_cnt < TEST_TIMES; alloc_tc_cnt++) {
for (alloc_cnt = 0; alloc_cnt < ALLOC_FREE_TIMES; alloc_cnt++) {
mem_ptr[alloc_cnt] = (int *)realloc(val, ALLOC_SIZE_VAL * sizeof(int));
- TC_ASSERT_NOT_NULL("realloc", mem_ptr[alloc_cnt]);
+ TC_ASSERT_NEQ("realloc", mem_ptr[alloc_cnt], NULL);
}
TC_ASSERT_EQ_ERROR_CLEANUP("realloc", st_tcb->curr_alloc_size, TOTAL_ALLOC_SIZE, get_errno(), mem_deallocate_func(mem_ptr, ALLOC_FREE_TIMES));
mem_deallocate_func(mem_ptr, ALLOC_FREE_TIMES);
for (alloc_tc_cnt = 0; alloc_tc_cnt < TEST_TIMES; alloc_tc_cnt++) {
for (alloc_cnt = 0; alloc_cnt < ALLOC_FREE_TIMES; alloc_cnt++) {
mem_ptr[alloc_cnt] = (int *)memalign(sizeof(int), ALLOC_SIZE_VAL * sizeof(int));
- TC_ASSERT_NOT_NULL("memalign", mem_ptr[alloc_cnt]);
+ TC_ASSERT_NEQ("memalign", mem_ptr[alloc_cnt], NULL);
}
TC_ASSERT_EQ_ERROR_CLEANUP("memalign", st_tcb->curr_alloc_size, TOTAL_ALLOC_SIZE, get_errno(), mem_deallocate_func(mem_ptr, ALLOC_FREE_TIMES));
mem_deallocate_func(mem_ptr, ALLOC_FREE_TIMES);
malloc will be successful and return the pointer of memory.
Else, malloc will be failed and return NULL pointer */
if (info.mxordblk >= MM_ALIGN_UP(allocated[alloc_cnt] + SIZEOF_MM_ALLOCNODE)) {
- TC_ASSERT_NOT_NULL("malloc", mem_ptr[alloc_cnt]);
+ TC_ASSERT_NEQ("malloc", mem_ptr[alloc_cnt], NULL);
} else {
TC_ASSERT_EQ("malloc", mem_ptr[alloc_cnt], NULL);
allocated[alloc_cnt] = 0;
for (alloc_tc_cnt = 0; alloc_tc_cnt < TEST_TIMES; alloc_tc_cnt++) {
mem_ptr = (int *)malloc(sizeof(int));
- TC_ASSERT_NOT_NULL("malloc", mem_ptr);
+ TC_ASSERT_NEQ("malloc", mem_ptr, NULL);
st_mallinfo = mallinfo();
TC_ASSERT_GT_CLEANUP("mallinfo", st_mallinfo.fordblks, 0, TC_FREE_MEMORY(mem_ptr));
int mem_idx;
int *mem_ptr = NULL;
mem_ptr = zalloc(sizeof(int) * 5);
- TC_ASSERT_NOT_NULL("zalloc", mem_ptr);
+ TC_ASSERT_NEQ("zalloc", mem_ptr, NULL);
for (mem_idx = 0; mem_idx < 5; mem_idx++) {
TC_ASSERT_EQ_ERROR_CLEANUP("zalloc", mem_ptr[mem_idx], 0, get_errno(), TC_FREE_MEMORY(mem_ptr));
snprintf(g_query, QUERY_LENGTH, "SELECT %s, %s, %s FROM %s WHERE %s > 5;", g_attribute_set[0], g_attribute_set[1], g_attribute_set[2], RELATION_NAME, g_attribute_set[0]);
g_cursor = db_query(g_query);
- TC_ASSERT_NOT_NULL("db_query", g_cursor);
+ TC_ASSERT_NEQ("db_query", g_cursor, NULL);
ret = db_print_header(g_cursor);
TC_ASSERT_EQ_CLEANUP("db_print_header", DB_ERROR(ret), 0, db_cursor_free(g_cursor));
db_cursor_free(g_cursor);
snprintf(g_query, QUERY_LENGTH, "SELECT %s, %s, %s FROM %s WHERE %s > 5;", g_attribute_set[0], g_attribute_set[1], g_attribute_set[2], RELATION_NAME, g_attribute_set[0]);
#endif
g_cursor = db_query(g_query);
- TC_ASSERT_NOT_NULL("db_query", g_cursor);
+ TC_ASSERT_NEQ("db_query", g_cursor, NULL);
if (DB_SUCCESS(cursor_move_first(g_cursor))) {
do {
{
db_result_t res;
g_cursor = db_query(query);
- TC_ASSERT_NOT_NULL("db_query", g_cursor);
+ TC_ASSERT_NEQ("db_query", g_cursor, NULL);
if (DB_SUCCESS(cursor_move_first(g_cursor))) {
do {
res = db_print_tuple(g_cursor);
snprintf(query, QUERY_LENGTH, "SELECT id, date, fruit, value FROM %s WHERE value < 990;", RELATION_NAME1);
#endif
g_cursor = db_query(query);
- TC_ASSERT_NOT_NULL("db_query", g_cursor);
+ TC_ASSERT_NEQ("db_query", g_cursor, NULL);
res = db_cursor_free(g_cursor);
TC_ASSERT("db_cursor_free", DB_SUCCESS(res));
snprintf(query, QUERY_LENGTH, "SELECT id, date, fruit FROM %s WHERE id > 0;", RELATION_NAME1);
#endif
g_cursor = db_query(query);
- TC_ASSERT_NOT_NULL("db_query", g_cursor);
+ TC_ASSERT_NEQ("db_query", g_cursor, NULL);
TC_SUCCESS_RESULT();
}
snprintf(query, QUERY_LENGTH, "SELECT %s, %s, %s FROM %s WHERE %s > 0;", g_attribute_set[0],
g_attribute_set[1], g_attribute_set[2], RELATION_NAME1, g_attribute_set[0]);
g_cursor = db_query(query);
- TC_ASSERT_NOT_NULL("db_query", g_cursor);
+ TC_ASSERT_NEQ("db_query", g_cursor, NULL);
res = cursor_move_last(g_cursor);
TC_ASSERT("cursor_move_last", DB_SUCCESS(res));
/* Cursor is valid, but it isn't pointing first row */
snprintf(query, QUERY_LENGTH, "SELECT %s, %s, %s FROM %s WHERE %s > 0;", g_attribute_set[0],
g_attribute_set[1], g_attribute_set[2], RELATION_NAME1, g_attribute_set[0]);
g_cursor = db_query(query);
- TC_ASSERT_NOT_NULL("db_query", g_cursor);
+ TC_ASSERT_NEQ("db_query", g_cursor, NULL);
res = cursor_move_first(g_cursor);
TC_ASSERT("cursor_move_first", DB_SUCCESS(res));
/* Cursor is valid, but it isn't pointing last row */
int gpiopin = 12;
int ret;
g_gpio = iotbus_gpio_open(gpiopin);
- TC_ASSERT_NOT_NULL ("iotbus_gpio_open" , g_gpio);
+ TC_ASSERT_NEQ ("iotbus_gpio_open" , g_gpio, NULL);
gpiopin = 14;
g_gpio2 = iotbus_gpio_open(gpiopin);
bool check = true;
gpiopin = 12;
g_gpio = iotbus_gpio_open(gpiopin);
- TC_ASSERT_NOT_NULL("iotbus_gpio_open" , g_gpio);
+ TC_ASSERT_NEQ("iotbus_gpio_open" , g_gpio, NULL);
for (index = 0; index < ncount; index++) {
ret = iotbus_gpio_set_direction(g_gpio, setDirection[index]);
bool check = true;
gpiopin = 12;
g_gpio = iotbus_gpio_open(gpiopin);
- TC_ASSERT_NOT_NULL("iotbus_gpio_open" , g_gpio);
+ TC_ASSERT_NEQ("iotbus_gpio_open" , g_gpio, NULL);
for (index = 0; index < ncount; index++) {
ret = iotbus_gpio_set_edge_mode(g_gpio, setEdge[index]);
bool check = true;
g_gpio = iotbus_gpio_open(gpiopin);
- TC_ASSERT_NOT_NULL("iotbus_gpio_open" , g_gpio);
+ TC_ASSERT_NEQ("iotbus_gpio_open" , g_gpio, NULL);
for (index = 0; index < ncount; index++) {
ret = iotbus_gpio_set_drive_mode(g_gpio, setDrive[index]);
int gpioSetpin = 12;
int gpioGetpin;
iotbus_gpio_context_h m_gpio = iotbus_gpio_open(gpioSetpin);
- TC_ASSERT_NOT_NULL("iotbus_gpio_open" , m_gpio);
+ TC_ASSERT_NEQ("iotbus_gpio_open" , m_gpio, NULL);
gpioGetpin = iotbus_gpio_get_pin(m_gpio);
TC_ASSERT_EQ_CLEANUP("iotbus_gpio_get_pin", gpioGetpin, gpioSetpin, iotbus_gpio_close(m_gpio));
{
int ret, gpiopin = 12;
g_gpio = iotbus_gpio_open(gpiopin);
- TC_ASSERT_NOT_NULL("iotbus_gpio_open" , g_gpio);
+ TC_ASSERT_NEQ("iotbus_gpio_open" , g_gpio, NULL);
ret = iotbus_gpio_read(g_gpio);
TC_ASSERT_EQ_CLEANUP("iotbus_gpio_read", (ret < 0), false, iotbus_gpio_close(g_gpio));
int data = 0, gpio_pin2 = 57, gpio_pin1 = 41;
g_gpio = iotbus_gpio_open(gpio_pin1);
- TC_ASSERT_NOT_NULL ("iotbus_gpio_open" , g_gpio);
+ TC_ASSERT_NEQ ("iotbus_gpio_open" , g_gpio, NULL);
g_gpio2 = iotbus_gpio_open(gpio_pin2);
TC_ASSERT_NEQ_CLEANUP("iotbus_gpio_open", g_gpio2 , NULL , iotbus_gpio_close(g_gpio));
{
int ret = IOTBUS_ERROR_NONE;
iotbus_i2c_context_h h_i2c = iotbus_i2c_init(g_bus);
- TC_ASSERT_NOT_NULL("iotbus_i2c_init", h_i2c);
+ TC_ASSERT_NEQ("iotbus_i2c_init", h_i2c, NULL);
ret = iotbus_i2c_stop(h_i2c);
TC_ASSERT_EQ("iotbus_i2c_stop", ret, IOTBUS_ERROR_NONE);
int numModes = sizeof(szFreqMode) / sizeof(int);
int index = 0;
iotbus_i2c_context_h h_i2c = iotbus_i2c_init(g_bus);
- TC_ASSERT_NOT_NULL("iotbus_i2c_init", h_i2c);
+ TC_ASSERT_NEQ("iotbus_i2c_init", h_i2c, NULL);
for (index = 0; index < numModes; index++) {
ret = iotbus_i2c_set_frequency(h_i2c, szFreqMode[index]);
int ret = IOTBUS_ERROR_NONE;
uint8_t address = 0x08;
iotbus_i2c_context_h h_i2c = iotbus_i2c_init(g_bus);
- TC_ASSERT_NOT_NULL("iotbus_i2c_init", h_i2c);
+ TC_ASSERT_NEQ("iotbus_i2c_init", h_i2c, NULL);
ret = iotbus_i2c_set_address(h_i2c, address);
TC_ASSERT_EQ_CLEANUP("iotbus_i2c_set_address", ret, IOTBUS_ERROR_NONE, iotbus_i2c_stop(h_i2c));
uint8_t szCmd[2] = { 0x01, 0x02 };
uint8_t szReadBuf[10];
iotbus_i2c_context_h h_i2c = iotbus_i2c_init(g_bus);
- TC_ASSERT_NOT_NULL("iotbus_i2c_init", h_i2c);
+ TC_ASSERT_NEQ("iotbus_i2c_init", h_i2c, NULL);
ret = iotbus_i2c_write(h_i2c, szCmd, 1);
TC_ASSERT_EQ_CLEANUP("iotbus_i2c_write", (ret < 0), false, iotbus_i2c_stop(h_i2c));
int channel = 1;
int ret = 0;
iotbus_pwm_context_h h_pwm = iotbus_pwm_open(device, channel);
- TC_ASSERT_NOT_NULL("iotbus_pwm_open", h_pwm);
+ TC_ASSERT_NEQ("iotbus_pwm_open", h_pwm, NULL);
ret = iotbus_pwm_close(h_pwm);
TC_ASSERT_EQ("iotbus_pwm_close", ret, OK);
int cycle = 20;
int ret = 0;
iotbus_pwm_context_h h_pwm = iotbus_pwm_open(device, channel);
- TC_ASSERT_NOT_NULL("iotbus_pwm_open", h_pwm);
+ TC_ASSERT_NEQ("iotbus_pwm_open", h_pwm, NULL);
ret = iotbus_pwm_set_duty_cycle(h_pwm, cycle);
TC_ASSERT_EQ_CLEANUP("iotbus_pwm_set_duty_cycle", ret, OK, iotbus_pwm_close(h_pwm));
int period = 1000;
int ret = 0;
iotbus_pwm_context_h h_pwm = iotbus_pwm_open(device, channel);
- TC_ASSERT_NOT_NULL("iotbus_pwm_open", h_pwm);
+ TC_ASSERT_NEQ("iotbus_pwm_open", h_pwm, NULL);
ret = iotbus_pwm_set_period(h_pwm, period);
TC_ASSERT_EQ_CLEANUP("iotbus_pwm_set_period", ret, OK, iotbus_pwm_close(h_pwm));
int default_state = 0;
int get_state = 0;
iotbus_pwm_context_h h_pwm = iotbus_pwm_open(device, channel);
- TC_ASSERT_NOT_NULL("iotbus_pwm_open", h_pwm);
+ TC_ASSERT_NEQ("iotbus_pwm_open", h_pwm, NULL);
ret = iotbus_pwm_set_period(h_pwm, period);
TC_ASSERT_EQ_CLEANUP("iotbus_pwm_set_period", ret, OK, iotbus_pwm_close(h_pwm));
}
ret = iotbus_pwm_close(h_pwm);
- TC_ASSERT_NOT_NULL("iotbus_pwm_close", h_pwm);
+ TC_ASSERT_NEQ("iotbus_pwm_close", h_pwm, NULL);
TC_SUCCESS_RESULT();
}
{
int ret = IOTBUS_ERROR_NONE;
iotbus_spi_context_h h_spi = iotbus_spi_open(gBus, &_g_st_config);
- TC_ASSERT_NOT_NULL("iotbus_spi_open", h_spi);
+ TC_ASSERT_NEQ("iotbus_spi_open", h_spi, NULL);
ret = iotbus_spi_close(h_spi);
TC_ASSERT_EQ("iotbus_spi_close", ret, IOTBUS_ERROR_NONE);
unsigned char sz_rxbuf[64] = { 0, };
int ret = IOTBUS_ERROR_NONE;
iotbus_spi_context_h h_spi = iotbus_spi_open(gBus, &_g_st_config);
- TC_ASSERT_NOT_NULL("iotbus_spi_open", h_spi);
+ TC_ASSERT_NEQ("iotbus_spi_open", h_spi, NULL);
ret = iotbus_spi_write(h_spi, sz_txbuf, 8);
TC_ASSERT_EQ_CLEANUP("iotbus_spi_write", ret, IOTBUS_ERROR_NONE, iotbus_spi_close(h_spi));
{
int ret = IOTBUS_ERROR_NONE;
iotbus_uart_context_h h_uart = iotbus_uart_init(DEVPATH);
- TC_ASSERT_NOT_NULL("iotbus_uart_init", h_uart);
+ TC_ASSERT_NEQ("iotbus_uart_init", h_uart, NULL);
ret = iotbus_uart_stop(h_uart);
TC_ASSERT_EQ("iotbus_uart_stop", ret, IOTBUS_ERROR_NONE);
int i_baudrate = 115200;
int ret = IOTBUS_ERROR_NONE;
iotbus_uart_context_h h_uart = iotbus_uart_init(DEVPATH);
- TC_ASSERT_NOT_NULL("iotbus_uart_init", h_uart);
+ TC_ASSERT_NEQ("iotbus_uart_init", h_uart, NULL);
ret = iotbus_uart_set_baudrate(h_uart, i_baudrate);
TC_ASSERT_EQ_CLEANUP("iotbus_uart_set_baudrate", ret, IOTBUS_ERROR_NONE, iotbus_uart_stop(h_uart));
int i_modes = sizeof(mode) / sizeof(int);
int index = 0;
iotbus_uart_context_h h_uart = iotbus_uart_init(DEVPATH);
- TC_ASSERT_NOT_NULL("iotbus_uart_init", h_uart);
+ TC_ASSERT_NEQ("iotbus_uart_init", h_uart, NULL);
for (index = 0; index < i_modes; index++) {
ret = iotbus_uart_set_mode(h_uart, i_bytesize, mode[index], i_stop_bits);
int rtscts[4][2] = { {1, 0}, {0, 1}, {1, 1}, {0, 0} };
int index = 0;
iotbus_uart_context_h h_uart = iotbus_uart_init(DEVPATH);
- TC_ASSERT_NOT_NULL("iotbus_uart_init", h_uart);
+ TC_ASSERT_NEQ("iotbus_uart_init", h_uart, NULL);
for (index = 0; index < i_size; index++) {
ret = iotbus_uart_set_flowcontrol(h_uart, rtscts[index][0], rtscts[index][1]);
char szInputText[32] = "UART READ/WRITE ITC TESTING!";
char szOutputText[32];
iotbus_uart_context_h h_uart = iotbus_uart_init(DEVPATH);
- TC_ASSERT_NOT_NULL("iotbus_uart_init", h_uart);
+ TC_ASSERT_NEQ("iotbus_uart_init", h_uart, NULL);
ret = iotbus_uart_write(h_uart, szInputText, sizeof(szInputText));
TC_ASSERT_EQ_CLEANUP("iotbus_uart_write", ret < 0, false, iotbus_uart_stop(h_uart));
{
int ret = IOTBUS_ERROR_NONE;
iotbus_uart_context_h h_uart = iotbus_uart_init(DEVPATH);
- TC_ASSERT_NOT_NULL("iotbus_uart_init", h_uart);
+ TC_ASSERT_NEQ("iotbus_uart_init", h_uart, NULL);
ret = iotbus_uart_flush(h_uart);
TC_ASSERT_EQ_CLEANUP("iotbus_uart_flush", ret, IOTBUS_ERROR_NONE, iotbus_uart_stop(h_uart));
{
#ifdef CONFIG_ARCH_CHIP_STM32
iotbus_gpio_context_h m_gpio = iotbus_gpio_open(GPIO_PORTA_PIN5);
- TC_ASSERT_NOT_NULL("iotbus_gpio_open", m_gpio);
+ TC_ASSERT_NEQ("iotbus_gpio_open", m_gpio, NULL);
gpio = m_gpio;
TC_SUCCESS_RESULT();
#elif CONFIG_ARCH_CHIP_S5J
iotbus_gpio_context_h m_gpio = iotbus_gpio_open(41);
- TC_ASSERT_NOT_NULL("iotbus_gpio_open", m_gpio);
+ TC_ASSERT_NEQ("iotbus_gpio_open", m_gpio, NULL);
gpio = m_gpio;
TC_SUCCESS_RESULT();
#endif
utc_gpio_open_p();
utc_gpio_open_n();
-\r
+
#ifdef CONFIG_ARCH_CHIP_STM32
utc_gpio_open2(GPIO_PORTA_PIN6);
#elif CONFIG_ARCH_CHIP_S5J
static void utc_i2c_init_p(void)
{
iotbus_i2c_context_h m_i2c = iotbus_i2c_init(1);
- TC_ASSERT_NOT_NULL("iotbus_i2c_init", m_i2c);
+ TC_ASSERT_NEQ("iotbus_i2c_init", m_i2c, NULL);
i2c = m_i2c;
TC_SUCCESS_RESULT();
}
static void utc_pwm_open_p(void)
{
iotbus_pwm_context_h m_pwm = iotbus_pwm_open(0, 1);
- TC_ASSERT_NOT_NULL("iotbus_pwm_open", m_pwm);
+ TC_ASSERT_NEQ("iotbus_pwm_open", m_pwm, NULL);
pwm = m_pwm;
TC_SUCCESS_RESULT();
}
static void utc_spi_open_p(void)
{
iotbus_spi_context_h m_spi = iotbus_spi_open(bus, &config);
- TC_ASSERT_NOT_NULL("iotbus_spi_open", m_spi);
+ TC_ASSERT_NEQ("iotbus_spi_open", m_spi, NULL);
spi = m_spi;
TC_SUCCESS_RESULT();
}
{
#ifdef CONFIG_ARCH_CHIP_STM32
iotbus_uart_context_h m_uart = iotbus_uart_init("/dev/ttyS1");
- TC_ASSERT_NOT_NULL("iotbus_uart_init", m_uart);
+ TC_ASSERT_NEQ("iotbus_uart_init", m_uart, NULL);
uart = m_uart;
TC_SUCCESS_RESULT();
#elif CONFIG_ARCH_CHIP_S5J
iotbus_uart_context_h m_uart = iotbus_uart_init("/dev/ttyS2");
- TC_ASSERT_NOT_NULL("iotbus_uart_init", m_uart);
+ TC_ASSERT_NEQ("iotbus_uart_init", m_uart, NULL);
uart = m_uart;
TC_SUCCESS_RESULT();
#endif
#define TC_ASSERT_LEQ(api_name, var, ref) TC_ASSERT_LEQ_CLEANUP(api_name, var, ref, )
-#define TC_ASSERT_NOT_NULL(api_name, handle) \
-{\
- if ((handle) == NULL) {\
- printf("\n[%s][Line : %d] FAIL , %s : API returned NULL ", __func__, __LINE__, api_name); \
- total_fail++; \
- return; \
- } \
-}
-
#define TC_SUCCESS_RESULT() \
{\
printf("\n[%s] PASS \n", __func__); \