Skip to content

Commit

Permalink
work in progress, adds eeprom_direct lcov
Browse files Browse the repository at this point in the history
  • Loading branch information
Figueroa committed Aug 9, 2024
1 parent e791a8e commit f2df975
Showing 1 changed file with 34 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,44 @@

extern void eeprom_direct_Init(uint32 PspModuleId);

/*
* --------------------------------------------
* TEST FUNCTIONS
* --------------------------------------------
*/

void Test_eeprom_direct_Init(void)
{
/*
void eeprom_direct_Init(uint32 PspModuleId)
*/

/* Test For:
* void eeprom_direct_Init(uint32 PspModuleId)
*/
UtAssert_VOIDCALL(eeprom_direct_Init(1));
}

void Test_CFE_PSP_EepromWrite32(void)
/* ********************************
* CFE_PSP_EepromWrite32
* ********************************/
void Test_CFE_PSP_EepromWrite32_Nominal(void)
{
/*
int32 CFE_PSP_EepromWrite32(cpuaddr MemoryAddress, uint32 uint32Value)
*/
UtAssert_INT32_EQ(CFE_PSP_EepromWrite32(0, 1), CFE_PSP_SUCCESS);
/* Arrange */
cpuaddr address = 0x1000; // Properly aligned address
uint32 writevalue = 1;

/* Act */
UtAssert_INT32_EQ(CFE_PSP_EepromWrite32(address, writevalue), CFE_PSP_SUCCESS);

/* Assert */
UtAssert_INT32_EQ(*((uint32 *)address), 1);
}

void Test_CFE_PSP_EepromWrite32_AddressMisaligned(void)
{
/* Arrange */
cpuaddr address = 0x1001; // Misaligned address
uint32 writevalue = 1;

/* Act */
UtAssert_INT32_EQ(CFE_PSP_EepromWrite32(address, writevalue), CFE_PSP_ERROR_ADDRESS_MISALIGNED);
}

void Test_CFE_PSP_EepromWrite16(void)
Expand Down Expand Up @@ -121,7 +144,8 @@ void Test_CFE_PSP_EepromPowerDown(void)
void UtTest_Setup(void)
{
ADD_TEST(Test_eeprom_direct_Init);
ADD_TEST(Test_CFE_PSP_EepromWrite32);
ADD_TEST(Test_CFE_PSP_EepromWrite32_Nominal);
ADD_TEST(Test_CFE_PSP_EepromWrite32_AddressMisaligned);
ADD_TEST(Test_CFE_PSP_EepromWrite16);
ADD_TEST(Test_CFE_PSP_EepromWrite8);
ADD_TEST(Test_CFE_PSP_EepromWriteEnable);
Expand Down

0 comments on commit f2df975

Please sign in to comment.