11/*
2- * Catch v1.6.0
3- * Generated: 2017-01-11 16:38:09.405017
2+ * Catch v1.6.1
3+ * Generated: 2017-01-20 12:33:53.497767
44 * ----------------------------------------------------------
55 * This file has been merged from multiple headers. Please don't edit it directly
66 * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
266266#if defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_NO_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_CPP11)
267267# define CATCH_CONFIG_CPP11_UNIQUE_PTR
268268#endif
269- #if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
269+ // Use of __COUNTER__ is suppressed if __JETBRAINS_IDE__ is #defined (meaning we're being parsed by a JetBrains IDE for
270+ // analytics) because, at time of writing, __COUNTER__ is not properly handled by it.
271+ // This does not affect compilation
272+ #if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) && !defined(__JETBRAINS_IDE__)
270273# define CATCH_CONFIG_COUNTER
271274#endif
272275#if defined(CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE) && !defined(CATCH_CONFIG_CPP11_NO_SHUFFLE) && !defined(CATCH_CONFIG_CPP11_SHUFFLE) && !defined(CATCH_CONFIG_NO_CPP11)
@@ -411,9 +414,8 @@ namespace Catch {
411414 std::ostream& operator << ( std::ostream& os, SourceLineInfo const & info );
412415
413416 // This is just here to avoid compiler warnings with macro constants and boolean literals
414- inline bool isTrue ( bool value ){ return value; }
415- inline bool alwaysTrue () { return true ; }
416- inline bool alwaysFalse () { return false ; }
417+ inline bool alwaysTrue ( std::size_t = 0 ) { return true ; }
418+ inline bool alwaysFalse ( std::size_t = 0 ) { return false ; }
417419
418420 void throwLogicError ( std::string const & message, SourceLineInfo const & locationInfo );
419421
@@ -2005,11 +2007,19 @@ namespace Catch {
20052007#define TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED
20062008
20072009#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
2008- #define CATCH_PLATFORM_MAC
2010+ # define CATCH_PLATFORM_MAC
20092011#elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
2010- #define CATCH_PLATFORM_IPHONE
2012+ # define CATCH_PLATFORM_IPHONE
2013+ #elif defined(linux) || defined(__linux) || defined(__linux__)
2014+ # define CATCH_PLATFORM_LINUX
20112015#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER)
2012- #define CATCH_PLATFORM_WINDOWS
2016+ # define CATCH_PLATFORM_WINDOWS
2017+ # if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX)
2018+ # define CATCH_DEFINES_NOMINMAX
2019+ # endif
2020+ # if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN)
2021+ # define CATCH_DEFINES_WIN32_LEAN_AND_MEAN
2022+ # endif
20132023#endif
20142024
20152025#include < string>
@@ -2026,25 +2036,36 @@ namespace Catch{
20262036 // http://cocoawithlove.com/2008/03/break-into-debugger.html
20272037 #ifdef DEBUG
20282038 #if defined(__ppc64__) || defined(__ppc__)
2029- #define CATCH_BREAK_INTO_DEBUGGER () \
2030- if ( Catch::isDebuggerActive() ) { \
2039+ #define CATCH_TRAP () \
20312040 __asm__ (" li r0, 20\n sc\n nop\n li r0, 37\n li r4, 2\n sc\n nop\n " \
2032- : : : " memory" ," r0" ," r3" ," r4" ); \
2033- }
2041+ : : : " memory" ," r0" ," r3" ," r4" )
20342042 #else
2035- #define CATCH_BREAK_INTO_DEBUGGER () if ( Catch::isDebuggerActive() ) { __asm__ ( " int $3\n " : : );}
2043+ #define CATCH_TRAP () _asm__( " int $3\n " : : )
20362044 #endif
20372045 #endif
20382046
2047+ #elif defined(CATCH_PLATFORM_LINUX)
2048+ // If we can use inline assembler, do it because this allows us to break
2049+ // directly at the location of the failing check instead of breaking inside
2050+ // raise() called from it, i.e. one stack frame below.
2051+ #if defined(__GNUC__) && (defined(__i386) || defined(__x86_64))
2052+ #define CATCH_TRAP () asm volatile (" int $3" )
2053+ #else // Fall back to the generic way.
2054+ #include < signal.h>
2055+
2056+ #define CATCH_TRAP () raise(SIGTRAP)
2057+ #endif
20392058#elif defined(_MSC_VER)
2040- #define CATCH_BREAK_INTO_DEBUGGER () if ( Catch::isDebuggerActive() ) { __debugbreak (); }
2059+ #define CATCH_TRAP () __debugbreak()
20412060#elif defined(__MINGW32__)
20422061 extern " C" __declspec(dllimport) void __stdcall DebugBreak ();
2043- #define CATCH_BREAK_INTO_DEBUGGER () if ( Catch::isDebuggerActive() ) { DebugBreak (); }
2062+ #define CATCH_TRAP () DebugBreak()
20442063#endif
20452064
2046- #ifndef CATCH_BREAK_INTO_DEBUGGER
2047- #define CATCH_BREAK_INTO_DEBUGGER () Catch::alwaysTrue();
2065+ #ifdef CATCH_TRAP
2066+ #define CATCH_BREAK_INTO_DEBUGGER () if ( Catch::isDebuggerActive() ) { CATCH_TRAP (); }
2067+ #else
2068+ #define CATCH_BREAK_INTO_DEBUGGER () Catch::alwaysTrue();
20482069#endif
20492070
20502071// #included from: catch_interfaces_runner.h
@@ -2080,7 +2101,7 @@ namespace Catch {
20802101 __catchResult.useActiveException ( Catch::ResultDisposition::Normal ); \
20812102 } \
20822103 INTERNAL_CATCH_REACT ( __catchResult ) \
2083- } while ( Catch::isTrue( false && !! (expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look
2104+ } while ( Catch::alwaysFalse( sizeof (expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look
20842105
20852106// /////////////////////////////////////////////////////////////////////////////
20862107#define INTERNAL_CATCH_IF ( expr, resultDisposition, macroName ) \
@@ -6981,6 +7002,11 @@ namespace Catch {
69817002 Context ( Context const & );
69827003 void operator =( Context const & );
69837004
7005+ public:
7006+ virtual ~Context () {
7007+ deleteAllValues ( m_generatorsByTestName );
7008+ }
7009+
69847010 public: // IContext
69857011 virtual IResultCapture* getResultCapture () {
69867012 return m_resultCapture;
@@ -7094,8 +7120,15 @@ namespace Catch {
70947120
70957121#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) // ///////////////////////////////////////
70967122
7097- #ifndef NOMINMAX
7098- #define NOMINMAX
7123+ // #included from: catch_windows_h_proxy.h
7124+
7125+ #define TWOBLUECUBES_CATCH_WINDOWS_H_PROXY_H_INCLUDED
7126+
7127+ #ifdef CATCH_DEFINES_NOMINMAX
7128+ # define NOMINMAX
7129+ #endif
7130+ #ifdef CATCH_DEFINES_WIN32_LEAN_AND_MEAN
7131+ # define WIN32_LEAN_AND_MEAN
70997132#endif
71007133
71017134#ifdef __AFXDLL
@@ -7104,6 +7137,13 @@ namespace Catch {
71047137#include < windows.h>
71057138#endif
71067139
7140+ #ifdef CATCH_DEFINES_NOMINMAX
7141+ # undef NOMINMAX
7142+ #endif
7143+ #ifdef CATCH_DEFINES_WIN32_LEAN_AND_MEAN
7144+ # undef WIN32_LEAN_AND_MEAN
7145+ #endif
7146+
71077147namespace Catch {
71087148namespace {
71097149
@@ -7619,7 +7659,7 @@ namespace Catch {
76197659 return os;
76207660 }
76217661
7622- Version libraryVersion ( 1 , 6 , 0 , " " , 0 );
7662+ Version libraryVersion ( 1 , 6 , 1 , " " , 0 );
76237663
76247664}
76257665
@@ -7790,7 +7830,6 @@ namespace Catch
77907830#endif
77917831
77927832#ifdef CATCH_PLATFORM_WINDOWS
7793- #include < windows.h>
77947833#else
77957834#include < sys/time.h>
77967835#endif
@@ -8030,6 +8069,33 @@ namespace Catch {
80308069 }
80318070 } // namespace Catch
80328071
8072+ #elif defined(CATCH_PLATFORM_LINUX)
8073+ #include < fstream>
8074+ #include < string>
8075+
8076+ namespace Catch {
8077+ // The standard POSIX way of detecting a debugger is to attempt to
8078+ // ptrace() the process, but this needs to be done from a child and not
8079+ // this process itself to still allow attaching to this process later
8080+ // if wanted, so is rather heavy. Under Linux we have the PID of the
8081+ // "debugger" (which doesn't need to be gdb, of course, it could also
8082+ // be strace, for example) in /proc/$PID/status, so just get it from
8083+ // there instead.
8084+ bool isDebuggerActive (){
8085+ std::ifstream in (" /proc/self/status" );
8086+ for ( std::string line; std::getline (in, line); ) {
8087+ static const int PREFIX_LEN = 11 ;
8088+ if ( line.compare (0 , PREFIX_LEN, " TracerPid:\t " ) == 0 ) {
8089+ // We're traced if the PID is not 0 and no other PID starts
8090+ // with 0 digit, so it's enough to check for just a single
8091+ // character.
8092+ return line.length () > PREFIX_LEN && line[PREFIX_LEN] != ' 0' ;
8093+ }
8094+ }
8095+
8096+ return false ;
8097+ }
8098+ } // namespace Catch
80338099#elif defined(_MSC_VER)
80348100 extern " C" __declspec(dllimport) int __stdcall IsDebuggerPresent ();
80358101 namespace Catch {
@@ -9390,6 +9456,35 @@ namespace Catch {
93909456
93919457namespace Catch {
93929458
9459+ namespace {
9460+ std::string getCurrentTimestamp () {
9461+ // Beware, this is not reentrant because of backward compatibility issues
9462+ // Also, UTC only, again because of backward compatibility (%z is C++11)
9463+ time_t rawtime;
9464+ std::time (&rawtime);
9465+ const size_t timeStampSize = sizeof (" 2017-01-16T17:06:45Z" );
9466+
9467+ #ifdef CATCH_PLATFORM_WINDOWS
9468+ std::tm timeInfo = {};
9469+ gmtime_s (&timeInfo, &rawtime);
9470+ #else
9471+ std::tm* timeInfo;
9472+ timeInfo = std::gmtime (&rawtime);
9473+ #endif
9474+
9475+ char timeStamp[timeStampSize];
9476+ const char * const fmt = " %Y-%m-%dT%H:%M:%SZ" ;
9477+
9478+ #ifdef CATCH_PLATFORM_WINDOWS
9479+ std::strftime (timeStamp, timeStampSize, fmt, &timeInfo);
9480+ #else
9481+ std::strftime (timeStamp, timeStampSize, fmt, timeInfo);
9482+ #endif
9483+ return std::string (timeStamp);
9484+ }
9485+
9486+ }
9487+
93939488 class JunitReporter : public CumulativeReporterBase {
93949489 public:
93959490 JunitReporter ( ReporterConfig const & _config )
@@ -9454,7 +9549,7 @@ namespace Catch {
94549549 xml.writeAttribute ( " time" , " " );
94559550 else
94569551 xml.writeAttribute ( " time" , suiteTime );
9457- xml.writeAttribute ( " timestamp" , " tbd " ); // !TBD
9552+ xml.writeAttribute ( " timestamp" , getCurrentTimestamp () );
94589553
94599554 // Write test cases
94609555 for ( TestGroupNode::ChildNodes::const_iterator
@@ -10442,7 +10537,7 @@ int main (int argc, char * const argv[]) {
1044210537#define CATCH_CHECK_THROWS_WITH ( expr, matcher ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::ContinueOnFailure, matcher, " CATCH_CHECK_THROWS_WITH" )
1044310538#define CATCH_CHECK_NOTHROW ( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::ContinueOnFailure, " CATCH_CHECK_NOTHROW" )
1044410539
10445- #define CHECK_THAT ( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::ContinueOnFailure, " CATCH_CHECK_THAT" )
10540+ #define CATCH_CHECK_THAT ( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::ContinueOnFailure, " CATCH_CHECK_THAT" )
1044610541#define CATCH_REQUIRE_THAT ( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::Normal, " CATCH_REQUIRE_THAT" )
1044710542
1044810543#define CATCH_INFO ( msg ) INTERNAL_CATCH_INFO( msg, " CATCH_INFO" )
0 commit comments