
[Please do not mail me a copy of your followup] boost-users@lists.boost.org spake the secret code <1365867152886-4645293.post@n4.nabble.com> thusly:
I see a good tutorial for Boost Test using Visual Studio. (http://legalizeadulthood.wordpress.com/2009/07/04/c-unit-tests-with-boost-te...)
Thanks.
But it looks like only forstatic or dynamic library.
Is that possible to unit test the exe production project using Boost Test?
This isn't really possible due to the way that the C/C++ link mechanism works. What you need to do is to refactor your executable into a simple delegating stub for main() and a static library for all the other code. Then you can unit test everything in the static library (including your new main). For instance, you start with: main.cpp: int main(int argc, char *argv[]) { // some code you want to test return 0; } Rename this function to exe_main: exe_main.cpp: int exe_main(int argc, char *argv[]) { // some code you want to test return 0; } and create a delegating stub: main.cpp: extern int exe_main(int argc, char* argv[]); int main(int argc, char* argv[]) { return exe_main(argc, argv); } Then move exe_main.cpp and all the other cpp files into a static library. Then you can unit test everything. -- "The Direct3D Graphics Pipeline" free book http://tinyurl.com/d3d-pipeline The Computer Graphics Museum http://computergraphicsmuseum.org The Terminals Wiki http://terminals.classiccmp.org Legalize Adulthood! (my blog) http://legalizeadulthood.wordpress.com