]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cppunit.h
include iostream headers before using iostream classes (might fix HP-UX native compil...
[wxWidgets.git] / include / wx / cppunit.h
CommitLineData
86132a69
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/cppunit.h
3// Purpose: wrapper header for CppUnit headers
4// Author: Vadim Zeitlin
5// Created: 15.02.04
6// RCS-ID: $Id$
7// Copyright: (c) 2004 Vadim Zeitlin
8/////////////////////////////////////////////////////////////////////////////
9
10#ifndef _WX_CPPUNIT_H_
11#define _WX_CPPUNIT_H_
12
044a69a4 13///////////////////////////////////////////////////////////////////////////////
86132a69
VZ
14// using CPPUNIT_TEST() macro results in this warning, disable it as there is
15// no other way to get rid of it and it's not very useful anyhow
16#ifdef __VISUALC__
17 // typedef-name 'foo' used as synonym for class-name 'bar'
18 #pragma warning(disable:4097)
19
20 // unreachable code: we don't care about warnings in CppUnit headers
21 #pragma warning(disable:4702)
22
23 // 'id': identifier was truncated to 'num' characters in the debug info
24 #pragma warning(disable:4786)
25#endif // __VISUALC__
26
20f46e8d
VS
27#ifdef __BORLANDC__
28 #pragma warn -8022
29#endif
14dc53b2
MW
30
31///////////////////////////////////////////////////////////////////////////////
32// Set the default format for the errors, which can be used by an IDE to jump
33// to the error location. This default gets overridden by the cppunit headers
34// for some compilers (e.g. VC++).
35
36#ifndef CPPUNIT_COMPILER_LOCATION_FORMAT
37 #define CPPUNIT_COMPILER_LOCATION_FORMAT "%p:%l:"
38#endif
20f46e8d 39
044a69a4
VS
40
41///////////////////////////////////////////////////////////////////////////////
42// Include all needed cppunit headers.
43//
44
86132a69
VZ
45#include "wx/beforestd.h"
46#include <cppunit/extensions/TestFactoryRegistry.h>
47#include <cppunit/ui/text/TestRunner.h>
48#include <cppunit/TestCase.h>
49#include <cppunit/extensions/HelperMacros.h>
14dc53b2 50#include <cppunit/CompilerOutputter.h>
86132a69
VZ
51#include "wx/afterstd.h"
52
044a69a4
VS
53
54///////////////////////////////////////////////////////////////////////////////
55// Set of helpful test macros.
56//
57
58// Base macro for wrapping CPPUNIT_TEST macros and so making them conditional
59// tests, meaning that the test only get registered and thus run when a given
68379eaf 60// runtime condition is true.
044a69a4
VS
61// In case the condition is evaluated as false a skip message is logged
62// (the message will only be shown in verbose mode).
63#define WXTEST_ANY_WITH_CONDITION(suiteName, Condition, testMethod, anyTest) \
64 if (Condition) \
65 { anyTest; } \
66 else \
67 wxLogInfo(wxString::Format(_T("skipping: %s.%s\n reason: %s equals false\n"), \
68 wxString(suiteName, wxConvUTF8).c_str(), \
69 wxString(#testMethod, wxConvUTF8).c_str(), \
70 wxString(#Condition, wxConvUTF8).c_str()))
71
72// Conditional CPPUNIT_TEST macro.
73#define WXTEST_WITH_CONDITION(suiteName, Condition, testMethod) \
74 WXTEST_ANY_WITH_CONDITION(suiteName, Condition, testMethod, CPPUNIT_TEST(testMethod))
75// Conditional CPPUNIT_TEST_FAIL macro.
76#define WXTEST_FAIL_WITH_CONDITION(suiteName, Condition, testMethod) \
77 WXTEST_ANY_WITH_CONDITION(suiteName, Condition, testMethod, CPPUNIT_TEST_FAIL(testMethod))
78
79
80///////////////////////////////////////////////////////////////////////////////
81// Some more compiler warning tweaking and auto linking.
82//
83
20f46e8d
VS
84#ifdef __BORLANDC__
85 #pragma warn .8022
86#endif
87
86132a69
VZ
88#ifdef _MSC_VER
89 #pragma warning(default:4702)
90#endif // _MSC_VER
91
92// for VC++ automatically link in cppunit library
93#ifdef __VISUALC__
94 #ifdef NDEBUG
95 #pragma comment(lib, "cppunit.lib")
96 #else // Debug
97 #pragma comment(lib, "cppunitd.lib")
98 #endif // Release/Debug
99#endif
100
101#endif // _WX_CPPUNIT_H_
102