Re-added the fake microseconds function for testing to pass.

This commit is contained in:
jakeg00dwin 2024-07-27 11:23:07 -07:00
parent 8eb5600499
commit d60e4d0586
2 changed files with 16 additions and 11 deletions

View File

@ -12,6 +12,11 @@
#include "TriacOut.h" #include "TriacOut.h"
#include "RegEdit.h" #include "RegEdit.h"
void Delay_MicroSeconds_impl(double us);
void (*Delay_MicroSeconds)(double us) = &Delay_MicroSeconds_impl;
void TriacOut_InitTimerA(void) void TriacOut_InitTimerA(void)
{ {
@ -42,3 +47,7 @@ void TriacOut_PulsePins(uint16_t pulse_time)
RegEdit_ClearBit((void *) &PORTB.OUT, G2); RegEdit_ClearBit((void *) &PORTB.OUT, G2);
RegEdit_ClearBit((void *) &PORTB.OUT, G3); RegEdit_ClearBit((void *) &PORTB.OUT, G3);
} }
void Delay_MicroSeconds_impl(double us){
return;
}

View File

@ -18,11 +18,17 @@ extern "C"
#include "MockRegEdit.h" #include "MockRegEdit.h"
} }
void FakeDelay(double us)
{
//do Nothing.
}
TEST_GROUP(test_TriacOut) TEST_GROUP(test_TriacOut)
{ {
void setup() void setup()
{ {
UT_PTR_SET(Delay_MicroSeconds, FakeDelay);
} }
void teardown() void teardown()
{ {
@ -78,18 +84,8 @@ TEST(test_TriacOut, TriacOut_SetAllHigh)
TriacOut_SetAllHigh(); TriacOut_SetAllHigh();
} }
void FakeDelay(double us)
{
//do Nothing.
}
TEST(test_TriacOut, TriacOut_PulsePins) TEST(test_TriacOut, TriacOut_PulsePins)
{ {
UT_PTR_SET(Delay_MicroSeconds, FakeDelay);
//Expect that pin PA1 is set to output //Expect that pin PA1 is set to output
mock().expectOneCall("RegEdit_ClearBit") mock().expectOneCall("RegEdit_ClearBit")