Skip to content

Commit

Permalink
Partial nasa#1052, File test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jphickey committed Jun 8, 2021
1 parent 00c885a commit b1139bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tests/network-api-test/network-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,17 @@ void TestStreamNetworkApi(void)
/* OS_TimedRead */
UtAssert_INT32_EQ(OS_TimedRead(invalid_fd, Buf_rcv_c, sizeof(Buf_rcv_c), UT_TIMEOUT),
OS_ERR_INVALID_ID);
UtAssert_INT32_EQ(OS_TimedRead(OS_OBJECT_ID_UNDEFINED, Buf_rcv_c, sizeof(Buf_rcv_c), UT_TIMEOUT),
OS_ERR_INVALID_ID);
UtAssert_INT32_EQ(OS_TimedRead(c_socket_id, NULL, sizeof(Buf_rcv_c), UT_TIMEOUT), OS_INVALID_POINTER);
UtAssert_INT32_EQ(OS_TimedRead(c_socket_id, Buf_rcv_c, 0, UT_TIMEOUT), OS_ERR_INVALID_SIZE);
UtAssert_INT32_EQ(OS_TimedRead(c_socket_id, Buf_rcv_c, sizeof(Buf_rcv_c), 0), OS_ERROR_TIMEOUT);

/* OS_TimedWrite */
UtAssert_INT32_EQ(OS_TimedWrite(invalid_fd, Buf_rcv_c, sizeof(Buf_rcv_c), UT_TIMEOUT),
OS_ERR_INVALID_ID);
UtAssert_INT32_EQ(OS_TimedWrite(OS_OBJECT_ID_UNDEFINED, Buf_rcv_c, sizeof(Buf_rcv_c), UT_TIMEOUT),
OS_ERR_INVALID_ID);
UtAssert_INT32_EQ(OS_TimedWrite(c_socket_id, NULL, sizeof(Buf_rcv_c), UT_TIMEOUT), OS_INVALID_POINTER);
UtAssert_INT32_EQ(OS_TimedWrite(c_socket_id, Buf_rcv_c, 0, UT_TIMEOUT), OS_ERR_INVALID_SIZE);

Expand Down
5 changes: 5 additions & 0 deletions src/unit-tests/osfile-test/ut_osfile_fileio_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ void UT_os_closefile_test()
/* #1 Invalid-file-desc-arg */

UT_RETVAL(OS_close(UT_OBJID_INCORRECT), OS_ERR_INVALID_ID);
UT_RETVAL(OS_close(OS_OBJECT_ID_UNDEFINED), OS_ERR_INVALID_ID);

/*-----------------------------------------------------*/
/* #3 Nominal */
Expand Down Expand Up @@ -549,6 +550,7 @@ void UT_os_readfile_test()
/*-----------------------------------------------------*/
/* #2 Invalid-file-desc-arg */
UT_RETVAL(OS_read(UT_OBJID_INCORRECT, g_readBuff, sizeof(g_readBuff)), OS_ERR_INVALID_ID);
UT_RETVAL(OS_read(OS_OBJECT_ID_UNDEFINED, g_readBuff, sizeof(g_readBuff)), OS_ERR_INVALID_ID);

/*-----------------------------------------------------*/
/* #4 Nominal */
Expand Down Expand Up @@ -657,6 +659,7 @@ void UT_os_writefile_test()
/* #2 Invalid-file-desc-arg */

UT_RETVAL(OS_write(UT_OBJID_INCORRECT, g_writeBuff, sizeof(g_writeBuff)), OS_ERR_INVALID_ID);
UT_RETVAL(OS_write(OS_OBJECT_ID_UNDEFINED, g_writeBuff, sizeof(g_writeBuff)), OS_ERR_INVALID_ID);

/*-----------------------------------------------------*/
/* #4 Nominal */
Expand Down Expand Up @@ -744,6 +747,7 @@ void UT_os_lseekfile_test()
int32 pos1 = 0, pos2 = 0, pos3 = 0;

UT_RETVAL(OS_lseek(UT_OBJID_INCORRECT, 0, OS_SEEK_SET), OS_ERR_INVALID_ID);
UT_RETVAL(OS_lseek(OS_OBJECT_ID_UNDEFINED, 0, OS_SEEK_SET), OS_ERR_INVALID_ID);

/*-----------------------------------------------------*/
/* #2 Invalid-whence-arg */
Expand Down Expand Up @@ -1535,6 +1539,7 @@ void UT_os_getfdinfo_test()
/* #2 Invalid-file-desc-arg */

UT_RETVAL(OS_FDGetInfo(UT_OBJID_INCORRECT, &fdProps), OS_ERR_INVALID_ID);
UT_RETVAL(OS_FDGetInfo(OS_OBJECT_ID_UNDEFINED, &fdProps), OS_ERR_INVALID_ID);

/*-----------------------------------------------------*/
/* #4 Nominal */
Expand Down

0 comments on commit b1139bd

Please sign in to comment.