Skip to content

Commit

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

OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate(NULL, NULL, 0, 0), OS_INVALID_POINTER);
OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate(NULL, "UT", 0, 0), OS_INVALID_POINTER);
OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate(&objid, NULL, 0, 0), OS_INVALID_POINTER);
UT_SetDefaultReturnValue(UT_KEY(OCS_memchr), OS_ERROR);
OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate(&objid, "UT", 0, 0), OS_ERR_NAME_TOO_LONG);
}
Expand Down
6 changes: 6 additions & 0 deletions src/unit-tests/oscore-test/ut_oscore_binsem_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ void UT_os_bin_sem_delete_test()

/*-----------------------------------------------------*/
UT_RETVAL(OS_BinSemDelete(UT_OBJID_INCORRECT), OS_ERR_INVALID_ID);
UT_RETVAL(OS_BinSemDelete(OS_OBJECT_ID_UNDEFINED), OS_ERR_INVALID_ID);

/*-----------------------------------------------------*/
if (UT_SETUP(OS_BinSemCreate(&bin_sem_id, "DeleteTest", 1, 0)))
Expand All @@ -157,6 +158,7 @@ void UT_os_bin_sem_flush_test()

/*-----------------------------------------------------*/
UT_RETVAL(OS_BinSemFlush(UT_OBJID_INCORRECT), OS_ERR_INVALID_ID);
UT_RETVAL(OS_BinSemFlush(OS_OBJECT_ID_UNDEFINED), OS_ERR_INVALID_ID);

/*----------------------------------------------------*/
if (UT_SETUP(OS_BinSemCreate(&bin_sem_id, "FlushTest", 1, 0)))
Expand All @@ -181,6 +183,7 @@ void UT_os_bin_sem_give_test()

/*-----------------------------------------------------*/
UT_RETVAL(OS_BinSemGive(UT_OBJID_INCORRECT), OS_ERR_INVALID_ID);
UT_RETVAL(OS_BinSemGive(OS_OBJECT_ID_UNDEFINED), OS_ERR_INVALID_ID);

/*-----------------------------------------------------*/
if (UT_SETUP(OS_BinSemCreate(&bin_sem_id, "GiveTest", 1, 0)))
Expand All @@ -206,6 +209,7 @@ void UT_os_bin_sem_take_test()

/*-----------------------------------------------------*/
UT_RETVAL(OS_BinSemTake(UT_OBJID_INCORRECT), OS_ERR_INVALID_ID);
UT_RETVAL(OS_BinSemTake(OS_OBJECT_ID_UNDEFINED), OS_ERR_INVALID_ID);

/*-----------------------------------------------------*/
if (UT_SETUP(OS_BinSemCreate(&bin_sem_id, "TakeTest", 1, 0)))
Expand All @@ -230,6 +234,7 @@ void UT_os_bin_sem_timed_wait_test()

/*-----------------------------------------------------*/
UT_RETVAL(OS_BinSemTimedWait(UT_OBJID_INCORRECT, 1000), OS_ERR_INVALID_ID);
UT_RETVAL(OS_BinSemTimedWait(OS_OBJECT_ID_UNDEFINED, 1000), OS_ERR_INVALID_ID);

/*-----------------------------------------------------*/
if (UT_SETUP(OS_BinSemCreate(&bin_sem_id, "TimedWait", 1, 0)) && UT_SETUP(OS_BinSemTake(bin_sem_id)))
Expand Down Expand Up @@ -299,6 +304,7 @@ void UT_os_bin_sem_get_info_test()

/*-----------------------------------------------------*/
UT_RETVAL(OS_BinSemGetInfo(UT_OBJID_INCORRECT, &bin_sem_prop), OS_ERR_INVALID_ID);
UT_RETVAL(OS_BinSemGetInfo(OS_OBJECT_ID_UNDEFINED, &bin_sem_prop), OS_ERR_INVALID_ID);

/*-----------------------------------------------------*/
if (UT_SETUP(OS_BinSemCreate(&bin_sem_id, "GetInfo", 1, 0)))
Expand Down

0 comments on commit 701e293

Please sign in to comment.