Unit test for ESP32

Hi I am working on C project for ESP32 using the platformio enviroment. I am using the unity test framework provided from the platformio env. I would like to unit test the following function

float reading_board_temp(void)
uint32_t adc_reading = 0;
float board_temp = 0;

for (int i = 0; i < NO_OF_SAMPLES; i++) 
    adc_reading += adc1_get_raw((adc1_channel_t)adc_1_ch_board_temp);

adc_reading /= NO_OF_SAMPLES;
uint32_t voltage = esp_adc_cal_raw_to_voltage(adc_reading, adc_chars_board_temp);
board_temp = (voltage - MCP9700AT_OFFSET)/TEMP_DIVIDER; 
return board_temp;

This is the test file I have created always in platformio

#include <Arduino.h>
#include <unity.h>
#include <gpioa_module.h>

void test_board_temp() 
     float expected_temp  = 35; 
     float risult_reading = 0;

     risult_reading =  reading_board_temp ();  

     TEST_ASSERT_EQUAL(expected_temp, risult_reading);

void setUp(void)

void tearDown(void)

void setup() 
    // NOTE!!! Wait for >2 secs
    // if board doesn't support software reset via Serial.DTR/RTS


void loop() 


When I try to test in the esp32 it seems to freeze.

How can I test the function removing or faking the hw dependancies ?

Thanks a lot for your kind reply.

Okay, so what’s the concrete question?

The concrete question is that when I try to run the system freeze… I would like to avoid the hw dep as



How can I do that?


Pretty sure you can use CMock (Example).

Ok … but it is easy to use cmock inside a platformio project with already many libs ?
Thanks max