-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit testing Wire.h with UNO build #39
Comments
Ok - found a solution - wrapped the include in an #ifndef
|
Interestingly, I think it may be related to PlatformIO dependency management and not necessarily ArduinoFake (though it may be possible to adjust something on the ArduinoFake side). It works for me if I clone ArduinoFake directly into my platformio's
protoWire.h:
protoWire.cpp:
test_native.cpp:
platform.ini:
Then, removing all of the deps and the local version of ArduinoFake, the code fails:
platform.ini:
|
This allows existing libraries to work when using PlatformIO (FabioBatSilva#39).
Doing it this way allows PlatformIO to find the correct include files so that existing libraries still work. This should address FabioBatSilva#39.
Doing it this way allows PlatformIO to find the correct include files so that existing libraries still work. This should address FabioBatSilva#39.
I’m creating unit tests in PlatformIO using Unity with the ArduinoFake library I’m trying to test a piece of code that uses the Wire library
I have built a simple function in a separate file that just calls Wire.begin(), and has #include <Wire.h>, which builds fine for UNO
When I try to run the unit test (env:native), it complains that the build cannot find <Wire.h>
If I comment out #include <Wire.h> in the code under test, then it builds native & the test passes ok - but now the UNO build fails
It looks like I'm using this wrong - how should I be doing this?
my platformio.ini file has the following… (as well as other lines obviously..)
My code under test (protoWire.cpp)
My testing code
The text was updated successfully, but these errors were encountered: