From d60e4d05866b7be34fd975a0a399010d8329226c Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Sat, 27 Jul 2024 11:23:07 -0700 Subject: [PATCH] Re-added the fake microseconds function for testing to pass. --- src/TriacOut/TriacOut.c | 9 +++++++++ tests/TriacOut/test_TriacOut.cpp | 18 +++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/TriacOut/TriacOut.c b/src/TriacOut/TriacOut.c index a72eb08..eae8391 100644 --- a/src/TriacOut/TriacOut.c +++ b/src/TriacOut/TriacOut.c @@ -12,6 +12,11 @@ #include "TriacOut.h" #include "RegEdit.h" + +void Delay_MicroSeconds_impl(double us); + +void (*Delay_MicroSeconds)(double us) = &Delay_MicroSeconds_impl; + 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, G3); } + +void Delay_MicroSeconds_impl(double us){ + return; +} diff --git a/tests/TriacOut/test_TriacOut.cpp b/tests/TriacOut/test_TriacOut.cpp index 8ad3be4..a046645 100644 --- a/tests/TriacOut/test_TriacOut.cpp +++ b/tests/TriacOut/test_TriacOut.cpp @@ -18,11 +18,17 @@ extern "C" #include "MockRegEdit.h" } + +void FakeDelay(double us) +{ + //do Nothing. +} + TEST_GROUP(test_TriacOut) { void setup() { - + UT_PTR_SET(Delay_MicroSeconds, FakeDelay); } void teardown() { @@ -78,18 +84,8 @@ TEST(test_TriacOut, TriacOut_SetAllHigh) TriacOut_SetAllHigh(); } - -void FakeDelay(double us) -{ - //do Nothing. -} - - - TEST(test_TriacOut, TriacOut_PulsePins) { - UT_PTR_SET(Delay_MicroSeconds, FakeDelay); - //Expect that pin PA1 is set to output mock().expectOneCall("RegEdit_ClearBit")