ArduinoFake
ArduinoFake copied to clipboard
how to handle arduino core libraries from other platforms?
I am working a lot on ESP32 mcu's. This arduino core's have some libraries which are used a lot (WiFi, UDP, Ethernet, etc.).
- Do somebody know of a ESP32 Arduino Fake core/library?
- Is it possible to integrate this kind of libraries here? but I think this will make this project not really better for other core's (like AVR etc.)
how do you handle situations like this?
I tried copying the public part of the relevant header files to a separate folder, including their dependencies.
I gave them a different name, like HTTPCLient_Mock.h
, WiFiClient.h
. I removed the #include
for the Client
class in WiFiClient.h
and replaced it by class Client;
In my code I conditionally include the real or mocking headers:
#ifdef UNIT_TEST
#include "HTTPClient_Mock.h"
#else
#include <HTTPClient.h>
#endif
It feels like a lot of tinkering to get it right though. More guidance from the maintainer would be great here.