Reputation: 2669
I am a newbie using Visual Studio 2008 and C++. My task is to run an Automated System framework which runs a set of tests on the debug build of the application and logs all the asserts that comes in between.
Can someone please point me in the right direction as to where to start from. Does Visual Studio provides any such support for logging Asserts? And if no, what other resource could i use for this purpose?
Thanks in Advance.
Upvotes: 1
Views: 370
Reputation: 3669
I am not aware of any specific feature inside VS2008, but one option is to redefine the assert() macro according to you needs. Something along that line:
#define assert(expression) Logfile::getSingletonPtr()->write(...);
You can write out the expression, file, line, etc. as needed.
Note: This approach will result in a warning C4005 (macro-redefinition), don't be surprised.
Also have a look at this SO thread if you want to use additional messages in the assert().
Upvotes: 1