avr - How to layout arduino code files with external unit tests -


i have 3 code files arduino project:

main.ino  <-- main sketch helper.cpp  <-- helper functions, no avr code helper_test.cpp  <-- unit test helpers 

arduino attempt include helper_test.cpp, , confused inclusion of unit test library header files (which happen google test). if unit test contains c main function skip in main.ino , try use that.

i know there dedicated arduino unit test frameworks, these regular c++ unit tests math functions don't touch avr-related code.

how can lay these files out or make arduino won't try include helper_test.cpp include helper.cpp?

you need create 2 separate projects. 1 project contain production code. have these files:

main.ino  <-- main sketch helper.cpp  <-- header helper functions helper.cpp  <-- implementation helper functions 

and other files necessary create arduino app. build when want create app itself. other project standard executable run unit tests:

main_test.cpp  <-- main  helper_test.cpp  <-- unit test helpers ../arduino_project/helper.h <-- header helper functions ../arduino_project/helper.cpp <-- implementation helper functions 

every time add new function or make change helper function, build executable , run see if tests pass.as can see, project add files (that contain function tested) main project. best way add location of source files main project additional include directories unit tests project.


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -