Arduino compatibility/mock libraries for native platform

Hi all, I want to use the native platform for unittesting some of my libraries, but my code will run on the arduino platform. So I need to have some functionality for the native platform that is compatible with arduino. Two main ones are:

  1. type definitions: is there a header file I can include on the native platform with typedefs for uint8_t and other arduino/avr types?
  2. Are there mock libraries for arduino functionality already out there? Currently I need a mock EEPROM library for native for my tests. I think I can write my own MockEEPROM library and put it in my project in lib/ and in the library.json file define that it is only for the native platform. I think ldf should then automatically include it, right? But if I can use something pre-existing, that would be great.


I have managed to make my own MockEEPROM library, and the ArduinoFake library seems to help out with the type definitions (amongst other things). Are they the solutions people generally use with PlatformIO unittesting on the native platform for arduino code?

1 Like