refactored mock regedit tests
+ now implimented new u8 type tests.
This commit is contained in:
parent
e61a9ae235
commit
e6d3612d4d
1 changed files with 104 additions and 0 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CppUTest/CommandLineTestRunner.h"
|
#include "CppUTest/CommandLineTestRunner.h"
|
||||||
|
#include "CppUTest/UtestMacros.h"
|
||||||
#include "CppUTestExt/MockSupport.h"
|
#include "CppUTestExt/MockSupport.h"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
|
@ -21,6 +22,12 @@ TEST_GROUP(test_MockRegEdit){
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
TEST(test_MockRegEdit, confirmgroup)
|
||||||
|
{
|
||||||
|
CHECK_TRUE(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
TEST(test_MockRegEdit, RegEdit_ClearRegisterExpectedCallPasses)
|
TEST(test_MockRegEdit, RegEdit_ClearRegisterExpectedCallPasses)
|
||||||
{
|
{
|
||||||
uint8_t a;
|
uint8_t a;
|
||||||
|
|
@ -129,3 +136,100 @@ TEST(test_MockRegEdit, RegEdit_ReadRegPasses)
|
||||||
|
|
||||||
mock().checkExpectations();
|
mock().checkExpectations();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
TEST_GROUP(tg_mockregedit_u8){
|
||||||
|
uint8_t fake_reg;
|
||||||
|
uint8_t *reg_ptr;
|
||||||
|
uint8_t num;
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
fake_reg = 0;
|
||||||
|
reg_ptr = &fake_reg;
|
||||||
|
num = 0;
|
||||||
|
}
|
||||||
|
void teardown()
|
||||||
|
{
|
||||||
|
mock().checkExpectations();
|
||||||
|
mock().clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST(tg_mockregedit_u8, setregistercalled)
|
||||||
|
{
|
||||||
|
mock().expectOneCall("RegEdit_u8_SetRegister").withPointerParameter("reg", reg_ptr);
|
||||||
|
|
||||||
|
RegEdit_u8_SetRegister(reg_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(tg_mockregedit_u8, clearregistercalled)
|
||||||
|
{
|
||||||
|
mock().expectOneCall("RegEdit_u8_ClearRegister").withPointerParameter("reg", reg_ptr);
|
||||||
|
|
||||||
|
RegEdit_u8_ClearRegister(reg_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(tg_mockregedit_u8, setbitcalled)
|
||||||
|
{
|
||||||
|
uint8_t num = 0;
|
||||||
|
|
||||||
|
mock().expectOneCall("RegEdit_u8_SetBit")
|
||||||
|
.withPointerParameter("reg", reg_ptr)
|
||||||
|
.withUnsignedIntParameter("bit_num", num);
|
||||||
|
|
||||||
|
RegEdit_u8_SetBit(reg_ptr, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(tg_mockregedit_u8, clearbitcalled)
|
||||||
|
{
|
||||||
|
mock().expectOneCall("RegEdit_u8_ClearBit")
|
||||||
|
.withPointerParameter("reg", reg_ptr)
|
||||||
|
.withUnsignedIntParameter("bit_num", num);
|
||||||
|
|
||||||
|
RegEdit_u8_ClearBit(reg_ptr, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(tg_mockregedit_u8, isbitsetcalled)
|
||||||
|
{
|
||||||
|
mock().expectOneCall("RegEdit_u8_IsBitSet")
|
||||||
|
.withPointerParameter("reg", reg_ptr)
|
||||||
|
.withUnsignedIntParameter("bit_num", num);
|
||||||
|
|
||||||
|
RegEdit_u8_IsBitSet(reg_ptr, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(tg_mockregedit_u8, logicalornum)
|
||||||
|
{
|
||||||
|
mock().expectOneCall("RegEdit_u8_OR_Num")
|
||||||
|
.withPointerParameter("reg", reg_ptr)
|
||||||
|
.withUnsignedIntParameter("num", num);
|
||||||
|
|
||||||
|
RegEdit_u8_OR_Num(reg_ptr, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(tg_mockregedit_u8, logicalandnum)
|
||||||
|
{
|
||||||
|
mock().expectOneCall("RegEdit_u8_AND_Num")
|
||||||
|
.withPointerParameter("reg", reg_ptr)
|
||||||
|
.withUnsignedIntParameter("num", num);
|
||||||
|
|
||||||
|
RegEdit_u8_AND_Num(reg_ptr, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(tg_mockregedit_u8, setnumcalled)
|
||||||
|
{
|
||||||
|
mock().expectOneCall("RegEdit_u8_SetNum")
|
||||||
|
.withPointerParameter("reg", reg_ptr)
|
||||||
|
.withUnsignedIntParameter("num", num);
|
||||||
|
|
||||||
|
RegEdit_u8_SetNum(reg_ptr, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(tg_mockregedit_u8, readregcalled)
|
||||||
|
{
|
||||||
|
mock().expectOneCall("RegEdit_u8_ReadReg")
|
||||||
|
.withPointerParameter("reg", reg_ptr);
|
||||||
|
|
||||||
|
RegEdit_u8_ReadReg(reg_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue