mirror of
https://github.com/unittest-cpp/unittest-cpp
synced 2026-09-26 16:19:30 +03:00
Tweak preprocessor blocks.
This commit is contained in:
parent
f82c403768
commit
bb7555c718
9 changed files with 90 additions and 87 deletions
|
|
@ -476,7 +476,7 @@ cmt_insert_func_header = ""
|
|||
cmt_insert_class_header = ""
|
||||
cmt_insert_oc_msg_header = ""
|
||||
cmt_insert_before_preproc = false
|
||||
pp_indent = remove
|
||||
pp_indent = ignore
|
||||
pp_indent_at_level = false
|
||||
pp_indent_count = 3
|
||||
pp_space = ignore
|
||||
|
|
|
|||
|
|
@ -11,27 +11,27 @@
|
|||
#include "ReportAssertImpl.h"
|
||||
|
||||
#ifdef CHECK
|
||||
#error UnitTest++ redefines CHECK
|
||||
#error UnitTest++ redefines CHECK
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_EQUAL
|
||||
#error UnitTest++ redefines CHECK_EQUAL
|
||||
#error UnitTest++ redefines CHECK_EQUAL
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_CLOSE
|
||||
#error UnitTest++ redefines CHECK_CLOSE
|
||||
#error UnitTest++ redefines CHECK_CLOSE
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_ARRAY_EQUAL
|
||||
#error UnitTest++ redefines CHECK_ARRAY_EQUAL
|
||||
#error UnitTest++ redefines CHECK_ARRAY_EQUAL
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_ARRAY_CLOSE
|
||||
#error UnitTest++ redefines CHECK_ARRAY_CLOSE
|
||||
#error UnitTest++ redefines CHECK_ARRAY_CLOSE
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_ARRAY2D_CLOSE
|
||||
#error UnitTest++ redefines CHECK_ARRAY2D_CLOSE
|
||||
#error UnitTest++ redefines CHECK_ARRAY2D_CLOSE
|
||||
#endif
|
||||
|
||||
#define CHECK(value) \
|
||||
|
|
@ -158,6 +158,7 @@
|
|||
|
||||
// CHECK_THROW and CHECK_ASSERT only exist when UNITTEST_NO_EXCEPTIONS isn't defined (see config.h)
|
||||
#ifndef UNITTEST_NO_EXCEPTIONS
|
||||
|
||||
#define CHECK_THROW(expression, ExpectedExceptionType) \
|
||||
UNITTEST_MULTILINE_MACRO_BEGIN \
|
||||
bool caught_ = false; \
|
||||
|
|
@ -176,4 +177,5 @@
|
|||
UnitTest::Detail::ExpectAssert(false); \
|
||||
UNITTEST_MULTILINE_MACRO_END
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4,28 +4,29 @@
|
|||
// Standard defines documented here: http://predef.sourceforge.net
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable:4702)// unreachable code
|
||||
#pragma warning(disable:4722)// destructor never returns, potential memory leak
|
||||
#pragma warning(disable:4702)// unreachable code
|
||||
#pragma warning(disable:4722)// destructor never returns, potential memory leak
|
||||
|
||||
#if (_MSC_VER == 1200) // VC6
|
||||
#define UNITTEST_COMPILER_IS_MSVC6
|
||||
#pragma warning(disable:4786)
|
||||
#pragma warning(disable:4290)
|
||||
#endif
|
||||
#if (_MSC_VER == 1200) // VC6
|
||||
#define UNITTEST_COMPILER_IS_MSVC6
|
||||
#pragma warning(disable:4786)
|
||||
#pragma warning(disable:4290)
|
||||
#endif
|
||||
|
||||
#ifdef _USRDLL
|
||||
#define UNITTEST_WIN32_DLL
|
||||
#endif
|
||||
#define UNITTEST_WIN32
|
||||
#ifdef _USRDLL
|
||||
#define UNITTEST_WIN32_DLL
|
||||
#endif
|
||||
|
||||
#define UNITTEST_WIN32
|
||||
#endif
|
||||
|
||||
#if defined(unix) || defined(__unix__) || defined(__unix) || defined(linux) || \
|
||||
defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
|
||||
#define UNITTEST_POSIX
|
||||
#define UNITTEST_POSIX
|
||||
#endif
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
#define UNITTEST_MINGW
|
||||
#define UNITTEST_MINGW
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -43,7 +44,7 @@
|
|||
// well as Google Code HEAD users that may have used or defined
|
||||
// UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM outside of this configuration file.
|
||||
#ifndef UNITTEST_USE_CUSTOM_STREAMS
|
||||
#define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM
|
||||
#define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM
|
||||
#endif
|
||||
|
||||
// DeferredTestReporter uses the STL to collect test results for subsequent export by reporters like
|
||||
|
|
@ -65,9 +66,9 @@
|
|||
// std namespace qualification: used for functions like strcpy that
|
||||
// may live in std:: namespace (cstring header).
|
||||
#if defined( UNITTEST_COMPILER_IS_MSVC6 )
|
||||
#define UNIITEST_NS_QUAL_STD(x) x
|
||||
#define UNIITEST_NS_QUAL_STD(x) x
|
||||
#else
|
||||
#define UNIITEST_NS_QUAL_STD(x) ::std::x
|
||||
#define UNIITEST_NS_QUAL_STD(x) ::std::x
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@
|
|||
#include "Config.h"
|
||||
|
||||
#ifndef UNITTEST_NO_EXCEPTIONS
|
||||
#define UT_TRY(x) try x
|
||||
#define UT_THROW(x) throw x
|
||||
#define UT_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody
|
||||
#define UT_CATCH_ALL(CatchBody) catch(...) CatchBody
|
||||
#define UT_TRY(x) try x
|
||||
#define UT_THROW(x) throw x
|
||||
#define UT_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody
|
||||
#define UT_CATCH_ALL(CatchBody) catch(...) CatchBody
|
||||
#else
|
||||
#define UT_TRY(x) x
|
||||
#define UT_THROW(x)
|
||||
#define UT_CATCH(ExceptionType, ExceptionName, CatchBody)
|
||||
#define UT_CATCH_ALL(CatchBody)
|
||||
#define UT_TRY(x) x
|
||||
#define UT_THROW(x)
|
||||
#define UT_CATCH(ExceptionType, ExceptionName, CatchBody)
|
||||
#define UT_CATCH_ALL(CatchBody)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,47 +6,47 @@
|
|||
#define UNITTEST_MULTILINE_MACRO_BEGIN do {
|
||||
|
||||
#if defined(UNITTEST_WIN32) && !defined(UNITTEST_COMPILER_IS_MSVC6)
|
||||
#define UNITTEST_MULTILINE_MACRO_END \
|
||||
} __pragma(warning(push)) __pragma(warning(disable: 4127)) while (0) __pragma(warning(pop))
|
||||
#define UNITTEST_MULTILINE_MACRO_END \
|
||||
} __pragma(warning(push)) __pragma(warning(disable: 4127)) while (0) __pragma(warning(pop))
|
||||
#else
|
||||
#define UNITTEST_MULTILINE_MACRO_END } while(0)
|
||||
#define UNITTEST_MULTILINE_MACRO_END } while(0)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef UNITTEST_WIN32_DLL
|
||||
#define UNITTEST_IMPORT __declspec(dllimport)
|
||||
#define UNITTEST_EXPORT __declspec(dllexport)
|
||||
#define UNITTEST_IMPORT __declspec(dllimport)
|
||||
#define UNITTEST_EXPORT __declspec(dllexport)
|
||||
|
||||
#ifdef UNITTEST_DLL_EXPORT
|
||||
#define UNITTEST_LINKAGE UNITTEST_EXPORT
|
||||
#define UNITTEST_IMPEXP_TEMPLATE
|
||||
#else
|
||||
#define UNITTEST_LINKAGE UNITTEST_IMPORT
|
||||
#define UNITTEST_IMPEXP_TEMPLATE extern
|
||||
#endif
|
||||
#ifdef UNITTEST_DLL_EXPORT
|
||||
#define UNITTEST_LINKAGE UNITTEST_EXPORT
|
||||
#define UNITTEST_IMPEXP_TEMPLATE
|
||||
#else
|
||||
#define UNITTEST_LINKAGE UNITTEST_IMPORT
|
||||
#define UNITTEST_IMPEXP_TEMPLATE extern
|
||||
#endif
|
||||
|
||||
#define UNITTEST_STDVECTOR_LINKAGE(T) \
|
||||
__pragma(warning(push)) \
|
||||
__pragma(warning(disable: 4231)) \
|
||||
UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::allocator< T >; \
|
||||
UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::vector< T >; \
|
||||
__pragma(warning(pop))
|
||||
#define UNITTEST_STDVECTOR_LINKAGE(T) \
|
||||
__pragma(warning(push)) \
|
||||
__pragma(warning(disable: 4231)) \
|
||||
UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::allocator< T >; \
|
||||
UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::vector< T >; \
|
||||
__pragma(warning(pop))
|
||||
#else
|
||||
#define UNITTEST_IMPORT
|
||||
#define UNITTEST_EXPORT
|
||||
#define UNITTEST_LINKAGE
|
||||
#define UNITTEST_IMPEXP_TEMPLATE
|
||||
#define UNITTEST_STDVECTOR_LINKAGE(T)
|
||||
#define UNITTEST_IMPORT
|
||||
#define UNITTEST_EXPORT
|
||||
#define UNITTEST_LINKAGE
|
||||
#define UNITTEST_IMPEXP_TEMPLATE
|
||||
#define UNITTEST_STDVECTOR_LINKAGE(T)
|
||||
#endif
|
||||
|
||||
#ifdef UNITTEST_WIN32
|
||||
#define UNITTEST_JMPBUF jmp_buf
|
||||
#define UNITTEST_SETJMP setjmp
|
||||
#define UNITTEST_LONGJMP longjmp
|
||||
#define UNITTEST_JMPBUF jmp_buf
|
||||
#define UNITTEST_SETJMP setjmp
|
||||
#define UNITTEST_LONGJMP longjmp
|
||||
#elif defined UNITTEST_POSIX
|
||||
#define UNITTEST_JMPBUF std::jmp_buf
|
||||
#define UNITTEST_SETJMP setjmp
|
||||
#define UNITTEST_LONGJMP std::longjmp
|
||||
#define UNITTEST_JMPBUF std::jmp_buf
|
||||
#define UNITTEST_SETJMP setjmp
|
||||
#define UNITTEST_LONGJMP std::longjmp
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "TestDetails.h"
|
||||
|
||||
#ifdef UNITTEST_NO_EXCEPTIONS
|
||||
#include "ReportAssertImpl.h"
|
||||
#include "ReportAssertImpl.h"
|
||||
#endif
|
||||
|
||||
namespace UnitTest {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "HelperMacros.h"
|
||||
|
||||
#ifdef UNITTEST_NO_EXCEPTIONS
|
||||
#include <csetjmp>
|
||||
#include <csetjmp>
|
||||
#endif
|
||||
|
||||
namespace UnitTest {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "Config.h"
|
||||
|
||||
#if defined UNITTEST_POSIX
|
||||
#include "Posix/TimeHelpers.h"
|
||||
#include "Posix/TimeHelpers.h"
|
||||
#else
|
||||
#include "Win32/TimeHelpers.h"
|
||||
#include "Win32/TimeHelpers.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -13,33 +13,33 @@ using namespace std;
|
|||
/* test for c++11 support */
|
||||
#ifndef _MSC_VER
|
||||
|
||||
/* Test for clang >= 3.3 */
|
||||
#ifdef __clang__
|
||||
#if (__clang__ == 1) && (__clang_major__ > 3 || (__clang_major__ == 3 && (__clang_minor__ > 2 )))
|
||||
#define _NOEXCEPT_OP(x) noexcept(x)
|
||||
#else
|
||||
#define _NOEXCEPT_OP(x)
|
||||
#endif
|
||||
#endif
|
||||
/* Test for clang >= 3.3 */
|
||||
#ifdef __clang__
|
||||
#if (__clang__ == 1) && (__clang_major__ > 3 || (__clang_major__ == 3 && (__clang_minor__ > 2 )))
|
||||
#define _NOEXCEPT_OP(x) noexcept(x)
|
||||
#else
|
||||
#define _NOEXCEPT_OP(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __clang__
|
||||
/* Test for GCC >= 4.8.0 */
|
||||
#ifdef __GNUC__
|
||||
#if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ > 7 ))
|
||||
#define _NOEXCEPT_OP(x) noexcept(x)
|
||||
#else
|
||||
#define _NOEXCEPT_OP(x)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifndef __clang__
|
||||
/* Test for GCC >= 4.8.0 */
|
||||
#ifdef __GNUC__
|
||||
#if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ > 7 ))
|
||||
#define _NOEXCEPT_OP(x) noexcept(x)
|
||||
#else
|
||||
#define _NOEXCEPT_OP(x)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#elif _MSC_VER
|
||||
|
||||
#if (_MSC_VER > 1800)
|
||||
#define _NOEXCEPT_OP(x) noexcept(x)
|
||||
#else
|
||||
#define _NOEXCEPT_OP(x)
|
||||
#endif
|
||||
#if (_MSC_VER > 1800)
|
||||
#define _NOEXCEPT_OP(x) noexcept(x)
|
||||
#else
|
||||
#define _NOEXCEPT_OP(x)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue