From 5178c69a14d1e6028c6670ff2c95cc606742469f Mon Sep 17 00:00:00 2001 From: jake-g00dwin Date: Sun, 21 Dec 2025 21:07:46 -0800 Subject: [PATCH] Updated ADC test, now passing. --- tests/ADC/test_ADC.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/tests/ADC/test_ADC.cpp b/tests/ADC/test_ADC.cpp index 282dcd3..9976bb0 100644 --- a/tests/ADC/test_ADC.cpp +++ b/tests/ADC/test_ADC.cpp @@ -1,6 +1,6 @@ /* * Author: Jake G - * Date: 2024 + * Date: 2025 * filename: test_ADC.c * description: module_purpose */ @@ -15,15 +15,17 @@ extern "C" #include "ch32v003hw.h" } -TEST_GROUP(test_ADC){ +TEST_GROUP(test_ADC) +{ void setup(){ - } void teardown(){ + } + void teardown() + { mock().checkExpectations(); -mock().clear(); -} -} -; + mock().clear(); + } +}; TEST(test_ADC, FirstTest) { @@ -33,7 +35,7 @@ TEST(test_ADC, FirstTest) TEST(test_ADC, ADC_PowerOnTest) { // The ADCON bit should be high in the ADC_CTRL2 register. - mock().expectOneCall("RegEdit_SetBit").withPointerParameter("reg", (void *)&ADC1->CTLR2).withUnsignedIntParameter("bit_num", ADC_ADON); + mock().expectOneCall("RegEdit_u32_SetBit").withPointerParameter("reg", (void *)&ADC1->CTLR2).withUnsignedIntParameter("bit_num", ADC_ADON); ADC_PowerOn(); } @@ -195,18 +197,19 @@ static uint16_t ADC_ReadValueFake(uint8_t pin_num) return 512; } -TEST_GROUP(test_ADCRead){ +TEST_GROUP(tg_ADCRead){ void setup(){ UT_PTR_SET(ADC_ReadValue, ADC_ReadValueFake); } -void teardown() -{ -} -} -; + void teardown() + { + mock().checkExpectations(); + mock().clear(); + } +}; -TEST(test_ADCRead, FunctionPointerSwapWorks) +TEST(tg_ADCRead, FunctionPointerSwapWorks) { uint16_t value = ADC_ReadValue(0);