I have an Arduino project where the file structure looks like this
myProject/
myProject.ino
ImportantClass1.hpp
ImportantClass1.cpp
ImportantClass2.hpp
ImportantClass2.cpp
Etc….
It compiles and runs fine. No problem pulling the cpp and hpp files into the ino program. However to really make sure of reliability I want to make additional ino files for unit testing of importantClass1 & etc. I have made files importantClass1UnitTest.ino
& importantClass2UnitTest.ino
however these can’t be in the same dir as the respective source files as the arduino compiler requires the ino file and the dir to have the same name.
The tests run when I move the files around. But I am not happy with that, I want to be able to run the tests at any time with the standard arduino compiler without having to script filecopy commands.
If I put the unit test in its own dir separate to the class source and #include
using the full path it also works. However this solutions is not portable, when I (or any collaborator) pull the project from git hub on any other computer the paths are wrong and it doesn’t work.
Where am I going wrong? How can I do this so as to avoid moving/copying files and also avoid using full paths?
#include
a relative (rather than absolute) path.