Skip to content

Commit

Permalink
Partial nasa#1052, Directory test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jphickey committed Jun 17, 2021
1 parent 8b2a57b commit aea265e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/unit-test-coverage/shared/src/coveragetest-dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ void Test_OS_DirectoryOpen(void)
UtAssert_True(actual == expected, "OS_DirectoryOpen() (%ld) == OS_SUCCESS", (long)actual);
OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED);

OSAPI_TEST_FUNCTION_RC(OS_DirectoryOpen(NULL, NULL), OS_INVALID_POINTER);
/*
* Note that the second arg (path) is validated by a separate unit (OS_TranslatePath),
* so it should not be passed NULL here
*/
OSAPI_TEST_FUNCTION_RC(OS_DirectoryOpen(NULL, "Dir"), OS_INVALID_POINTER);
}

void Test_OS_DirectoryClose(void)
Expand Down
3 changes: 3 additions & 0 deletions src/unit-tests/osfile-test/ut_osfile_dirio_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ void UT_os_closedir_test()
os_dirent_t dirEntry;

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

/*-----------------------------------------------------*/
/* #2 Nominal */
Expand Down Expand Up @@ -358,6 +359,7 @@ void UT_os_readdir_test()
/* Invalid ID */

UT_RETVAL(OS_DirectoryRead(UT_OBJID_INCORRECT, &dirent), OS_ERR_INVALID_ID);
UT_RETVAL(OS_DirectoryRead(OS_OBJECT_ID_UNDEFINED, &dirent), OS_ERR_INVALID_ID);

/*-----------------------------------------------------*/
/* #3 Nominal */
Expand Down Expand Up @@ -449,6 +451,7 @@ void UT_os_rewinddir_test()
/* Invalid ID */

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

/*-----------------------------------------------------*/
/* #2 Nominal */
Expand Down

0 comments on commit aea265e

Please sign in to comment.