diff --git a/glueHeaders.py b/glueHeaders.py index be7a8900..f9202e63 100644 --- a/glueHeaders.py +++ b/glueHeaders.py @@ -1,6 +1,7 @@ import os import sys import re +import datetime includesParser = re.compile( r'\s*#include\s*"(.*)"' ) guardParser = re.compile( r'\s*#.*_INCLUDED') @@ -38,6 +39,8 @@ def parseFile( path, filename ): print line.rstrip() print "/*" +print " * Generated: " + str( datetime.datetime.now() ) +print " * ----------------------------------------------------------" print " * This file has been merged from multiple headers. Please don't edit it directly" print " * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved." print " *" diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 63ba342a..b80cb1ad 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,4 +1,6 @@ /* + * Generated: 2012-05-22 22:16:20.449820 + * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. * @@ -8,9 +10,7 @@ #ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED #define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED -// #included from: internal/catch_context.h - -// #included from: catch_interfaces_reporter.h +// #included from: internal/catch_test_case_info.hpp // #included from: catch_common.h @@ -110,6 +110,149 @@ namespace Catch { #define CATCH_INTERNAL_ERROR( msg ) throwLogicError( msg, __FILE__, __LINE__ ); #define CATCH_INTERNAL_LINEINFO ::Catch::SourceLineInfo( __FILE__, __LINE__ ) +// #included from: catch_interfaces_testcase.h + +#include + +namespace Catch { + struct ITestCase { + virtual ~ITestCase(){} + virtual void invoke () const = 0; + virtual ITestCase* clone() const = 0; + virtual bool operator == ( const ITestCase& other ) const = 0; + virtual bool operator < ( const ITestCase& other ) const = 0; + }; + + class TestCaseInfo; + + struct ITestCaseRegistry { + virtual ~ITestCaseRegistry(){} + virtual void registerTest( const TestCaseInfo& testInfo ) = 0; + virtual const std::vector& getAllTests() const = 0; + virtual std::vector getMatchingTestCases( const std::string& rawTestSpec ) = 0; + }; +} + +#include +#include + +namespace Catch { + + class TestCaseInfo { + public: + TestCaseInfo( ITestCase* testCase, + const char* name, + const char* description, + const SourceLineInfo& lineInfo ) + : m_test( testCase ), + m_name( name ), + m_description( description ), + m_lineInfo( lineInfo ) + {} + + TestCaseInfo() + : m_test( NULL ), + m_name(), + m_description() + {} + + TestCaseInfo( const TestCaseInfo& other ) + : m_test( other.m_test->clone() ), + m_name( other.m_name ), + m_description( other.m_description ), + m_lineInfo( other.m_lineInfo ) + {} + + TestCaseInfo( const TestCaseInfo& other, const std::string& name ) + : m_test( other.m_test->clone() ), + m_name( name ), + m_description( other.m_description ), + m_lineInfo( other.m_lineInfo ) + {} + + TestCaseInfo& operator = ( const TestCaseInfo& other ) { + TestCaseInfo temp( other ); + swap( temp ); + return *this; + } + + ~TestCaseInfo() { + delete m_test; + } + + void invoke() const { + m_test->invoke(); + } + + const std::string& getName() const { + return m_name; + } + + const std::string& getDescription() const { + return m_description; + } + + const SourceLineInfo& getLineInfo() const { + return m_lineInfo; + } + + bool isHidden() const { + return m_name.size() >= 2 && m_name[0] == '.' && m_name[1] == '/'; + } + + void swap( TestCaseInfo& other ) { + std::swap( m_test, other.m_test ); + m_name.swap( other.m_name ); + m_description.swap( other.m_description ); + m_lineInfo.swap( other.m_lineInfo ); + } + + bool operator == ( const TestCaseInfo& other ) const { + return *m_test == *other.m_test && m_name == other.m_name; + } + + bool operator < ( const TestCaseInfo& other ) const { + return m_name < other.m_name; + } + + private: + ITestCase* m_test; + std::string m_name; + std::string m_description; + SourceLineInfo m_lineInfo; + }; + + /////////////////////////////////////////////////////////////////////////// + + class TestSpec { + public: + TestSpec( const std::string& rawSpec ) + : m_rawSpec( rawSpec ), + m_isWildcarded( false ) { + + if( m_rawSpec[m_rawSpec.size()-1] == '*' ) { + m_rawSpec = m_rawSpec.substr( 0, m_rawSpec.size()-1 ); + m_isWildcarded = true; + } + } + + bool matches ( const std::string& testName ) const { + if( !m_isWildcarded ) + return m_rawSpec == testName; + else + return testName.size() >= m_rawSpec.size() && testName.substr( 0, m_rawSpec.size() ) == m_rawSpec; + } + + private: + std::string m_rawSpec; + bool m_isWildcarded; + }; +} + +// #included from: internal/catch_context.h + +// #included from: catch_interfaces_reporter.h + // #included from: catch_totals.hpp namespace Catch { @@ -373,29 +516,6 @@ namespace Catch { // #included from: internal/catch_test_registry.hpp -// #included from: catch_interfaces_testcase.h - -#include - -namespace Catch { - struct ITestCase { - virtual ~ITestCase(){} - virtual void invoke () const = 0; - virtual ITestCase* clone() const = 0; - virtual bool operator == ( const ITestCase& other ) const = 0; - virtual bool operator < ( const ITestCase& other ) const = 0; - }; - - class TestCaseInfo; - - struct ITestCaseRegistry { - virtual ~ITestCaseRegistry(){} - virtual void registerTest( const TestCaseInfo& testInfo ) = 0; - virtual const std::vector& getAllTests() const = 0; - virtual std::vector getMatchingTestCases( const std::string& rawTestSpec ) = 0; - }; -} - namespace Catch { template @@ -1882,124 +2002,6 @@ using namespace Matchers; // NB. Any general catch headers included here must be included // in catch.hpp first to make sure they are included by the single // header for non obj-usage -// #included from: internal/catch_test_case_info.hpp - -#include -#include - -namespace Catch { - - class TestCaseInfo { - public: - TestCaseInfo( ITestCase* testCase, - const char* name, - const char* description, - const SourceLineInfo& lineInfo ) - : m_test( testCase ), - m_name( name ), - m_description( description ), - m_lineInfo( lineInfo ) - {} - - TestCaseInfo() - : m_test( NULL ), - m_name(), - m_description() - {} - - TestCaseInfo( const TestCaseInfo& other ) - : m_test( other.m_test->clone() ), - m_name( other.m_name ), - m_description( other.m_description ), - m_lineInfo( other.m_lineInfo ) - {} - - TestCaseInfo( const TestCaseInfo& other, const std::string& name ) - : m_test( other.m_test->clone() ), - m_name( name ), - m_description( other.m_description ), - m_lineInfo( other.m_lineInfo ) - {} - - TestCaseInfo& operator = ( const TestCaseInfo& other ) { - TestCaseInfo temp( other ); - swap( temp ); - return *this; - } - - ~TestCaseInfo() { - delete m_test; - } - - void invoke() const { - m_test->invoke(); - } - - const std::string& getName() const { - return m_name; - } - - const std::string& getDescription() const { - return m_description; - } - - const SourceLineInfo& getLineInfo() const { - return m_lineInfo; - } - - bool isHidden() const { - return m_name.size() >= 2 && m_name[0] == '.' && m_name[1] == '/'; - } - - void swap( TestCaseInfo& other ) { - std::swap( m_test, other.m_test ); - m_name.swap( other.m_name ); - m_description.swap( other.m_description ); - m_lineInfo.swap( other.m_lineInfo ); - } - - bool operator == ( const TestCaseInfo& other ) const { - return *m_test == *other.m_test && m_name == other.m_name; - } - - bool operator < ( const TestCaseInfo& other ) const { - return m_name < other.m_name; - } - - private: - ITestCase* m_test; - std::string m_name; - std::string m_description; - SourceLineInfo m_lineInfo; - }; - - /////////////////////////////////////////////////////////////////////////// - - class TestSpec { - public: - TestSpec( const std::string& rawSpec ) - : m_rawSpec( rawSpec ), - m_isWildcarded( false ) { - - if( m_rawSpec[m_rawSpec.size()-1] == '*' ) { - m_rawSpec = m_rawSpec.substr( 0, m_rawSpec.size()-1 ); - m_isWildcarded = true; - } - } - - bool matches ( const std::string& testName ) const { - if( !m_isWildcarded ) - return m_rawSpec == testName; - else - return testName.size() >= m_rawSpec.size() && testName.substr( 0, m_rawSpec.size() ) == m_rawSpec; - } - - private: - std::string m_rawSpec; - bool m_isWildcarded; - }; -} - #ifdef __has_feature #define CATCH_ARC_ENABLED __has_feature(objc_arc)