Skip to content

Commit

Permalink
Fix nasa#470, complete coverage for FS subsystem
Browse files Browse the repository at this point in the history
Add required coverage test cases to achieve 100% line coverage in FS
  • Loading branch information
jphickey committed Jun 15, 2021
1 parent a16c78e commit 3efcc0d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/fs/ut-coverage/fs_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ void Test_CFE_FS_InitHeader(void)
UT_InitData();
CFE_FS_InitHeader(&Hdr, "description", 123);
UT_Report(__FILE__, __LINE__, Hdr.SubType == 123, "CFE_FS_InitHeader", "Initialize header - successful");

/* Test calling with NULL pointer argument (no return codes) */
CFE_FS_InitHeader(NULL, "description", 123);
CFE_FS_InitHeader(&Hdr, NULL, 123);
}

/*
Expand All @@ -122,6 +126,9 @@ void Test_CFE_FS_ReadHeader(void)
UT_SetDefaultReturnValue(UT_KEY(OS_read), OS_ERROR);
UT_Report(__FILE__, __LINE__, CFE_FS_ReadHeader(&Hdr, FileDes) != sizeof(CFE_FS_Header_t), "CFE_FS_ReadHeader",
"Header read - successful");

/* Test calling with NULL pointer argument */
UtAssert_INT32_EQ(CFE_FS_ReadHeader(NULL, FileDes), CFE_FS_BAD_ARGUMENT);
}

/*
Expand All @@ -146,6 +153,9 @@ void Test_CFE_FS_WriteHeader(void)
UT_SetDeferredRetcode(UT_KEY(OS_write), 1, OS_SUCCESS);
UT_Report(__FILE__, __LINE__, CFE_FS_WriteHeader(FileDes, &Hdr) == OS_SUCCESS, "CFE_FS_WriteHeader",
"Header write - successful");

/* Test calling with NULL pointer argument */
UtAssert_INT32_EQ(CFE_FS_WriteHeader(FileDes, NULL), CFE_FS_BAD_ARGUMENT);
}

/*
Expand Down

0 comments on commit 3efcc0d

Please sign in to comment.