fg004_a1/mocks/MockRegEdit/MockRegEdit.c

87 lines
1.9 KiB
C
Raw Normal View History

/*
* Author: username
* Date: 2024
* filename: MockRegEdit.c
* description: module_purpose
*/
#include "MockRegEdit.h"
#include "CppUTestExt/MockSupport_c.h"
void RegEdit_SetRegister(void *reg)
{
mock_c()->actualCall("RegEdit_SetRegister")
->withPointerParameters("reg", reg);
}
void RegEdit_ClearRegister(void *reg)
{
mock_c()->actualCall("RegEdit_ClearRegister")
->withPointerParameters("reg", reg);
}
void RegEdit_SetBit(void *reg, uint8_t bit_num)
{
mock_c()->actualCall("RegEdit_SetBit")
->withPointerParameters("reg", reg)
->withUnsignedIntParameters("bit_num", bit_num);
}
void RegEdit_ClearBit(void *reg, uint8_t bit_num)
{
mock_c()->actualCall("RegEdit_ClearBit")
->withPointerParameters("reg", reg)
->withUnsignedIntParameters("bit_num", bit_num);
}
bool RegEdit_IsBitSet(void *reg, uint8_t bit_num)
{
return mock_c()->actualCall("RegEdit_IsBitSet")
->withPointerParameters("reg", reg)
->withUnsignedIntParameters("bit_num", bit_num)
->returnBoolValueOrDefault(true);
//return mock_c()->returnBoolValueOrDefault(true);
}
void RegEdit_OR_Num(void *reg, uint8_t num)
{
mock_c()->actualCall("RegEdit_OR_Num")
->withPointerParameters("reg", reg)
->withUnsignedIntParameters("num", num);
}
void RegEdit_AND_Num(void *reg, uint8_t num)
{
mock_c()->actualCall("RegEdit_AND_Num")
->withPointerParameters("reg", reg)
->withUnsignedIntParameters("num", num);
}
void RegEdit_SetNum(void *reg, uint8_t num)
{
mock_c()->actualCall("RegEdit_SetNum")
->withPointerParameters("reg", reg)
->withUnsignedIntParameters("num", num);
}
uint8_t RegEdit_ReadReg(void *reg)
{
uint8_t *reg_ptr = (uint8_t) reg;
uint8_t reg_val = *reg_ptr;
mock_c()->actualCall("RegEdit_ReadReg")
->withPointerParameters("reg", reg)
->returnUnsignedIntValueOrDefault(reg_val);
return reg_val;
}