Hi, I’m currently working in an stm32 project using the stm32cube framework. I have a lot of libraries generated from the stm32cubemx program, between these some LoRa libraries, I’m currently writing a library to implement a custom communication protocol that will run on top of LoRa. I want to use test driven development to write this library and I am using the Unity testing suite in the native environment to write the test for this. Since Unity does not support mocking in platformio I created some fake lora libraries and I would like to include them only during the native test, I added build_flag = -DPIO_TEST in the platformio.ini in the native environment and inside the custom library .h file I have an ifdef block as following
#ifdef PIO_TEST #include fake_radio.h #else #include radio.h #endif
This errors because radio.h has dependencies that fail to compile in the native environment, how could I achieve to include fake_radio.h if I’m running tests in the native environment and include radio.h if I’m compiling the code for uploading/debugging in the embedded chip.
Thanks in advance for any tip on how to achieve this.