I have inherited a Platformio based project, targeting the Teensy platform. It builds and runs fine. I would like to start adding unit tests for at least the business logic of any new features I have to add. I am mostly interested in running tests on the host PC, not the target.
I read through the tutorial at http://docs.platformio.org/en/latest/tutorials/core/unit_testing_blink.html and started applying those principles to my project. However, it looks like to compile the project in unit test mode, for the host system, every “non test” file needs to be guarded with “#ifndef UNIT_TEST”? Is this correct? This would be OK if it were just for my project source files, but my project imports a lot of hardware libraries, and it looks like it will not build in host unit test mode unless every source file under the lib directory is also modified with #ifndef UNIT_TEST. Is this actually how the host unit testing is supposed to be configured? Or is there an easier way e.g. where I can just exclude everything under lib from the unit test build?