0ad/source/test_setup.cpp
Ykkrosh 8b7d1fcfb3 * Moved command-line options list from system.cfg into readme.txt. Updated the list to reflect reality. Removed -novbo option because you can use the .cfg file instead.
* Changed log files to trigger standards mode in Firefox (to be
consistent with other browsers), by making it valid HTML5. Changed the
font and some spacing.
 * Made CLogger default to ignoring messages if it hasn't been
initialised yet, instead of crashing.
 * Added leak reporting to the unit tests.
 * Renamed mods/_tests to mods/_test.xero, since it's only used by
Xeromyces and the other tests use mods/_test.otherstuff instead.
 * Fixed Atlas compilation on Windows.
 * Moved Atlas's DLL-loading code into a separate class, so it can be
shared.

This was SVN commit r4707.
2006-12-20 03:09:21 +00:00

41 lines
1.1 KiB
C++

#include "precompiled.h"
#include <cxxtest/GlobalFixture.h>
class LeakReporter : public CxxTest::GlobalFixture
{
virtual bool tearDownWorld()
{
// Enable leak reporting on exit.
// (This is done in tearDownWorld so that it doesn't report 'leaks'
// if the program is aborted before finishing cleanly.)
#ifdef _MSC_VER
int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
flags |= _CRTDBG_LEAK_CHECK_DF; // check for memory leaks
flags |= _CRTDBG_ALLOC_MEM_DF; // also check allocs using the non-debug version of new
_CrtSetDbgFlag(flags);
// Send output to stdout as well as the debug window, so it works during
// the normal build process as well as when debugging the test .exe
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE|_CRTDBG_MODE_DEBUG);
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
#endif
return true;
}
virtual bool setUpWorld()
{
#ifdef _MSC_VER
// (Warning: the allocation numbers seem to differ by 3 when you
// run in the build process vs the debugger)
// _CrtSetBreakAlloc(1952);
#endif
return true;
}
};
static LeakReporter leakReporter;