(C, Visual studio 2012)
I need to test several functions that are defined as static in a file(not used anywhere outside this file except in the unit test).
To enable the unit test file to see the functions I tried using an .h file in which these functions are declared, however this results in a linkage error.
A solution I considered is, instead of using the static keyword, using a macro that is replace by static in the working version an is empty in the unit test version.
However I don't know how to make the condition dependent on the startup project instead of manually redefining macro all the time.
Seeing as the code is intended to run on a TI processor I also considered using a wrapper function that is only compiled under when WIN32 is defined. I would very much like to hear feedback on these ideas and better ideas. Thanks!
jeudi 29 octobre 2015
Running unit tests on static functions
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire