From c1a8e1c5dd77e4f98a4f678556592ef23a3dd4ac Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 22 Aug 2014 08:07:39 +0100 Subject: [PATCH 001/102] Added signal handlers (and placeholder for SEH handlers) - based on PR 232 (https://github.com/philsquared/Catch/pull/232 - thanks Lukasz Forynski) - Writes to reporter, so gets all the usual context, but then exits directly (since the stack cannot be resumed) so no summary - On Windows does nothing, as yet. --- include/internal/catch_fatal_condition.hpp | 78 +++++++++++++++++++ include/internal/catch_interfaces_capture.h | 3 + include/internal/catch_result_type.h | 4 +- include/internal/catch_runner_impl.hpp | 23 ++++-- include/reporters/catch_reporter_compact.hpp | 7 ++ include/reporters/catch_reporter_console.hpp | 5 ++ include/reporters/catch_reporter_junit.hpp | 1 + include/reporters/catch_reporter_xml.hpp | 7 ++ projects/SelfTest/MiscTests.cpp | 6 ++ .../CatchSelfTest.xcodeproj/project.pbxproj | 2 + 10 files changed, 128 insertions(+), 8 deletions(-) create mode 100644 include/internal/catch_fatal_condition.hpp diff --git a/include/internal/catch_fatal_condition.hpp b/include/internal/catch_fatal_condition.hpp new file mode 100644 index 00000000..08c4dcc2 --- /dev/null +++ b/include/internal/catch_fatal_condition.hpp @@ -0,0 +1,78 @@ +/* + * Created by Phil on 21/08/2014 + * Copyright 2014 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + * + */ +#ifndef TWOBLUECUBES_CATCH_FATAL_CONDITION_H_INCLUDED +#define TWOBLUECUBES_CATCH_FATAL_CONDITION_H_INCLUDED + + +namespace Catch { + + // Report the error condition then exit the process + inline void fatal( std::string const& message, int exitCode ) { + IContext& context = Catch::getCurrentContext(); + IResultCapture* resultCapture = context.getResultCapture(); + ResultBuilder resultBuilder = resultCapture->makeUnexpectedResultBuilder(); + resultBuilder.setResultType( ResultWas::FatalErrorCondition ); + resultBuilder << message; + resultBuilder.captureExpression(); + + if( Catch::alwaysTrue() ) // avoids "no return" warnings + exit( exitCode ); + } + +} // namespace Catch + +#if defined ( CATCH_PLATFORM_WINDOWS ) ///////////////////////////////////////// + +namespace Catch { + + struct FatalConditionHandler {}; + +} // namespace Catch + +#else // Not Windows - assumed to be POSIX compatible ////////////////////////// + +#include + +namespace Catch { + + struct SignalDefs { int id; const char* name; }; + extern SignalDefs signalDefs[]; + SignalDefs signalDefs[] = { + { SIGINT, "SIGINT - Terminal interrupt signal" }, + { SIGILL, "SIGILL - Illegal instruction signal" }, + { SIGFPE, "SIGFPE - Floating point error signal" }, + { SIGSEGV, "SIGSEGV - Segmentation violation signal" }, + { SIGTERM, "SIGTERM - Termination request signal" }, + { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" } + }; + + struct FatalConditionHandler { + + static void handleSignal( int sig ) { + for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) + if( sig == signalDefs[i].id ) + fatal( signalDefs[i].name, -sig ); + fatal( "", -sig ); + } + + FatalConditionHandler() { + for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) + signal( signalDefs[i].id, handleSignal ); + } + ~FatalConditionHandler() { + for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) + signal( signalDefs[i].id, SIG_DFL ); + } + }; + +} // namespace Catch + +#endif // not Windows + +#endif // TWOBLUECUBES_CATCH_FATAL_CONDITION_H_INCLUDED diff --git a/include/internal/catch_interfaces_capture.h b/include/internal/catch_interfaces_capture.h index 6565f0e6..b9d1e874 100644 --- a/include/internal/catch_interfaces_capture.h +++ b/include/internal/catch_interfaces_capture.h @@ -21,6 +21,7 @@ namespace Catch { struct MessageInfo; class ScopedMessageBuilder; struct Counts; + class ResultBuilder; struct IResultCapture { @@ -35,6 +36,8 @@ namespace Catch { virtual std::string getCurrentTestName() const = 0; virtual const AssertionResult* getLastResult() const = 0; + + virtual ResultBuilder makeUnexpectedResultBuilder() const = 0; }; IResultCapture& getResultCapture(); diff --git a/include/internal/catch_result_type.h b/include/internal/catch_result_type.h index ce00ef03..31ad3e60 100644 --- a/include/internal/catch_result_type.h +++ b/include/internal/catch_result_type.h @@ -25,7 +25,9 @@ namespace Catch { Exception = 0x100 | FailureBit, ThrewException = Exception | 1, - DidntThrowException = Exception | 2 + DidntThrowException = Exception | 2, + + FatalErrorCondition = 0x200 | FailureBit }; }; diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp index fa4f3193..47b2e2be 100644 --- a/include/internal/catch_runner_impl.hpp +++ b/include/internal/catch_runner_impl.hpp @@ -20,6 +20,7 @@ #include "catch_test_case_tracker.hpp" #include "catch_timer.h" #include "catch_result_builder.h" +#include "catch_fatal_condition.hpp" #include #include @@ -215,6 +216,13 @@ namespace Catch { return m_totals.assertions.failed == static_cast( m_config->abortAfter() ); } + virtual ResultBuilder makeUnexpectedResultBuilder() const { + return ResultBuilder( m_lastAssertionInfo.macroName.c_str(), + m_lastAssertionInfo.lineInfo, + m_lastAssertionInfo.capturedExpression.c_str(), + m_lastAssertionInfo.resultDisposition ); + } + private: void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr ) { @@ -232,10 +240,10 @@ namespace Catch { if( m_reporter->getPreferences().shouldRedirectStdOut ) { StreamRedirect coutRedir( std::cout, redirectedCout ); StreamRedirect cerrRedir( std::cerr, redirectedCerr ); - m_activeTestCase->invoke(); + invokeActiveTestCase(); } else { - m_activeTestCase->invoke(); + invokeActiveTestCase(); } duration = timer.getElapsedSeconds(); } @@ -243,11 +251,7 @@ namespace Catch { // This just means the test was aborted due to failure } catch(...) { - ResultBuilder exResult( m_lastAssertionInfo.macroName.c_str(), - m_lastAssertionInfo.lineInfo, - m_lastAssertionInfo.capturedExpression.c_str(), - m_lastAssertionInfo.resultDisposition ); - exResult.useActiveException(); + makeUnexpectedResultBuilder().useActiveException(); } // If sections ended prematurely due to an exception we stored their // infos here so we can tear them down outside the unwind process. @@ -272,6 +276,11 @@ namespace Catch { m_reporter->sectionEnded( testCaseSectionStats ); } + void invokeActiveTestCase() { + FatalConditionHandler fatalConditionHandler; // Handle signals + m_activeTestCase->invoke(); + } + private: struct UnfinishedSections { UnfinishedSections( SectionInfo const& _info, Counts const& _prevAssertions, double _durationInSeconds ) diff --git a/include/reporters/catch_reporter_compact.hpp b/include/reporters/catch_reporter_compact.hpp index 7a6353e6..a5a17297 100644 --- a/include/reporters/catch_reporter_compact.hpp +++ b/include/reporters/catch_reporter_compact.hpp @@ -109,6 +109,13 @@ namespace Catch { printExpressionWas(); printRemainingMessages(); break; + case ResultWas::FatalErrorCondition: + printResultType( Colour::Error, failedString() ); + printIssue( "fatal error condition with message:" ); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; case ResultWas::DidntThrowException: printResultType( Colour::Error, failedString() ); printIssue( "expected exception, got none" ); diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp index 7246d328..83498327 100644 --- a/include/reporters/catch_reporter_console.hpp +++ b/include/reporters/catch_reporter_console.hpp @@ -149,6 +149,11 @@ namespace Catch { passOrFail = "FAILED"; messageLabel = "due to unexpected exception with message"; break; + case ResultWas::FatalErrorCondition: + colour = Colour::Error; + passOrFail = "FAILED"; + messageLabel = "due to a fatal error condition"; + break; case ResultWas::DidntThrowException: colour = Colour::Error; passOrFail = "FAILED"; diff --git a/include/reporters/catch_reporter_junit.hpp b/include/reporters/catch_reporter_junit.hpp index 63f7e148..1108794b 100644 --- a/include/reporters/catch_reporter_junit.hpp +++ b/include/reporters/catch_reporter_junit.hpp @@ -168,6 +168,7 @@ namespace Catch { std::string elementName; switch( result.getResultType() ) { case ResultWas::ThrewException: + case ResultWas::FatalErrorCondition: elementName = "error"; break; case ResultWas::ExplicitFailure: diff --git a/include/reporters/catch_reporter_xml.hpp b/include/reporters/catch_reporter_xml.hpp index aa2cfeda..4687471a 100644 --- a/include/reporters/catch_reporter_xml.hpp +++ b/include/reporters/catch_reporter_xml.hpp @@ -108,6 +108,13 @@ namespace Catch { .writeText( assertionResult.getMessage() ); m_currentTestSuccess = false; break; + case ResultWas::FatalErrorCondition: + m_xml.scopedElement( "Fatal Error Condition" ) + .writeAttribute( "filename", assertionResult.getSourceInfo().file ) + .writeAttribute( "line", assertionResult.getSourceInfo().line ) + .writeText( assertionResult.getMessage() ); + m_currentTestSuccess = false; + break; case ResultWas::Info: m_xml.scopedElement( "Info" ) .writeText( assertionResult.getMessage() ); diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp index b229c766..49cfcf63 100644 --- a/projects/SelfTest/MiscTests.cpp +++ b/projects/SelfTest/MiscTests.cpp @@ -380,3 +380,9 @@ TEST_CASE( "toString on wchar_t returns the string contents", "[toString]" ) { std::string result = Catch::toString( s ); CHECK( result == "\"wide load\"" ); } + +TEST_CASE( "Divide by Zero signal handler", "[.][sig]" ) { + int i = 0; + int x = 10/i; // This should cause the signal to fire + CHECK( x == 0 ); +} diff --git a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj index 31fc5253..d0420a71 100644 --- a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj +++ b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj @@ -66,6 +66,7 @@ 2627F7061935B55F009BCE2D /* catch_result_builder.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_result_builder.hpp; sourceTree = ""; }; 262E7399184673A800CAC268 /* catch_reporter_bases.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_reporter_bases.hpp; sourceTree = ""; }; 262E739A1846759000CAC268 /* catch_common.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_common.hpp; sourceTree = ""; }; + 263F7A4519A66608009474C2 /* catch_fatal_condition.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_fatal_condition.hpp; sourceTree = ""; }; 263FD06017AF8DF200988A20 /* catch_timer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_timer.hpp; sourceTree = ""; }; 263FD06117AF8DF200988A20 /* catch_timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_timer.h; sourceTree = ""; }; 2656C21F1925E5100040DB02 /* catch_test_spec_parser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_test_spec_parser.hpp; sourceTree = ""; }; @@ -453,6 +454,7 @@ 268F47B018A93F7800D8C14F /* catch_clara.h */, 2656C226192A77EF0040DB02 /* catch_suppress_warnings.h */, 2656C227192A78410040DB02 /* catch_reenable_warnings.h */, + 263F7A4519A66608009474C2 /* catch_fatal_condition.hpp */, ); name = Infrastructure; sourceTree = ""; From 8edf4bf5d3a0a740af8fae9c88aea6519f071330 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 22 Aug 2014 08:13:15 +0100 Subject: [PATCH 002/102] Removed signal handler test, for now (to avoid screwing up the approval tests) --- projects/SelfTest/MiscTests.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp index 49cfcf63..86bd4f39 100644 --- a/projects/SelfTest/MiscTests.cpp +++ b/projects/SelfTest/MiscTests.cpp @@ -381,8 +381,8 @@ TEST_CASE( "toString on wchar_t returns the string contents", "[toString]" ) { CHECK( result == "\"wide load\"" ); } -TEST_CASE( "Divide by Zero signal handler", "[.][sig]" ) { - int i = 0; - int x = 10/i; // This should cause the signal to fire - CHECK( x == 0 ); -} +//TEST_CASE( "Divide by Zero signal handler", "[.][sig]" ) { +// int i = 0; +// int x = 10/i; // This should cause the signal to fire +// CHECK( x == 0 ); +//} From cb8fe472b2c4b5b6ccde152150387220b78e2ea0 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 22 Aug 2014 08:13:47 +0100 Subject: [PATCH 003/102] Approvals for develop branch --- .../Baselines/console.std.approved.txt | 2 +- .../Baselines/console.sw.approved.txt | 2 +- .../Baselines/console.swa4.approved.txt | 2 +- .../SelfTest/Baselines/xml.sw.approved.txt | 1400 ++++++++--------- 4 files changed, 703 insertions(+), 703 deletions(-) diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 3b67d501..96335b15 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -1,6 +1,6 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -CatchSelfTest is a host application. +CatchSelfTest is a (develop) host application. Run with -? for options ------------------------------------------------------------------------------- diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index d7bd8232..cdc918bd 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -1,6 +1,6 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -CatchSelfTest is a host application. +CatchSelfTest is a (develop) host application. Run with -? for options ------------------------------------------------------------------------------- diff --git a/projects/SelfTest/Baselines/console.swa4.approved.txt b/projects/SelfTest/Baselines/console.swa4.approved.txt index ac06c1c7..f48083e0 100644 --- a/projects/SelfTest/Baselines/console.swa4.approved.txt +++ b/projects/SelfTest/Baselines/console.swa4.approved.txt @@ -1,6 +1,6 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -CatchSelfTest is a host application. +CatchSelfTest is a (develop) host application. Run with -? for options ------------------------------------------------------------------------------- diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 1789cb2e..2011abf5 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -1,7 +1,7 @@ - + d == Approx( 1.23 ) @@ -9,7 +9,7 @@ 1.23 == Approx( 1.23 ) - + d != Approx( 1.22 ) @@ -17,7 +17,7 @@ 1.23 != Approx( 1.22 ) - + d != Approx( 1.24 ) @@ -25,7 +25,7 @@ 1.23 != Approx( 1.24 ) - + Approx( d ) == 1.23 @@ -33,7 +33,7 @@ Approx( 1.23 ) == 1.23 - + Approx( d ) != 1.22 @@ -41,7 +41,7 @@ Approx( 1.23 ) != 1.22 - + Approx( d ) != 1.24 @@ -52,7 +52,7 @@ - + d != Approx( 1.231 ) @@ -60,7 +60,7 @@ 1.23 != Approx( 1.231 ) - + d == Approx( 1.231 ).epsilon( 0.1 ) @@ -71,7 +71,7 @@ - + 1.23f == Approx( 1.23f ) @@ -79,7 +79,7 @@ 1.23f == Approx( 1.2300000191 ) - + 0.0f == Approx( 0.0f ) @@ -90,7 +90,7 @@ - + 1 == Approx( 1 ) @@ -98,7 +98,7 @@ 1 == Approx( 1.0 ) - + 0 == Approx( 0 ) @@ -109,7 +109,7 @@ - + 1.0f == Approx( 1 ) @@ -117,7 +117,7 @@ 1.0f == Approx( 1.0 ) - + 0 == Approx( dZero) @@ -125,7 +125,7 @@ 0 == Approx( 0.0 ) - + 0 == Approx( dSmall ).epsilon( 0.001 ) @@ -133,7 +133,7 @@ 0 == Approx( 0.00001 ) - + 1.234f == Approx( dMedium ) @@ -141,7 +141,7 @@ 1.234f == Approx( 1.234 ) - + dMedium == Approx( 1.234f ) @@ -152,7 +152,7 @@ - + d == approx( 1.23 ) @@ -160,7 +160,7 @@ 1.23 == Approx( 1.23 ) - + d == approx( 1.22 ) @@ -168,7 +168,7 @@ 1.23 == Approx( 1.22 ) - + d == approx( 1.24 ) @@ -176,7 +176,7 @@ 1.23 == Approx( 1.24 ) - + d != approx( 1.25 ) @@ -184,7 +184,7 @@ 1.23 != Approx( 1.25 ) - + approx( d ) == 1.23 @@ -192,7 +192,7 @@ Approx( 1.23 ) == 1.23 - + approx( d ) == 1.22 @@ -200,7 +200,7 @@ Approx( 1.23 ) == 1.22 - + approx( d ) == 1.24 @@ -208,7 +208,7 @@ Approx( 1.23 ) == 1.24 - + approx( d ) != 1.25 @@ -219,7 +219,7 @@ - + divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) @@ -227,7 +227,7 @@ 3.1428571429 == Approx( 3.141 ) - + divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) @@ -238,7 +238,7 @@ - + s == "hello" @@ -249,7 +249,7 @@ - + s == "world" @@ -260,7 +260,7 @@ - + m_a == 1 @@ -271,7 +271,7 @@ - + m_a == 2 @@ -282,7 +282,7 @@ - + data.int_seven == 7 @@ -290,7 +290,7 @@ 7 == 7 - + data.float_nine_point_one == Approx( 9.1f ) @@ -298,7 +298,7 @@ 9.1f == Approx( 9.1000003815 ) - + data.double_pi == Approx( 3.1415926535 ) @@ -306,7 +306,7 @@ 3.1415926535 == Approx( 3.1415926535 ) - + data.str_hello == "hello" @@ -314,7 +314,7 @@ "hello" == "hello" - + "hello" == data.str_hello @@ -322,7 +322,7 @@ "hello" == "hello" - + data.str_hello.size() == 5 @@ -330,7 +330,7 @@ 5 == 5 - + x == Approx( 1.3 ) @@ -341,7 +341,7 @@ - + data.int_seven == 6 @@ -349,7 +349,7 @@ 7 == 6 - + data.int_seven == 8 @@ -357,7 +357,7 @@ 7 == 8 - + data.int_seven == 0 @@ -365,7 +365,7 @@ 7 == 0 - + data.float_nine_point_one == Approx( 9.11f ) @@ -373,7 +373,7 @@ 9.1f == Approx( 9.1099996567 ) - + data.float_nine_point_one == Approx( 9.0f ) @@ -381,7 +381,7 @@ 9.1f == Approx( 9.0 ) - + data.float_nine_point_one == Approx( 1 ) @@ -389,7 +389,7 @@ 9.1f == Approx( 1.0 ) - + data.float_nine_point_one == Approx( 0 ) @@ -397,7 +397,7 @@ 9.1f == Approx( 0.0 ) - + data.double_pi == Approx( 3.1415 ) @@ -405,7 +405,7 @@ 3.1415926535 == Approx( 3.1415 ) - + data.str_hello == "goodbye" @@ -413,7 +413,7 @@ "hello" == "goodbye" - + data.str_hello == "hell" @@ -421,7 +421,7 @@ "hello" == "hell" - + data.str_hello == "hello1" @@ -429,7 +429,7 @@ "hello" == "hello1" - + data.str_hello.size() == 6 @@ -437,7 +437,7 @@ 5 == 6 - + x == Approx( 1.301 ) @@ -448,7 +448,7 @@ - + data.int_seven != 6 @@ -456,7 +456,7 @@ 7 != 6 - + data.int_seven != 8 @@ -464,7 +464,7 @@ 7 != 8 - + data.float_nine_point_one != Approx( 9.11f ) @@ -472,7 +472,7 @@ 9.1f != Approx( 9.1099996567 ) - + data.float_nine_point_one != Approx( 9.0f ) @@ -480,7 +480,7 @@ 9.1f != Approx( 9.0 ) - + data.float_nine_point_one != Approx( 1 ) @@ -488,7 +488,7 @@ 9.1f != Approx( 1.0 ) - + data.float_nine_point_one != Approx( 0 ) @@ -496,7 +496,7 @@ 9.1f != Approx( 0.0 ) - + data.double_pi != Approx( 3.1415 ) @@ -504,7 +504,7 @@ 3.1415926535 != Approx( 3.1415 ) - + data.str_hello != "goodbye" @@ -512,7 +512,7 @@ "hello" != "goodbye" - + data.str_hello != "hell" @@ -520,7 +520,7 @@ "hello" != "hell" - + data.str_hello != "hello1" @@ -528,7 +528,7 @@ "hello" != "hello1" - + data.str_hello.size() != 6 @@ -539,7 +539,7 @@ - + data.int_seven != 7 @@ -547,7 +547,7 @@ 7 != 7 - + data.float_nine_point_one != Approx( 9.1f ) @@ -555,7 +555,7 @@ 9.1f != Approx( 9.1000003815 ) - + data.double_pi != Approx( 3.1415926535 ) @@ -563,7 +563,7 @@ 3.1415926535 != Approx( 3.1415926535 ) - + data.str_hello != "hello" @@ -571,7 +571,7 @@ "hello" != "hello" - + data.str_hello.size() != 5 @@ -582,7 +582,7 @@ - + data.int_seven < 8 @@ -590,7 +590,7 @@ 7 < 8 - + data.int_seven > 6 @@ -598,7 +598,7 @@ 7 > 6 - + data.int_seven > 0 @@ -606,7 +606,7 @@ 7 > 0 - + data.int_seven > -1 @@ -614,7 +614,7 @@ 7 > -1 - + data.int_seven >= 7 @@ -622,7 +622,7 @@ 7 >= 7 - + data.int_seven >= 6 @@ -630,7 +630,7 @@ 7 >= 6 - + data.int_seven <= 7 @@ -638,7 +638,7 @@ 7 <= 7 - + data.int_seven <= 8 @@ -646,7 +646,7 @@ 7 <= 8 - + data.float_nine_point_one > 9 @@ -654,7 +654,7 @@ 9.1f > 9 - + data.float_nine_point_one < 10 @@ -662,7 +662,7 @@ 9.1f < 10 - + data.float_nine_point_one < 9.2 @@ -670,7 +670,7 @@ 9.1f < 9.2 - + data.str_hello <= "hello" @@ -678,7 +678,7 @@ "hello" <= "hello" - + data.str_hello >= "hello" @@ -686,7 +686,7 @@ "hello" >= "hello" - + data.str_hello < "hellp" @@ -694,7 +694,7 @@ "hello" < "hellp" - + data.str_hello < "zebra" @@ -702,7 +702,7 @@ "hello" < "zebra" - + data.str_hello > "hellm" @@ -710,7 +710,7 @@ "hello" > "hellm" - + data.str_hello > "a" @@ -721,7 +721,7 @@ - + data.int_seven > 7 @@ -729,7 +729,7 @@ 7 > 7 - + data.int_seven < 7 @@ -737,7 +737,7 @@ 7 < 7 - + data.int_seven > 8 @@ -745,7 +745,7 @@ 7 > 8 - + data.int_seven < 6 @@ -753,7 +753,7 @@ 7 < 6 - + data.int_seven < 0 @@ -761,7 +761,7 @@ 7 < 0 - + data.int_seven < -1 @@ -769,7 +769,7 @@ 7 < -1 - + data.int_seven >= 8 @@ -777,7 +777,7 @@ 7 >= 8 - + data.int_seven <= 6 @@ -785,7 +785,7 @@ 7 <= 6 - + data.float_nine_point_one < 9 @@ -793,7 +793,7 @@ 9.1f < 9 - + data.float_nine_point_one > 10 @@ -801,7 +801,7 @@ 9.1f > 10 - + data.float_nine_point_one > 9.2 @@ -809,7 +809,7 @@ 9.1f > 9.2 - + data.str_hello > "hello" @@ -817,7 +817,7 @@ "hello" > "hello" - + data.str_hello < "hello" @@ -825,7 +825,7 @@ "hello" < "hello" - + data.str_hello > "hellp" @@ -833,7 +833,7 @@ "hello" > "hellp" - + data.str_hello > "z" @@ -841,7 +841,7 @@ "hello" > "z" - + data.str_hello < "hellm" @@ -849,7 +849,7 @@ "hello" < "hellm" - + data.str_hello < "a" @@ -857,7 +857,7 @@ "hello" < "a" - + data.str_hello >= "z" @@ -865,7 +865,7 @@ "hello" >= "z" - + data.str_hello <= "a" @@ -876,7 +876,7 @@ - + i == 1 @@ -884,7 +884,7 @@ 1 == 1 - + ui == 2 @@ -892,7 +892,7 @@ 2 == 2 - + l == 3 @@ -900,7 +900,7 @@ 3 == 3 - + ul == 4 @@ -908,7 +908,7 @@ 4 == 4 - + c == 5 @@ -916,7 +916,7 @@ 5 == 5 - + uc == 6 @@ -924,7 +924,7 @@ 6 == 6 - + 1 == i @@ -932,7 +932,7 @@ 1 == 1 - + 2 == ui @@ -940,7 +940,7 @@ 2 == 2 - + 3 == l @@ -948,7 +948,7 @@ 3 == 3 - + 4 == ul @@ -956,7 +956,7 @@ 4 == 4 - + 5 == c @@ -964,7 +964,7 @@ 5 == 5 - + 6 == uc @@ -972,7 +972,7 @@ 6 == 6 - + (std::numeric_limits<unsigned long>::max)() > ul @@ -983,7 +983,7 @@ - + long_var == unsigned_char_var @@ -991,7 +991,7 @@ 1 == 1 - + long_var == unsigned_short_var @@ -999,7 +999,7 @@ 1 == 1 - + long_var == unsigned_int_var @@ -1007,7 +1007,7 @@ 1 == 1 - + long_var == unsigned_long_var @@ -1018,7 +1018,7 @@ - + unsigned_char_var == 1 @@ -1026,7 +1026,7 @@ 1 == 1 - + unsigned_short_var == 1 @@ -1034,7 +1034,7 @@ 1 == 1 - + unsigned_int_var == 1 @@ -1042,7 +1042,7 @@ 1 == 1 - + unsigned_long_var == 1 @@ -1053,7 +1053,7 @@ - + ( -1 > 2u ) @@ -1061,7 +1061,7 @@ true - + -1 > 2u @@ -1069,7 +1069,7 @@ -1 > 2 - + ( 2u < -1 ) @@ -1077,7 +1077,7 @@ true - + 2u < -1 @@ -1085,7 +1085,7 @@ 2 < -1 - + ( minInt > 2u ) @@ -1093,7 +1093,7 @@ true - + minInt > 2u @@ -1104,7 +1104,7 @@ - + 54 == 6*9 @@ -1115,7 +1115,7 @@ - + p == __null @@ -1123,7 +1123,7 @@ __null == 0 - + p == pNULL @@ -1131,7 +1131,7 @@ __null == __null - + p != __null @@ -1139,7 +1139,7 @@ 0x != 0 - + cp != __null @@ -1147,7 +1147,7 @@ 0x != 0 - + cpc != __null @@ -1155,7 +1155,7 @@ 0x != 0 - + returnsNull() == __null @@ -1163,7 +1163,7 @@ {null string} == 0 - + returnsConstNull() == __null @@ -1171,7 +1171,7 @@ {null string} == 0 - + __null != p @@ -1182,7 +1182,7 @@ - + false == false @@ -1190,7 +1190,7 @@ false == false - + true == true @@ -1198,7 +1198,7 @@ true == true - + !false @@ -1206,7 +1206,7 @@ true - + !false @@ -1214,7 +1214,7 @@ !false - + !falseValue @@ -1222,7 +1222,7 @@ true - + !falseValue @@ -1230,7 +1230,7 @@ !false - + !(1 == 2) @@ -1238,7 +1238,7 @@ true - + !1 == 2 @@ -1249,7 +1249,7 @@ - + false != false @@ -1257,7 +1257,7 @@ false != false - + true != true @@ -1265,7 +1265,7 @@ true != true - + !true @@ -1273,7 +1273,7 @@ false - + !true @@ -1281,7 +1281,7 @@ !true - + !trueValue @@ -1289,7 +1289,7 @@ false - + !trueValue @@ -1297,7 +1297,7 @@ !true - + !(1 == 1) @@ -1305,7 +1305,7 @@ false - + !1 == 1 @@ -1316,7 +1316,7 @@ - + thisThrows() @@ -1324,7 +1324,7 @@ thisThrows() - + thisDoesntThrow() @@ -1332,7 +1332,7 @@ thisDoesntThrow() - + thisThrows() @@ -1343,18 +1343,18 @@ - + thisThrows() thisThrows() - + expected exception - + thisDoesntThrow() @@ -1362,27 +1362,27 @@ thisDoesntThrow() - + thisThrows() thisThrows() - + expected exception - + unexpected exception - + 1 == 1 @@ -1390,14 +1390,14 @@ 1 == 1 - + {Unknown expression after the reported line} {Unknown expression after the reported line} - + unexpected exception @@ -1405,7 +1405,7 @@
- + unexpected exception @@ -1413,42 +1413,42 @@ - + thisThrows() == 0 thisThrows() == 0 - + expected exception - + thisThrows() == 0 thisThrows() == 0 - + expected exception - + thisThrows() == 0 thisThrows() == 0 - + expected exception @@ -1458,47 +1458,47 @@ - + custom exception - + throwCustom() throwCustom() - + custom exception - not std - + throwCustom() throwCustom() - + custom exception - not std - + 3.14 - + thisFunctionNotImplemented( 7 ) @@ -1509,7 +1509,7 @@ - + multiply( i, 2 ) == i*2 @@ -1517,7 +1517,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -1525,7 +1525,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1533,7 +1533,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -1541,7 +1541,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1549,7 +1549,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -1557,7 +1557,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1565,7 +1565,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -1573,7 +1573,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1581,7 +1581,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -1589,7 +1589,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1597,7 +1597,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -1605,7 +1605,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1613,7 +1613,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -1621,7 +1621,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1629,7 +1629,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -1637,7 +1637,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1645,7 +1645,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -1653,7 +1653,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1661,7 +1661,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -1669,7 +1669,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1677,7 +1677,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -1685,7 +1685,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1693,7 +1693,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -1701,7 +1701,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1709,7 +1709,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -1717,7 +1717,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1725,7 +1725,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -1733,7 +1733,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1741,7 +1741,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -1749,7 +1749,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1757,7 +1757,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -1765,7 +1765,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1773,7 +1773,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -1781,7 +1781,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1789,7 +1789,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -1797,7 +1797,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1805,7 +1805,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -1813,7 +1813,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1821,7 +1821,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -1829,7 +1829,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1837,7 +1837,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -1845,7 +1845,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1853,7 +1853,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -1861,7 +1861,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1869,7 +1869,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -1877,7 +1877,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1885,7 +1885,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -1893,7 +1893,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1901,7 +1901,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -1909,7 +1909,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1917,7 +1917,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -1925,7 +1925,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1933,7 +1933,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -1941,7 +1941,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1949,7 +1949,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -1957,7 +1957,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -1965,7 +1965,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -1973,7 +1973,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -1981,7 +1981,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -1989,7 +1989,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -1997,7 +1997,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2005,7 +2005,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2013,7 +2013,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2021,7 +2021,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2029,7 +2029,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2037,7 +2037,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2045,7 +2045,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2053,7 +2053,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2061,7 +2061,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2069,7 +2069,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2077,7 +2077,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2085,7 +2085,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2093,7 +2093,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -2101,7 +2101,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2109,7 +2109,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -2117,7 +2117,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2125,7 +2125,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -2133,7 +2133,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2141,7 +2141,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2149,7 +2149,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2157,7 +2157,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2165,7 +2165,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2173,7 +2173,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2181,7 +2181,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2189,7 +2189,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2197,7 +2197,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2205,7 +2205,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2213,7 +2213,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2221,7 +2221,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2229,7 +2229,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2237,7 +2237,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -2245,7 +2245,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2253,7 +2253,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -2261,7 +2261,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2269,7 +2269,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -2277,7 +2277,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2285,7 +2285,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2293,7 +2293,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2301,7 +2301,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2309,7 +2309,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2317,7 +2317,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2325,7 +2325,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2333,7 +2333,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2341,7 +2341,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2349,7 +2349,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2357,7 +2357,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2365,7 +2365,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2373,7 +2373,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2381,7 +2381,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -2389,7 +2389,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2397,7 +2397,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -2405,7 +2405,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2413,7 +2413,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -2421,7 +2421,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2429,7 +2429,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2437,7 +2437,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2445,7 +2445,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2453,7 +2453,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2461,7 +2461,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2469,7 +2469,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2477,7 +2477,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2485,7 +2485,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2493,7 +2493,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2501,7 +2501,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2509,7 +2509,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2517,7 +2517,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2525,7 +2525,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -2533,7 +2533,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2541,7 +2541,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -2549,7 +2549,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2557,7 +2557,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -2565,7 +2565,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2573,7 +2573,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2581,7 +2581,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2589,7 +2589,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2597,7 +2597,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2605,7 +2605,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2613,7 +2613,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2621,7 +2621,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2629,7 +2629,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2637,7 +2637,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2645,7 +2645,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2653,7 +2653,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2664,7 +2664,7 @@ - + i->first == i->second-1 @@ -2672,7 +2672,7 @@ 0 == 0 - + i->first == i->second-1 @@ -2701,7 +2701,7 @@ so should this - + a == 1 @@ -2712,7 +2712,7 @@ - + a == 2 @@ -2723,7 +2723,7 @@ this message should be logged - + a == 1 @@ -2734,7 +2734,7 @@ and this, but later - + a == 0 @@ -2742,7 +2742,7 @@ 2 == 0 - + a == 2 @@ -2790,7 +2790,7 @@ - + i < 10 @@ -2798,7 +2798,7 @@ 0 < 10 - + i < 10 @@ -2806,7 +2806,7 @@ 1 < 10 - + i < 10 @@ -2814,7 +2814,7 @@ 2 < 10 - + i < 10 @@ -2822,7 +2822,7 @@ 3 < 10 - + i < 10 @@ -2830,7 +2830,7 @@ 4 < 10 - + i < 10 @@ -2838,7 +2838,7 @@ 5 < 10 - + i < 10 @@ -2846,7 +2846,7 @@ 6 < 10 - + i < 10 @@ -2854,7 +2854,7 @@ 7 < 10 - + i < 10 @@ -2862,7 +2862,7 @@ 8 < 10 - + i < 10 @@ -2876,7 +2876,7 @@ i := 10 - + i < 10 @@ -2887,7 +2887,7 @@ - + 1 == 2 @@ -2913,7 +2913,7 @@ i := 7 - + false @@ -2934,7 +2934,7 @@
- + a != b @@ -2942,7 +2942,7 @@ 1 != 2 - + b != a @@ -2953,7 +2953,7 @@
- + a != b @@ -2967,7 +2967,7 @@
- + a != b @@ -2975,7 +2975,7 @@ 1 != 2 - + b != a @@ -2984,7 +2984,7 @@
- + a != b @@ -3001,7 +3001,7 @@
- + a == b @@ -3035,7 +3035,7 @@
- + b > a @@ -3051,7 +3051,7 @@ Testing if fib[0] (1) is even - + ( fib[i] % 2 ) == 0 @@ -3062,7 +3062,7 @@ Testing if fib[1] (1) is even - + ( fib[i] % 2 ) == 0 @@ -3070,7 +3070,7 @@ 1 == 0 - + ( fib[i] % 2 ) == 0 @@ -3081,7 +3081,7 @@ Testing if fib[3] (3) is even - + ( fib[i] % 2 ) == 0 @@ -3092,7 +3092,7 @@ Testing if fib[4] (5) is even - + ( fib[i] % 2 ) == 0 @@ -3100,7 +3100,7 @@ 1 == 0 - + ( fib[i] % 2 ) == 0 @@ -3111,7 +3111,7 @@ Testing if fib[6] (13) is even - + ( fib[i] % 2 ) == 0 @@ -3122,7 +3122,7 @@ Testing if fib[7] (21) is even - + ( fib[i] % 2 ) == 0 @@ -3136,7 +3136,7 @@ - + makeString( false ) != static_cast<char*>(__null) @@ -3144,7 +3144,7 @@ "valid string" != {null string} - + makeString( true ) == static_cast<char*>(__null) @@ -3155,7 +3155,7 @@ - + flag @@ -3163,7 +3163,7 @@ true - + testCheckedIf( true ) @@ -3174,7 +3174,7 @@ - + flag @@ -3182,7 +3182,7 @@ false - + testCheckedIf( false ) @@ -3193,7 +3193,7 @@ - + flag @@ -3201,7 +3201,7 @@ true - + testCheckedElse( true ) @@ -3212,7 +3212,7 @@ - + flag @@ -3220,7 +3220,7 @@ false - + testCheckedElse( false ) @@ -3243,7 +3243,7 @@ 3 - + false @@ -3254,7 +3254,7 @@ - + x == 0 @@ -3265,7 +3265,7 @@ - + testStringForMatching() Contains( "string" ) @@ -3273,7 +3273,7 @@ "this string contains 'abc' as a substring" contains: "string" - + testStringForMatching() Contains( "abc" ) @@ -3281,7 +3281,7 @@ "this string contains 'abc' as a substring" contains: "abc" - + testStringForMatching() StartsWith( "this" ) @@ -3289,7 +3289,7 @@ "this string contains 'abc' as a substring" starts with: "this" - + testStringForMatching() EndsWith( "substring" ) @@ -3300,7 +3300,7 @@ - + testStringForMatching() Contains( "not there" ) @@ -3311,7 +3311,7 @@ - + testStringForMatching() StartsWith( "string" ) @@ -3322,7 +3322,7 @@ - + testStringForMatching() EndsWith( "this" ) @@ -3333,7 +3333,7 @@ - + testStringForMatching() Equals( "something else" ) @@ -3344,7 +3344,7 @@ - + "" Equals(__null) @@ -3355,7 +3355,7 @@ - + testStringForMatching() AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) ) @@ -3366,7 +3366,7 @@ - + testStringForMatching() AnyOf( Catch::Contains( "string" ), Catch::Contains( "not there" ) ) @@ -3374,7 +3374,7 @@ "this string contains 'abc' as a substring" ( contains: "string" or contains: "not there" ) - + testStringForMatching() AnyOf( Catch::Contains( "not there" ), Catch::Contains( "string" ) ) @@ -3385,7 +3385,7 @@ - + testStringForMatching() Equals( "this string contains 'abc' as a substring" ) @@ -3396,7 +3396,7 @@ - + Factorial(0) == 1 @@ -3404,7 +3404,7 @@ 1 == 1 - + Factorial(1) == 1 @@ -3412,7 +3412,7 @@ 1 == 1 - + Factorial(2) == 2 @@ -3420,7 +3420,7 @@ 2 == 2 - + Factorial(3) == 6 @@ -3428,7 +3428,7 @@ 6 == 6 - + Factorial(10) == 3628800 @@ -3454,7 +3454,7 @@ - + v.size() == 5 @@ -3462,7 +3462,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3471,7 +3471,7 @@
- + v.size() == 10 @@ -3479,7 +3479,7 @@ 10 == 10 - + v.capacity() >= 10 @@ -3489,7 +3489,7 @@
- + v.size() == 5 @@ -3497,7 +3497,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3506,7 +3506,7 @@
- + v.size() == 0 @@ -3514,7 +3514,7 @@ 0 == 0 - + v.capacity() >= 5 @@ -3523,7 +3523,7 @@
- + v.capacity() == 0 @@ -3535,7 +3535,7 @@
- + v.size() == 5 @@ -3543,7 +3543,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3552,7 +3552,7 @@
- + v.size() == 5 @@ -3560,7 +3560,7 @@ 5 == 5 - + v.capacity() >= 10 @@ -3570,7 +3570,7 @@
- + v.size() == 5 @@ -3578,7 +3578,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3587,7 +3587,7 @@
- + v.size() == 5 @@ -3595,7 +3595,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3623,7 +3623,7 @@ - + s1 == s2 @@ -3641,7 +3641,7 @@ - + result == "\"wide load\"" @@ -3652,7 +3652,7 @@ - + result == "\"wide load\"" @@ -3663,7 +3663,7 @@ - + result == "\"wide load\"" @@ -3674,7 +3674,7 @@ - + result == "\"wide load\"" @@ -3686,7 +3686,7 @@
- + parseIntoConfig( argv, config ) @@ -3694,7 +3694,7 @@ parseIntoConfig( argv, config ) - + config.shouldDebugBreak == false @@ -3702,7 +3702,7 @@ false == false - + config.abortAfter == -1 @@ -3710,7 +3710,7 @@ -1 == -1 - + config.noThrow == false @@ -3718,7 +3718,7 @@ false == false - + config.reporterName.empty() @@ -3730,7 +3730,7 @@
- + parseIntoConfig( argv, config ) @@ -3738,7 +3738,7 @@ parseIntoConfig( argv, config ) - + cfg.testSpec().matches( fakeTestCase( "notIncluded" ) ) == false @@ -3746,7 +3746,7 @@ false == false - + cfg.testSpec().matches( fakeTestCase( "test1" ) ) @@ -3760,7 +3760,7 @@
- + parseIntoConfig( argv, config ) @@ -3768,7 +3768,7 @@ parseIntoConfig( argv, config ) - + cfg.testSpec().matches( fakeTestCase( "test1" ) ) == false @@ -3776,7 +3776,7 @@ false == false - + cfg.testSpec().matches( fakeTestCase( "alwaysIncluded" ) ) @@ -3790,7 +3790,7 @@
- + parseIntoConfig( argv, config ) @@ -3798,7 +3798,7 @@ parseIntoConfig( argv, config ) - + cfg.testSpec().matches( fakeTestCase( "test1" ) ) == false @@ -3806,7 +3806,7 @@ false == false - + cfg.testSpec().matches( fakeTestCase( "alwaysIncluded" ) ) @@ -3820,7 +3820,7 @@
- + parseIntoConfig( argv, config ) @@ -3828,7 +3828,7 @@ parseIntoConfig( argv, config ) - + config.reporterName == "console" @@ -3842,7 +3842,7 @@
- + parseIntoConfig( argv, config ) @@ -3850,7 +3850,7 @@ parseIntoConfig( argv, config ) - + config.reporterName == "xml" @@ -3864,7 +3864,7 @@
- + parseIntoConfig( argv, config ) @@ -3872,7 +3872,7 @@ parseIntoConfig( argv, config ) - + config.reporterName == "junit" @@ -3886,7 +3886,7 @@
- + parseIntoConfig( argv, config ) @@ -3894,7 +3894,7 @@ parseIntoConfig( argv, config ) - + config.shouldDebugBreak == true @@ -3908,7 +3908,7 @@
- + parseIntoConfig( argv, config ) @@ -3916,7 +3916,7 @@ parseIntoConfig( argv, config ) - + config.shouldDebugBreak @@ -3930,7 +3930,7 @@
- + parseIntoConfig( argv, config ) @@ -3938,7 +3938,7 @@ parseIntoConfig( argv, config ) - + config.abortAfter == 1 @@ -3952,7 +3952,7 @@
- + parseIntoConfig( argv, config ) @@ -3960,7 +3960,7 @@ parseIntoConfig( argv, config ) - + config.abortAfter == 2 @@ -3974,7 +3974,7 @@
- + parseIntoConfigAndReturnError( argv, config ) Contains( "greater than zero" ) @@ -3989,7 +3989,7 @@
- + parseIntoConfigAndReturnError( argv, config ) Contains( "-x" ) @@ -4004,7 +4004,7 @@
- + parseIntoConfig( argv, config ) @@ -4012,7 +4012,7 @@ parseIntoConfig( argv, config ) - + config.noThrow == true @@ -4026,7 +4026,7 @@
- + parseIntoConfig( argv, config ) @@ -4034,7 +4034,7 @@ parseIntoConfig( argv, config ) - + config.noThrow == true @@ -4048,7 +4048,7 @@
- + parseIntoConfig( argv, config ) @@ -4056,7 +4056,7 @@ parseIntoConfig( argv, config ) - + config.outputFilename == "filename.ext" @@ -4070,7 +4070,7 @@
- + parseIntoConfig( argv, config ) @@ -4078,7 +4078,7 @@ parseIntoConfig( argv, config ) - + config.outputFilename == "filename.ext" @@ -4092,7 +4092,7 @@
- + parseIntoConfig( argv, config ) @@ -4100,7 +4100,7 @@ parseIntoConfig( argv, config ) - + config.abortAfter == 1 @@ -4108,7 +4108,7 @@ 1 == 1 - + config.shouldDebugBreak @@ -4116,7 +4116,7 @@ true - + config.noThrow == true @@ -4133,7 +4133,7 @@
- + Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString @@ -4143,7 +4143,7 @@ "one two three four" - + Text( testString, TextAttributes().setWidth( 18 ) ).toString() == testString @@ -4159,7 +4159,7 @@
- + Text( testString, TextAttributes().setWidth( 17 ) ).toString() == "one two three\nfour" @@ -4171,7 +4171,7 @@ four" four" - + Text( testString, TextAttributes().setWidth( 16 ) ).toString() == "one two three\nfour" @@ -4183,7 +4183,7 @@ four" four" - + Text( testString, TextAttributes().setWidth( 14 ) ).toString() == "one two three\nfour" @@ -4195,7 +4195,7 @@ four" four" - + Text( testString, TextAttributes().setWidth( 13 ) ).toString() == "one two three\nfour" @@ -4207,7 +4207,7 @@ four" four" - + Text( testString, TextAttributes().setWidth( 12 ) ).toString() == "one two\nthree four" @@ -4225,7 +4225,7 @@ three four"
- + Text( testString, TextAttributes().setWidth( 9 ) ).toString() == "one two\nthree\nfour" @@ -4239,7 +4239,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 8 ) ).toString() == "one two\nthree\nfour" @@ -4253,7 +4253,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 7 ) ).toString() == "one two\nthree\nfour" @@ -4273,7 +4273,7 @@ four"
- + Text( testString, TextAttributes().setWidth( 6 ) ).toString() == "one\ntwo\nthree\nfour" @@ -4289,7 +4289,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 5 ) ).toString() == "one\ntwo\nthree\nfour" @@ -4311,7 +4311,7 @@ four"
- + Text( "abcdef", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndef" @@ -4323,7 +4323,7 @@ def" def" - + Text( "abcdefg", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndefg" @@ -4335,7 +4335,7 @@ defg" defg" - + Text( "abcdefgh", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndef-\ngh" @@ -4349,7 +4349,7 @@ def- gh" - + Text( testString, TextAttributes().setWidth( 4 ) ).toString() == "one\ntwo\nthr-\nee\nfour" @@ -4367,7 +4367,7 @@ ee four" - + Text( testString, TextAttributes().setWidth( 3 ) ).toString() == "one\ntwo\nth-\nree\nfo-\nur" @@ -4393,7 +4393,7 @@ ur"
- + text.size() == 4 @@ -4401,7 +4401,7 @@ ur" 4 == 4 - + text[0] == "one" @@ -4409,7 +4409,7 @@ ur" "one" == "one" - + text[1] == "two" @@ -4417,7 +4417,7 @@ ur" "two" == "two" - + text[2] == "three" @@ -4425,7 +4425,7 @@ ur" "three" == "three" - + text[3] == "four" @@ -4439,7 +4439,7 @@ ur"
- + text.toString() == " one two\n three\n four" @@ -4459,7 +4459,7 @@ ur"
- + Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString @@ -4471,7 +4471,7 @@ three four" three four" - + Text( testString, TextAttributes().setWidth( 18 ) ).toString() == testString @@ -4483,7 +4483,7 @@ three four" three four" - + Text( testString, TextAttributes().setWidth( 10 ) ).toString() == testString @@ -4501,7 +4501,7 @@ three four"
- + Text( "abcdef\n", TextAttributes().setWidth( 10 ) ).toString() == "abcdef\n" @@ -4513,7 +4513,7 @@ three four" " - + Text( "abcdef", TextAttributes().setWidth( 6 ) ).toString() == "abcdef" @@ -4521,7 +4521,7 @@ three four" "abcdef" == "abcdef" - + Text( "abcdef\n", TextAttributes().setWidth( 6 ) ).toString() == "abcdef\n" @@ -4539,7 +4539,7 @@ three four"
- + Text( testString, TextAttributes().setWidth( 9 ) ).toString() == "one two\nthree\nfour" @@ -4553,7 +4553,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 8 ) ).toString() == "one two\nthree\nfour" @@ -4567,7 +4567,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 7 ) ).toString() == "one two\nthree\nfour" @@ -4587,7 +4587,7 @@ four"
- + Text( testString, TextAttributes().setWidth( 6 ) ).toString() == "one\ntwo\nthree\nfour" @@ -4608,7 +4608,7 @@ four"
- + Text( testString, TextAttributes().setWidth( 15 ) ).toString() == "one two three\n four\n five\n six" @@ -4632,7 +4632,7 @@ four" - + Text( "hi there" ).toString() == "hi there" @@ -4640,7 +4640,7 @@ four" "hi there" == "hi there" - + Text( "hi there", narrow ).toString() == "hi\nthere" @@ -4655,7 +4655,7 @@ there" - + t.toString() EndsWith( "... message truncated due to excessive size" ) @@ -5666,7 +5666,7 @@ there" - + (std::pair<int, int>( 1, 2 )) == aNicePair @@ -5689,7 +5689,7 @@ there" - + &o1 == &o2 @@ -5697,7 +5697,7 @@ there" 0x == 0x - + o1 == o2 @@ -5708,7 +5708,7 @@ there" - + std::string( "first" ) == "second" @@ -5719,7 +5719,7 @@ there" - + i++ == 7 @@ -5727,7 +5727,7 @@ there" 7 == 7 - + i++ == 8 @@ -5738,7 +5738,7 @@ there" - + 0x == o @@ -5749,7 +5749,7 @@ there" - + t == 1u @@ -5760,7 +5760,7 @@ there" - + 0x == bit30and31 @@ -5771,7 +5771,7 @@ there" - + obj.prop != __null @@ -5783,7 +5783,7 @@ there"
- + is_true<true>::value == true @@ -5791,7 +5791,7 @@ there" true == true - + true == is_true<true>::value @@ -5802,7 +5802,7 @@ there"
- + is_true<false>::value == false @@ -5810,7 +5810,7 @@ there" false == false - + false == is_true<false>::value @@ -5821,7 +5821,7 @@ there"
- + !is_true<false>::value @@ -5832,7 +5832,7 @@ there"
- + !!is_true<true>::value @@ -5843,7 +5843,7 @@ there"
- + is_true<true>::value @@ -5851,7 +5851,7 @@ there" true - + !is_true<false>::value @@ -5864,7 +5864,7 @@ there" - + True @@ -5872,7 +5872,7 @@ there" true - + !False @@ -5880,7 +5880,7 @@ there" true - + !False @@ -5891,7 +5891,7 @@ there" - + Catch::alwaysTrue() @@ -5900,7 +5900,7 @@ there"
- + Catch::alwaysTrue() @@ -5909,7 +5909,7 @@ there"
- + Catch::alwaysTrue() @@ -5921,7 +5921,7 @@ there"
- + Catch::alwaysTrue() @@ -5930,7 +5930,7 @@ there"
- + Catch::alwaysTrue() @@ -5939,7 +5939,7 @@ there"
- + Catch::alwaysTrue() @@ -5954,7 +5954,7 @@ there" - + s == "7" @@ -5965,7 +5965,7 @@ there" - + a @@ -5973,7 +5973,7 @@ there" true - + a == &foo @@ -5984,7 +5984,7 @@ there" - + m == &S::f @@ -5997,7 +5997,7 @@ there" - + p == 0 @@ -6008,7 +6008,7 @@ there" - + ptr.get() == nullptr @@ -6032,7 +6032,7 @@ there"
- + spec.hasFilters() == false @@ -6040,7 +6040,7 @@ there" false == false - + spec.matches( tcA ) == false @@ -6048,7 +6048,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6059,7 +6059,7 @@ there"
- + spec.hasFilters() == false @@ -6067,7 +6067,7 @@ there" false == false - + spec.matches(tcA ) == false @@ -6075,7 +6075,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6086,7 +6086,7 @@ there"
- + spec.hasFilters() == false @@ -6094,7 +6094,7 @@ there" false == false - + spec.matches( tcA ) == false @@ -6102,7 +6102,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6113,7 +6113,7 @@ there"
- + spec.hasFilters() == true @@ -6121,7 +6121,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6129,7 +6129,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6140,7 +6140,7 @@ there"
- + spec.hasFilters() == true @@ -6148,7 +6148,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6156,7 +6156,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6167,7 +6167,7 @@ there"
- + spec.hasFilters() == true @@ -6175,7 +6175,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6183,7 +6183,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6191,7 +6191,7 @@ there" true == true - + spec.matches( tcC ) == false @@ -6202,7 +6202,7 @@ there"
- + spec.hasFilters() == true @@ -6210,7 +6210,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6218,7 +6218,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6226,7 +6226,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6234,7 +6234,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -6242,7 +6242,7 @@ there" false == false - + parseTestSpec( "*a" ).matches( tcA ) == true @@ -6253,7 +6253,7 @@ there"
- + spec.hasFilters() == true @@ -6261,7 +6261,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6269,7 +6269,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6277,7 +6277,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6285,7 +6285,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -6293,7 +6293,7 @@ there" false == false - + parseTestSpec( "a*" ).matches( tcA ) == true @@ -6304,7 +6304,7 @@ there"
- + spec.hasFilters() == true @@ -6312,7 +6312,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6320,7 +6320,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6328,7 +6328,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6336,7 +6336,7 @@ there" true == true - + spec.matches( tcD ) == true @@ -6344,7 +6344,7 @@ there" true == true - + parseTestSpec( "*a*" ).matches( tcA ) == true @@ -6355,7 +6355,7 @@ there"
- + spec.hasFilters() == true @@ -6363,7 +6363,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6371,7 +6371,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -6382,7 +6382,7 @@ there"
- + spec.hasFilters() == true @@ -6390,7 +6390,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6398,7 +6398,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -6409,7 +6409,7 @@ there"
- + spec.hasFilters() == true @@ -6417,7 +6417,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6425,7 +6425,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -6436,7 +6436,7 @@ there"
- + spec.hasFilters() == true @@ -6444,7 +6444,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6452,7 +6452,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6460,7 +6460,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6468,7 +6468,7 @@ there" true == true - + spec.matches( tcD ) == true @@ -6479,7 +6479,7 @@ there"
- + spec.hasFilters() == true @@ -6487,7 +6487,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6495,7 +6495,7 @@ there" true == true - + spec.matches( tcB ) == true @@ -6503,7 +6503,7 @@ there" true == true - + spec.matches( tcC ) == true @@ -6511,7 +6511,7 @@ there" true == true - + spec.matches( tcD ) == true @@ -6522,7 +6522,7 @@ there"
- + spec.hasFilters() == true @@ -6530,7 +6530,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6538,7 +6538,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6546,7 +6546,7 @@ there" true == true - + spec.matches( tcC ) == false @@ -6557,7 +6557,7 @@ there"
- + spec.hasFilters() == true @@ -6565,7 +6565,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6573,7 +6573,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6581,7 +6581,7 @@ there" true == true - + spec.matches( tcC ) == true @@ -6592,7 +6592,7 @@ there"
- + spec.hasFilters() == true @@ -6600,7 +6600,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6608,7 +6608,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6616,7 +6616,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6627,7 +6627,7 @@ there"
- + spec.hasFilters() == true @@ -6635,7 +6635,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6643,7 +6643,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6651,7 +6651,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6662,7 +6662,7 @@ there"
- + spec.hasFilters() == true @@ -6670,7 +6670,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6678,7 +6678,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6686,7 +6686,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6694,7 +6694,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -6705,7 +6705,7 @@ there"
- + spec.hasFilters() == true @@ -6713,7 +6713,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6721,7 +6721,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -6729,7 +6729,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6740,7 +6740,7 @@ there"
- + spec.hasFilters() == true @@ -6748,7 +6748,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6756,7 +6756,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6764,7 +6764,7 @@ there" true == true - + spec.matches( tcC ) == false @@ -6775,7 +6775,7 @@ there"
- + spec.hasFilters() == true @@ -6783,7 +6783,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6791,7 +6791,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6799,7 +6799,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -6807,7 +6807,7 @@ there" false == false - + spec.matches( tcD ) == true @@ -6818,7 +6818,7 @@ there"
- + spec.hasFilters() == true @@ -6826,7 +6826,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6834,7 +6834,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6842,7 +6842,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -6850,7 +6850,7 @@ there" false == false - + spec.matches( tcD ) == true @@ -6861,7 +6861,7 @@ there"
- + spec.hasFilters() == true @@ -6869,7 +6869,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6877,7 +6877,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -6885,7 +6885,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6893,7 +6893,7 @@ there" true == true - + spec.matches( tcD ) == true @@ -6904,7 +6904,7 @@ there"
- + spec.hasFilters() == true @@ -6912,7 +6912,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6920,7 +6920,7 @@ there" true == true - + spec.matches( tcB ) == true @@ -6928,7 +6928,7 @@ there" true == true - + spec.matches( tcC ) == false @@ -6936,7 +6936,7 @@ there" false == false - + spec.matches( tcD ) == false @@ -6947,7 +6947,7 @@ there"
- + spec.hasFilters() == true @@ -6955,7 +6955,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6963,7 +6963,7 @@ there" true == true - + spec.matches( tcB ) == true @@ -6971,7 +6971,7 @@ there" true == true - + spec.matches( tcC ) == true @@ -6979,7 +6979,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -6990,7 +6990,7 @@ there"
- + spec.hasFilters() == true @@ -6998,7 +6998,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -7006,7 +7006,7 @@ there" true == true - + spec.matches( tcB ) == true @@ -7014,7 +7014,7 @@ there" true == true - + spec.matches( tcC ) == true @@ -7022,7 +7022,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -7033,7 +7033,7 @@ there"
- + spec.hasFilters() == true @@ -7041,7 +7041,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7049,7 +7049,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7057,7 +7057,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -7065,7 +7065,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -7076,7 +7076,7 @@ there"
- + spec.hasFilters() == false @@ -7084,7 +7084,7 @@ there" false == false - + spec.matches( tcA ) == false @@ -7092,7 +7092,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7100,7 +7100,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -7108,7 +7108,7 @@ there" false == false - + spec.matches( tcD ) == false @@ -7119,7 +7119,7 @@ there"
- + spec.hasFilters() == false @@ -7127,7 +7127,7 @@ there" false == false - + spec.matches( tcA ) == false @@ -7135,7 +7135,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7143,7 +7143,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -7151,7 +7151,7 @@ there" false == false - + spec.matches( tcD ) == false @@ -7162,7 +7162,7 @@ there"
- + spec.hasFilters() == true @@ -7170,7 +7170,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7178,7 +7178,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7186,7 +7186,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -7194,7 +7194,7 @@ there" false == false - + spec.matches( tcD ) == true @@ -7208,7 +7208,7 @@ there"
- + what Contains( "[@zzz]" ) @@ -7218,7 +7218,7 @@ there" Redefined at file:10" contains: "[@zzz]" - + what Contains( "file" ) @@ -7228,7 +7228,7 @@ there" Redefined at file:10" contains: "file" - + what Contains( "2" ) @@ -7238,7 +7238,7 @@ there" Redefined at file:10" contains: "2" - + what Contains( "10" ) @@ -7251,7 +7251,7 @@ there"
- + registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) @@ -7259,7 +7259,7 @@ there" registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) - + registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) @@ -7267,7 +7267,7 @@ there" registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) - + registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) @@ -7275,7 +7275,7 @@ there" registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) - + registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) @@ -7303,7 +7303,7 @@ there"
- + itDoesThis() @@ -7312,7 +7312,7 @@ there"
- + itDoesThat() @@ -7332,7 +7332,7 @@ there"
- + v.size() == 0 @@ -7342,7 +7342,7 @@ there"
- + v.size() == 10 @@ -7350,7 +7350,7 @@ there" 10 == 10 - + v.capacity() >= 10 @@ -7360,7 +7360,7 @@ there"
- + v.size() == 5 @@ -7368,7 +7368,7 @@ there" 5 == 5 - + v.capacity() >= 10 @@ -7387,7 +7387,7 @@ there"
- + v.size() == 0 @@ -7397,7 +7397,7 @@ there"
- + v.capacity() >= 10 @@ -7405,7 +7405,7 @@ there" 10 >= 10 - + v.size() == 0 @@ -7435,7 +7435,7 @@ there"
- + before == 0 @@ -7445,7 +7445,7 @@ there"
- + after > before @@ -7462,7 +7462,7 @@ there" - + !testCaseTracker.isCompleted() @@ -7471,7 +7471,7 @@ there"
- + !testCaseTracker.isCompleted() @@ -7479,7 +7479,7 @@ there" !false - + testCaseTracker.isCompleted() @@ -7489,7 +7489,7 @@ there"
- + !testCaseTracker.isCompleted() @@ -7498,7 +7498,7 @@ there"
- + testCaseTracker.enterSection( section1Name ) @@ -7506,7 +7506,7 @@ there" true - + !testCaseTracker.isCompleted() @@ -7514,7 +7514,7 @@ there" !false - + testCaseTracker.isCompleted() @@ -7522,7 +7522,7 @@ there" true - + !testCaseTracker.enterSection( section1Name ) @@ -7532,7 +7532,7 @@ there"
- + !testCaseTracker.isCompleted() @@ -7541,7 +7541,7 @@ there"
- + testCaseTracker.enterSection( section1Name ) @@ -7549,7 +7549,7 @@ there" true - + !testCaseTracker.enterSection( section2Name ) @@ -7557,7 +7557,7 @@ there" !false - + !testCaseTracker.isCompleted() @@ -7565,7 +7565,7 @@ there" !false - + !testCaseTracker.enterSection( section1Name ) @@ -7573,7 +7573,7 @@ there" !false - + testCaseTracker.enterSection( section2Name ) @@ -7581,7 +7581,7 @@ there" true - + testCaseTracker.isCompleted() @@ -7591,7 +7591,7 @@ there"
- + !testCaseTracker.isCompleted() @@ -7600,7 +7600,7 @@ there"
- + testCaseTracker.enterSection( section1Name ) @@ -7608,7 +7608,7 @@ there" true - + testCaseTracker.enterSection( section2Name ) @@ -7616,7 +7616,7 @@ there" true - + !testCaseTracker.isCompleted() @@ -7624,7 +7624,7 @@ there" !false - + testCaseTracker.isCompleted() From 05743eeaa189d46d3a80dae05eb5c7a665d6b625 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 22 Aug 2014 19:33:28 +0100 Subject: [PATCH 004/102] FatalErrorConditions now full close reporter states - so the console reporter(s) show final summary and the xml reporters close their tags --- include/internal/catch_fatal_condition.hpp | 7 +-- include/internal/catch_interfaces_capture.h | 3 +- include/internal/catch_runner_impl.hpp | 66 ++++++++++++++++----- 3 files changed, 54 insertions(+), 22 deletions(-) diff --git a/include/internal/catch_fatal_condition.hpp b/include/internal/catch_fatal_condition.hpp index 08c4dcc2..e87e9cfc 100644 --- a/include/internal/catch_fatal_condition.hpp +++ b/include/internal/catch_fatal_condition.hpp @@ -16,11 +16,8 @@ namespace Catch { inline void fatal( std::string const& message, int exitCode ) { IContext& context = Catch::getCurrentContext(); IResultCapture* resultCapture = context.getResultCapture(); - ResultBuilder resultBuilder = resultCapture->makeUnexpectedResultBuilder(); - resultBuilder.setResultType( ResultWas::FatalErrorCondition ); - resultBuilder << message; - resultBuilder.captureExpression(); - + resultCapture->handleFatalErrorCondition( message ); + if( Catch::alwaysTrue() ) // avoids "no return" warnings exit( exitCode ); } diff --git a/include/internal/catch_interfaces_capture.h b/include/internal/catch_interfaces_capture.h index b9d1e874..bdbcfb2f 100644 --- a/include/internal/catch_interfaces_capture.h +++ b/include/internal/catch_interfaces_capture.h @@ -21,7 +21,6 @@ namespace Catch { struct MessageInfo; class ScopedMessageBuilder; struct Counts; - class ResultBuilder; struct IResultCapture { @@ -37,7 +36,7 @@ namespace Catch { virtual std::string getCurrentTestName() const = 0; virtual const AssertionResult* getLastResult() const = 0; - virtual ResultBuilder makeUnexpectedResultBuilder() const = 0; + virtual void handleFatalErrorCondition( std::string const& message ) = 0; }; IResultCapture& getResultCapture(); diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp index 47b2e2be..7b9dcb66 100644 --- a/include/internal/catch_runner_impl.hpp +++ b/include/internal/catch_runner_impl.hpp @@ -210,19 +210,43 @@ namespace Catch { return &m_lastResult; } + virtual void handleFatalErrorCondition( std::string const& message ) { + ResultBuilder resultBuilder = makeUnexpectedResultBuilder(); + resultBuilder.setResultType( ResultWas::FatalErrorCondition ); + resultBuilder << message; + resultBuilder.captureExpression(); + + handleUnfinishedSections(); + + // Recreate section for test case (as we will lose the one that was in scope) + TestCaseInfo const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); + SectionInfo testCaseSection( testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description ); + + Counts assertions; + assertions.failed = 1; + SectionStats testCaseSectionStats( testCaseSection, assertions, 0, false ); + m_reporter->sectionEnded( testCaseSectionStats ); + + TestCaseInfo testInfo = m_activeTestCase->getTestCaseInfo(); + + Totals deltaTotals; + deltaTotals.testCases.failed = 1; + m_reporter->testCaseEnded( TestCaseStats( testInfo, + deltaTotals, + "", + "", + false ) ); + m_totals.testCases.failed++; + testGroupEnded( "", m_totals, 1, 1 ); + m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, false ) ); + } + public: // !TBD We need to do this another way! bool aborting() const { return m_totals.assertions.failed == static_cast( m_config->abortAfter() ); } - virtual ResultBuilder makeUnexpectedResultBuilder() const { - return ResultBuilder( m_lastAssertionInfo.macroName.c_str(), - m_lastAssertionInfo.lineInfo, - m_lastAssertionInfo.capturedExpression.c_str(), - m_lastAssertionInfo.resultDisposition ); - } - private: void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr ) { @@ -253,14 +277,7 @@ namespace Catch { catch(...) { makeUnexpectedResultBuilder().useActiveException(); } - // If sections ended prematurely due to an exception we stored their - // infos here so we can tear them down outside the unwind process. - for( std::vector::const_reverse_iterator it = m_unfinishedSections.rbegin(), - itEnd = m_unfinishedSections.rend(); - it != itEnd; - ++it ) - sectionEnded( it->info, it->prevAssertions, it->durationInSeconds ); - m_unfinishedSections.clear(); + handleUnfinishedSections(); m_messages.clear(); Counts assertions = m_totals.assertions - prevAssertions; @@ -282,6 +299,25 @@ namespace Catch { } private: + + ResultBuilder makeUnexpectedResultBuilder() const { + return ResultBuilder( m_lastAssertionInfo.macroName.c_str(), + m_lastAssertionInfo.lineInfo, + m_lastAssertionInfo.capturedExpression.c_str(), + m_lastAssertionInfo.resultDisposition ); + } + + void handleUnfinishedSections() { + // If sections ended prematurely due to an exception we stored their + // infos here so we can tear them down outside the unwind process. + for( std::vector::const_reverse_iterator it = m_unfinishedSections.rbegin(), + itEnd = m_unfinishedSections.rend(); + it != itEnd; + ++it ) + sectionEnded( it->info, it->prevAssertions, it->durationInSeconds ); + m_unfinishedSections.clear(); + } + struct UnfinishedSections { UnfinishedSections( SectionInfo const& _info, Counts const& _prevAssertions, double _durationInSeconds ) : info( _info ), prevAssertions( _prevAssertions ), durationInSeconds( _durationInSeconds ) From 93b61e119435ea6c67e8d6ee53d350ef24f482ab Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 22 Aug 2014 19:35:41 +0100 Subject: [PATCH 005/102] v1.1 build 2 (develop branch) - Signal hander support --- README.md | 2 +- include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 171 +++++++++++++++++++++++++---- 3 files changed, 154 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 9b35b6b4..38f6884f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![catch logo](catch-logo-small.png) -*v1.1 build 1 (develop branch)* +*v1.1 build 2 (develop branch)* Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index d1bdbb19..ac17c619 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -13,7 +13,7 @@ namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 1, "develop" ); + Version libraryVersion( 1, 1, 2, "develop" ); } #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 06a6f141..39644f21 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * CATCH v1.1 build 1 (develop branch) - * Generated: 2014-08-20 19:07:01.206746 + * CATCH v1.1 build 2 (develop branch) + * Generated: 2014-08-22 19:34:41.932570 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -603,7 +603,9 @@ namespace Catch { Exception = 0x100 | FailureBit, ThrewException = Exception | 1, - DidntThrowException = Exception | 2 + DidntThrowException = Exception | 2, + + FatalErrorCondition = 0x200 | FailureBit }; }; @@ -1395,6 +1397,8 @@ namespace Catch { virtual std::string getCurrentTestName() const = 0; virtual const AssertionResult* getLastResult() const = 0; + + virtual void handleFatalErrorCondition( std::string const& message ) = 0; }; IResultCapture& getResultCapture(); @@ -4915,6 +4919,71 @@ using SectionTracking::TestCaseTracker; } // namespace Catch +// #included from: catch_fatal_condition.hpp +#define TWOBLUECUBES_CATCH_FATAL_CONDITION_H_INCLUDED + +namespace Catch { + + // Report the error condition then exit the process + inline void fatal( std::string const& message, int exitCode ) { + IContext& context = Catch::getCurrentContext(); + IResultCapture* resultCapture = context.getResultCapture(); + resultCapture->handleFatalErrorCondition( message ); + + if( Catch::alwaysTrue() ) // avoids "no return" warnings + exit( exitCode ); + } + +} // namespace Catch + +#if defined ( CATCH_PLATFORM_WINDOWS ) ///////////////////////////////////////// + +namespace Catch { + + struct FatalConditionHandler {}; + +} // namespace Catch + +#else // Not Windows - assumed to be POSIX compatible ////////////////////////// + +#include + +namespace Catch { + + struct SignalDefs { int id; const char* name; }; + extern SignalDefs signalDefs[]; + SignalDefs signalDefs[] = { + { SIGINT, "SIGINT - Terminal interrupt signal" }, + { SIGILL, "SIGILL - Illegal instruction signal" }, + { SIGFPE, "SIGFPE - Floating point error signal" }, + { SIGSEGV, "SIGSEGV - Segmentation violation signal" }, + { SIGTERM, "SIGTERM - Termination request signal" }, + { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" } + }; + + struct FatalConditionHandler { + + static void handleSignal( int sig ) { + for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) + if( sig == signalDefs[i].id ) + fatal( signalDefs[i].name, -sig ); + fatal( "", -sig ); + } + + FatalConditionHandler() { + for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) + signal( signalDefs[i].id, handleSignal ); + } + ~FatalConditionHandler() { + for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) + signal( signalDefs[i].id, SIG_DFL ); + } + }; + +} // namespace Catch + +#endif // not Windows + #include #include @@ -5102,6 +5171,37 @@ namespace Catch { return &m_lastResult; } + virtual void handleFatalErrorCondition( std::string const& message ) { + ResultBuilder resultBuilder = makeUnexpectedResultBuilder(); + resultBuilder.setResultType( ResultWas::FatalErrorCondition ); + resultBuilder << message; + resultBuilder.captureExpression(); + + handleUnfinishedSections(); + + // Recreate section for test case (as we will lose the one that was in scope) + TestCaseInfo const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); + SectionInfo testCaseSection( testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description ); + + Counts assertions; + assertions.failed = 1; + SectionStats testCaseSectionStats( testCaseSection, assertions, 0, false ); + m_reporter->sectionEnded( testCaseSectionStats ); + + TestCaseInfo testInfo = m_activeTestCase->getTestCaseInfo(); + + Totals deltaTotals; + deltaTotals.testCases.failed = 1; + m_reporter->testCaseEnded( TestCaseStats( testInfo, + deltaTotals, + "", + "", + false ) ); + m_totals.testCases.failed++; + testGroupEnded( "", m_totals, 1, 1 ); + m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, false ) ); + } + public: // !TBD We need to do this another way! bool aborting() const { @@ -5125,10 +5225,10 @@ namespace Catch { if( m_reporter->getPreferences().shouldRedirectStdOut ) { StreamRedirect coutRedir( std::cout, redirectedCout ); StreamRedirect cerrRedir( std::cerr, redirectedCerr ); - m_activeTestCase->invoke(); + invokeActiveTestCase(); } else { - m_activeTestCase->invoke(); + invokeActiveTestCase(); } duration = timer.getElapsedSeconds(); } @@ -5136,20 +5236,9 @@ namespace Catch { // This just means the test was aborted due to failure } catch(...) { - ResultBuilder exResult( m_lastAssertionInfo.macroName.c_str(), - m_lastAssertionInfo.lineInfo, - m_lastAssertionInfo.capturedExpression.c_str(), - m_lastAssertionInfo.resultDisposition ); - exResult.useActiveException(); + makeUnexpectedResultBuilder().useActiveException(); } - // If sections ended prematurely due to an exception we stored their - // infos here so we can tear them down outside the unwind process. - for( std::vector::const_reverse_iterator it = m_unfinishedSections.rbegin(), - itEnd = m_unfinishedSections.rend(); - it != itEnd; - ++it ) - sectionEnded( it->info, it->prevAssertions, it->durationInSeconds ); - m_unfinishedSections.clear(); + handleUnfinishedSections(); m_messages.clear(); Counts assertions = m_totals.assertions - prevAssertions; @@ -5165,7 +5254,31 @@ namespace Catch { m_reporter->sectionEnded( testCaseSectionStats ); } + void invokeActiveTestCase() { + FatalConditionHandler fatalConditionHandler; // Handle signals + m_activeTestCase->invoke(); + } + private: + + ResultBuilder makeUnexpectedResultBuilder() const { + return ResultBuilder( m_lastAssertionInfo.macroName.c_str(), + m_lastAssertionInfo.lineInfo, + m_lastAssertionInfo.capturedExpression.c_str(), + m_lastAssertionInfo.resultDisposition ); + } + + void handleUnfinishedSections() { + // If sections ended prematurely due to an exception we stored their + // infos here so we can tear them down outside the unwind process. + for( std::vector::const_reverse_iterator it = m_unfinishedSections.rbegin(), + itEnd = m_unfinishedSections.rend(); + it != itEnd; + ++it ) + sectionEnded( it->info, it->prevAssertions, it->durationInSeconds ); + m_unfinishedSections.clear(); + } + struct UnfinishedSections { UnfinishedSections( SectionInfo const& _info, Counts const& _prevAssertions, double _durationInSeconds ) : info( _info ), prevAssertions( _prevAssertions ), durationInSeconds( _durationInSeconds ) @@ -6417,7 +6530,7 @@ namespace Catch { namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 1, "develop" ); + Version libraryVersion( 1, 1, 2, "develop" ); } // #included from: catch_message.hpp @@ -7770,6 +7883,13 @@ namespace Catch { .writeText( assertionResult.getMessage() ); m_currentTestSuccess = false; break; + case ResultWas::FatalErrorCondition: + m_xml.scopedElement( "Fatal Error Condition" ) + .writeAttribute( "filename", assertionResult.getSourceInfo().file ) + .writeAttribute( "line", assertionResult.getSourceInfo().line ) + .writeText( assertionResult.getMessage() ); + m_currentTestSuccess = false; + break; case ResultWas::Info: m_xml.scopedElement( "Info" ) .writeText( assertionResult.getMessage() ); @@ -7970,6 +8090,7 @@ namespace Catch { std::string elementName; switch( result.getResultType() ) { case ResultWas::ThrewException: + case ResultWas::FatalErrorCondition: elementName = "error"; break; case ResultWas::ExplicitFailure: @@ -8164,6 +8285,11 @@ namespace Catch { passOrFail = "FAILED"; messageLabel = "due to unexpected exception with message"; break; + case ResultWas::FatalErrorCondition: + colour = Colour::Error; + passOrFail = "FAILED"; + messageLabel = "due to a fatal error condition"; + break; case ResultWas::DidntThrowException: colour = Colour::Error; passOrFail = "FAILED"; @@ -8569,6 +8695,13 @@ namespace Catch { printExpressionWas(); printRemainingMessages(); break; + case ResultWas::FatalErrorCondition: + printResultType( Colour::Error, failedString() ); + printIssue( "fatal error condition with message:" ); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; case ResultWas::DidntThrowException: printResultType( Colour::Error, failedString() ); printIssue( "expected exception, got none" ); From 000e746415912ecaa6e87a59d4c4a7b7e1660a05 Mon Sep 17 00:00:00 2001 From: Andy Sawyer Date: Mon, 1 Sep 2014 17:19:59 +0100 Subject: [PATCH 006/102] SelfTest: refresh makefile --- projects/SelfTest/makefile | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/projects/SelfTest/makefile b/projects/SelfTest/makefile index e5dec0dc..458b3dea 100644 --- a/projects/SelfTest/makefile +++ b/projects/SelfTest/makefile @@ -1,15 +1,16 @@ -SOURCES = ApproxTests.cpp \ - ClassTests.cpp \ - ConditionTests.cpp \ - ExceptionTests.cpp \ - GeneratorTests.cpp \ - MessageTests.cpp \ - MiscTests.cpp \ - TestMain.cpp \ - TrickyTests.cpp \ - BDDTests.cpp \ - VariadicMacrosTests.cpp \ - catch_self_test.cpp +SOURCES = ApproxTests.cpp \ + ClassTests.cpp \ + ConditionTests.cpp \ + ExceptionTests.cpp \ + GeneratorTests.cpp \ + MessageTests.cpp \ + MiscTests.cpp \ + TestMain.cpp \ + TrickyTests.cpp \ + BDDTests.cpp \ + VariadicMacrosTests.cpp + + OBJECTS = $(patsubst %.cpp, %.o, $(SOURCES)) CXX = g++ CXXFLAGS = -I../../include @@ -17,5 +18,9 @@ CXXFLAGS = -I../../include CatchSelfTest: $(OBJECTS) $(CXX) -o $@ $^ +test: CatchSelfTest + ./CatchSelfTest + clean: - rm -f $(OBJECTS) + rm -f $(OBJECTS) CatchSelfTest + From 142f8f4b1e7f75aadae7df54ffd5f0a384bd70c0 Mon Sep 17 00:00:00 2001 From: Andy Sawyer Date: Mon, 1 Sep 2014 17:24:10 +0100 Subject: [PATCH 007/102] SelfTest: Build as C++11, add EnumToString tests Note: EnumToString tests currently fail - haven't made the changes to catch_tostring yet. --- projects/SelfTest/EnumToString.cpp | 71 ++++++++++++++++++++++++++++++ projects/SelfTest/makefile | 5 ++- 2 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 projects/SelfTest/EnumToString.cpp diff --git a/projects/SelfTest/EnumToString.cpp b/projects/SelfTest/EnumToString.cpp new file mode 100644 index 00000000..53738028 --- /dev/null +++ b/projects/SelfTest/EnumToString.cpp @@ -0,0 +1,71 @@ +#include "catch.hpp" + +/* + TODO: maybe ought to check that user-provided specialisations of + Catch::toString also do the right thing +*/ + +// Enum without user-provided stream operator +enum Enum1 { Enum1Value0, Enum1Value1 }; + +TEST_CASE( "toString(enum)", "[toString][enum]" ) +{ + Enum1 e0 = Enum1Value0; + CHECK( Catch::toString(e0) == "0" ); + Enum1 e1 = Enum1Value1; + CHECK( Catch::toString(e1) == "1" ); +} + +// Enum with user-provided stream operator +enum Enum2 { Enum2Value0, Enum2Value1 }; + +std::ostream& operator<<( std::ostream& os, Enum2 v ) +{ + return os << "E2{" << static_cast(v) << "}"; +} + +TEST_CASE( "toString(enum w/operator<<)", "[toString][enum]" ) +{ + Enum2 e0 = Enum2Value0; + CHECK( Catch::toString(e0) == "E2{0}" ); + Enum2 e1 = Enum2Value1; + CHECK( Catch::toString(e1) == "E2{1}" ); +} + +#if defined(CATCH_CPP11_OR_GREATER) +// Enum class without user-provided stream operator +enum class EnumClass1 { EnumClass1Value0, EnumClass1Value1 }; + +TEST_CASE( "toString(enum class)", "[toString][enum][enumClass]" ) +{ + EnumClass1 e0 = EnumClass1::EnumClass1Value0; + CHECK( Catch::toString(e0) == "0" ); + EnumClass1 e1 = EnumClass1::EnumClass1Value1; + CHECK( Catch::toString(e1) == "1" ); +} + +// Enum class with user-provided stream operator +enum class EnumClass2 : short { EnumClass2Value0, EnumClass2Value1 }; + +std::ostream& operator<<( std::ostream& os, EnumClass2 e2 ) +{ + switch( e2 ) + { + case EnumClass2::EnumClass2Value0: + return os << "E2/V0"; + case EnumClass2::EnumClass2Value1: + return os << "E2/V1"; + } + return os << "unexpected..."; +} + +TEST_CASE( "toString(enum class w/operator<<)", "[toString][enum][enumClass]" ) +{ + EnumClass2 e0 = EnumClass2::EnumClass2Value0; + CHECK( Catch::toString(e0) == "E2/V0" ); + EnumClass2 e1 = EnumClass2::EnumClass2Value1; + CHECK( Catch::toString(e1) == "E2/V1" ); +} + +#endif + diff --git a/projects/SelfTest/makefile b/projects/SelfTest/makefile index 458b3dea..e9f64855 100644 --- a/projects/SelfTest/makefile +++ b/projects/SelfTest/makefile @@ -8,12 +8,13 @@ SOURCES = ApproxTests.cpp \ TestMain.cpp \ TrickyTests.cpp \ BDDTests.cpp \ - VariadicMacrosTests.cpp + VariadicMacrosTests.cpp \ + EnumToString.cpp OBJECTS = $(patsubst %.cpp, %.o, $(SOURCES)) CXX = g++ -CXXFLAGS = -I../../include +CXXFLAGS = -I../../include -std=c++11 CatchSelfTest: $(OBJECTS) $(CXX) -o $@ $^ From cd2a5aa688be79226f646aeb94f7bd27c39f033f Mon Sep 17 00:00:00 2001 From: Andy Sawyer Date: Mon, 1 Sep 2014 17:35:01 +0100 Subject: [PATCH 008/102] catch_tostring: tostring for enum class types --- include/internal/catch_tostring.h | 36 ++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/include/internal/catch_tostring.h b/include/internal/catch_tostring.h index e8e38296..dbb31423 100644 --- a/include/internal/catch_tostring.h +++ b/include/internal/catch_tostring.h @@ -22,6 +22,11 @@ #endif namespace Catch { + +// Why we're here. +template +std::string toString( T const& value ); + namespace Detail { // SFINAE is currently disabled by default for all compilers. @@ -64,10 +69,38 @@ namespace Detail { #endif +#if defined(CATCH_CPP11_OR_GREATER) + template::value + > + struct EnumStringMaker + { + static std::string convert( T const& ) { return "{?}"; } + }; + + template + struct EnumStringMaker + { + static std::string convert( T const& v ) + { + return ::Catch::toString( + static_cast::type>(v) + ); + } + }; +#endif template struct StringMakerBase { +#if defined(CATCH_CPP11_OR_GREATER) + template + static std::string convert( T const& v ) + { + return EnumStringMaker::convert( v ); + } +#else template static std::string convert( T const& ) { return "{?}"; } +#endif }; template<> @@ -89,9 +122,6 @@ namespace Detail { } // end namespace Detail -template -std::string toString( T const& value ); - template struct StringMaker : Detail::StringMakerBase::value> {}; From abf9ffc9820fc8e1b27320316118034a8e4750c6 Mon Sep 17 00:00:00 2001 From: Andy Sawyer Date: Mon, 1 Sep 2014 18:09:37 +0100 Subject: [PATCH 009/102] A bunch of Catch::toString tests --- projects/SelfTest/ToStringPair.cpp | 51 +++++++++++++++++++ projects/SelfTest/ToStringVector.cpp | 72 +++++++++++++++++++++++++++ projects/SelfTest/ToStringWhich.cpp | 74 ++++++++++++++++++++++++++++ projects/SelfTest/makefile | 5 +- 4 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 projects/SelfTest/ToStringPair.cpp create mode 100644 projects/SelfTest/ToStringVector.cpp create mode 100644 projects/SelfTest/ToStringWhich.cpp diff --git a/projects/SelfTest/ToStringPair.cpp b/projects/SelfTest/ToStringPair.cpp new file mode 100644 index 00000000..2de4a55a --- /dev/null +++ b/projects/SelfTest/ToStringPair.cpp @@ -0,0 +1,51 @@ +#include "catch.hpp" + +// === Pair === +namespace Catch { + // Note: If we put this in the right place in catch_tostring, then + // we can make it an overload of Catch::toString + template + struct StringMaker > { + static std::string convert( const std::pair& pair ) { + std::ostringstream oss; + oss << "{ " + << toString( pair.first ) + << ", " + << toString( pair.second ) + << " }"; + return oss.str(); + } + }; +} + +TEST_CASE( "std::pair -> toString", "[toString][pair]" ) +{ + std::pair value( 34, "xyzzy" ); + REQUIRE( Catch::toString( value ) == "{ 34, \"xyzzy\" }" ); +} + +TEST_CASE( "std::pair -> toString", "[toString][pair]" ) +{ + std::pair value( 34, "xyzzy" ); + REQUIRE( Catch::toString(value) == "{ 34, \"xyzzy\" }" ); +} + +TEST_CASE( "std::vector > -> toString", "[toString][pair]" ) +{ + std::vector > pr; + pr.push_back( std::make_pair("green", 55 ) ); + REQUIRE( Catch::toString( pr ) == "{ { \"green\", 55 } }" ); +} + +// This is pretty contrived - I figure if this works, anything will... +TEST_CASE( "pair > -> toString", "[toString][pair]" ) +{ + typedef std::pair left_t; + typedef std::pair right_t; + + left_t left( 42, "Arthur" ); + right_t right( "Ford", 24 ); + + std::pair pair( left, right ); + REQUIRE( Catch::toString( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" ); +} diff --git a/projects/SelfTest/ToStringVector.cpp b/projects/SelfTest/ToStringVector.cpp new file mode 100644 index 00000000..f3b036e5 --- /dev/null +++ b/projects/SelfTest/ToStringVector.cpp @@ -0,0 +1,72 @@ +#include "catch.hpp" +#include + + +// vedctor +TEST_CASE( "vector -> toString", "[toString][vector]" ) +{ + std::vector vv; + REQUIRE( Catch::toString(vv) == "{ }" ); + vv.push_back( 42 ); + REQUIRE( Catch::toString(vv) == "{ 42 }" ); + vv.push_back( 512 ); + REQUIRE( Catch::toString(vv) == "{ 42, 512 }" ); +} + +TEST_CASE( "vector -> toString", "[toString][vector]" ) +{ + std::vector vv; + REQUIRE( Catch::toString(vv) == "{ }" ); + vv.push_back( "hello" ); + REQUIRE( Catch::toString(vv) == "{ \"hello\" }" ); + vv.push_back( "world" ); + REQUIRE( Catch::toString(vv) == "{ \"hello\", \"world\" }" ); +} + +#if defined(CATCH_CPP11_OR_GREATER) +/* + Note: These tests *can* be made to work with C++ < 11, but the + allocator is a lot more work... +*/ +namespace { + /* Minimal Allocator */ + template + struct minimal_allocator { + typedef T value_type; + typedef std::size_t size_type; + T *allocate( size_type n ) + { + return static_cast( ::operator new( n * sizeof(T) ) ); + } + void deallocate( T *p, size_type /*n*/ ) + { + ::operator delete( static_cast(p) ); + } + template + bool operator==( const minimal_allocator& ) const { return true; } + template + bool operator!=( const minimal_allocator& ) const { return false; } + }; +} + +TEST_CASE( "vector -> toString", "[toString][vector,allocator]" ) +{ + std::vector > vv; + REQUIRE( Catch::toString(vv) == "{ }" ); + vv.push_back( 42 ); + REQUIRE( Catch::toString(vv) == "{ 42 }" ); + vv.push_back( 512 ); + REQUIRE( Catch::toString(vv) == "{ 42, 512 }" ); +} + +TEST_CASE( "vec> -> toString", "[toString][vector,allocator]" ) +{ + typedef std::vector > inner; + typedef std::vector vector; + vector v; + REQUIRE( Catch::toString(v) == "{ }" ); + v.push_back( inner { "hello" } ); + v.push_back( inner { "world" } ); + REQUIRE( Catch::toString(v) == "{ { \"hello\" }, { \"world\" } }" ); +} +#endif diff --git a/projects/SelfTest/ToStringWhich.cpp b/projects/SelfTest/ToStringWhich.cpp new file mode 100644 index 00000000..f9f4beb5 --- /dev/null +++ b/projects/SelfTest/ToStringWhich.cpp @@ -0,0 +1,74 @@ +#include "catch.hpp" +/* + Demonstrate which version of toString/StringMaker is being used + for various types +*/ + + +struct has_toString { }; +struct has_maker {}; +struct has_maker_and_toString {}; + +namespace Catch { + std::string toString( const has_toString& ) { + return "toString( has_toString )"; + } + std::string toString( const has_maker_and_toString& ) { + return "toString( has_maker_and_toString )"; + } + template<> + struct StringMaker { + static std::string convert( const has_maker& ) { + return "StringMaker"; + } + }; + template<> + struct StringMaker { + static std::string convert( const has_maker_and_toString& ) { + return "StringMaker"; + } + }; +} + +// Call the overload +TEST_CASE( "toString( has_toString )", "[toString]" ) +{ + has_toString item; + REQUIRE( Catch::toString( item ) == "toString( has_toString )" ); +} + +// Call the overload +TEST_CASE( "toString( has_maker )", "[toString]" ) +{ + has_maker item; + REQUIRE( Catch::toString( item ) == "StringMaker" ); +} + +// Call the overload +TEST_CASE( "toString( has_maker_and_toString )", "[toString]" ) +{ + has_maker_and_toString item; + REQUIRE( Catch::toString( item ) == "toString( has_maker_and_toString )" ); +} + +// Vectors... +TEST_CASE( "toString( vectors v(1); + // This invokes template toString which actually gives us '{ ? }' + REQUIRE( Catch::toString( v ) == "{ {?} }" ); +} + +TEST_CASE( "toString( vectors v(1); + REQUIRE( Catch::toString( v ) == "{ StringMaker }" ); +} + + +TEST_CASE( "toString( vectors v(1); + // Note: This invokes the template toString -> StringMaker + REQUIRE( Catch::toString( v ) == "{ StringMaker }" ); +} diff --git a/projects/SelfTest/makefile b/projects/SelfTest/makefile index e9f64855..0a29372c 100644 --- a/projects/SelfTest/makefile +++ b/projects/SelfTest/makefile @@ -9,7 +9,10 @@ SOURCES = ApproxTests.cpp \ TrickyTests.cpp \ BDDTests.cpp \ VariadicMacrosTests.cpp \ - EnumToString.cpp + EnumToString.cpp \ + ToStringPair.cpp \ + ToStringVector.cpp \ + ToStringWhich.cpp OBJECTS = $(patsubst %.cpp, %.o, $(SOURCES)) From fdbbb2c9bd6901c4fbb2e36868da6ac3e295f2b8 Mon Sep 17 00:00:00 2001 From: Andy Sawyer Date: Mon, 1 Sep 2014 18:27:29 +0100 Subject: [PATCH 010/102] Updated CMakeLists.txt for toString work --- projects/CMake/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index c31ec32b..952ba43e 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -21,6 +21,10 @@ set(SOURCES ${SELF_TEST_DIR}/TestMain.cpp ${SELF_TEST_DIR}/TrickyTests.cpp ${SELF_TEST_DIR}/VariadicMacrosTests.cpp + ${SELF_TEST_DIR}/EnumToString.cpp + ${SELF_TEST_DIR}/ToStringPair.cpp + ${SELF_TEST_DIR}/ToStringVector.cpp + ${SELF_TEST_DIR}/ToStringWhich.cpp ) # configure the executable From 3eefa7f53709b5a6478a8bedf52939274ba0b182 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 2 Sep 2014 08:30:57 +0100 Subject: [PATCH 011/102] use nullptr in MSVC from 2005+ (based on PR #307 - thanks alex85k) --- include/internal/catch_compiler_capabilities.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/internal/catch_compiler_capabilities.h b/include/internal/catch_compiler_capabilities.h index 76d0ffda..89073bec 100644 --- a/include/internal/catch_compiler_capabilities.h +++ b/include/internal/catch_compiler_capabilities.h @@ -84,6 +84,10 @@ //#define CATCH_CONFIG_SFINAE // Not confirmed #endif +#if (_MSC_VER >= 1400) +#define CATCH_CONFIG_CPP11_NULLPTR +#endif + #endif // _MSC_VER // Use variadic macros if the compiler supports them From fcf5ef0db647e7f3dac05359101d6af5693b589c Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 3 Sep 2014 19:20:23 +0100 Subject: [PATCH 012/102] Changed time function name to reflect that it actually returns Microseconds as reported in #323 --- include/internal/catch_timer.h | 2 +- include/internal/catch_timer.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/internal/catch_timer.h b/include/internal/catch_timer.h index 015f88bc..22e9e635 100644 --- a/include/internal/catch_timer.h +++ b/include/internal/catch_timer.h @@ -22,7 +22,7 @@ namespace Catch { public: Timer() : m_ticks( 0 ) {} void start(); - unsigned int getElapsedNanoseconds() const; + unsigned int getElapsedMicroseconds() const; unsigned int getElapsedMilliseconds() const; double getElapsedSeconds() const; diff --git a/include/internal/catch_timer.hpp b/include/internal/catch_timer.hpp index b60fa2b5..988382b3 100644 --- a/include/internal/catch_timer.hpp +++ b/include/internal/catch_timer.hpp @@ -46,14 +46,14 @@ namespace Catch { void Timer::start() { m_ticks = getCurrentTicks(); } - unsigned int Timer::getElapsedNanoseconds() const { + unsigned int Timer::getElapsedMicroseconds() const { return static_cast(getCurrentTicks() - m_ticks); } unsigned int Timer::getElapsedMilliseconds() const { - return static_cast((getCurrentTicks() - m_ticks)/1000); + return static_cast(getElapsedMicroseconds()/1000); } double Timer::getElapsedSeconds() const { - return (getCurrentTicks() - m_ticks)/1000000.0; + return getElapsedMicroseconds()/1000000.0; } } // namespace Catch From 5ea326685736c6bd558d589d1949d4e8b40ca8a1 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 3 Sep 2014 19:22:47 +0100 Subject: [PATCH 013/102] Added baselines for new test cases --- .../Baselines/console.std.approved.txt | 4 +- .../Baselines/console.sw.approved.txt | 304 ++++++++++++++++- .../Baselines/console.swa4.approved.txt | 76 ++++- .../SelfTest/Baselines/junit.sw.approved.txt | 20 +- .../SelfTest/Baselines/xml.sw.approved.txt | 308 +++++++++++++++++- 5 files changed, 703 insertions(+), 9 deletions(-) diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 96335b15..d2e42b43 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -786,6 +786,6 @@ with expansion: "first" == "second" =============================================================================== -test cases: 130 | 91 passed | 38 failed | 1 failed as expected -assertions: 709 | 617 passed | 79 failed | 13 failed as expected +test cases: 148 | 109 passed | 38 failed | 1 failed as expected +assertions: 738 | 646 passed | 79 failed | 13 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index cdc918bd..169f2633 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -3,6 +3,78 @@ CatchSelfTest is a (develop) host application. Run with -? for options +------------------------------------------------------------------------------- +toString(enum) +------------------------------------------------------------------------------- +EnumToString.cpp: +............................................................................... + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e0) == "0" ) +with expansion: + "0" == "0" + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e1) == "1" ) +with expansion: + "1" == "1" + +------------------------------------------------------------------------------- +toString(enum w/operator<<) +------------------------------------------------------------------------------- +EnumToString.cpp: +............................................................................... + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e0) == "E2{0}" ) +with expansion: + "E2{0}" == "E2{0}" + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e1) == "E2{1}" ) +with expansion: + "E2{1}" == "E2{1}" + +------------------------------------------------------------------------------- +toString(enum class) +------------------------------------------------------------------------------- +EnumToString.cpp: +............................................................................... + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e0) == "0" ) +with expansion: + "0" == "0" + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e1) == "1" ) +with expansion: + "1" == "1" + +------------------------------------------------------------------------------- +toString(enum class w/operator<<) +------------------------------------------------------------------------------- +EnumToString.cpp: +............................................................................... + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e0) == "E2/V0" ) +with expansion: + "E2/V0" == "E2/V0" + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e1) == "E2/V1" ) +with expansion: + "E2/V1" == "E2/V1" + ------------------------------------------------------------------------------- Some simple comparisons between doubles ------------------------------------------------------------------------------- @@ -5905,6 +5977,234 @@ TrickyTests.cpp: TrickyTests.cpp:: PASSED: +------------------------------------------------------------------------------- +toString( has_toString ) +------------------------------------------------------------------------------- +ToStringWhich.cpp: +............................................................................... + +ToStringWhich.cpp:: +PASSED: + REQUIRE( Catch::toString( item ) == "toString( has_toString )" ) +with expansion: + "toString( has_toString )" + == + "toString( has_toString )" + +------------------------------------------------------------------------------- +toString( has_maker ) +------------------------------------------------------------------------------- +ToStringWhich.cpp: +............................................................................... + +ToStringWhich.cpp:: +PASSED: + REQUIRE( Catch::toString( item ) == "StringMaker" ) +with expansion: + "StringMaker" + == + "StringMaker" + +------------------------------------------------------------------------------- +toString( has_maker_and_toString ) +------------------------------------------------------------------------------- +ToStringWhich.cpp: +............................................................................... + +ToStringWhich.cpp:: +PASSED: + REQUIRE( Catch::toString( item ) == "toString( has_maker_and_toString )" ) +with expansion: + "toString( has_maker_and_toString )" + == + "toString( has_maker_and_toString )" + +------------------------------------------------------------------------------- +toString( vectors +............................................................................... + +ToStringWhich.cpp:: +PASSED: + REQUIRE( Catch::toString( v ) == "{ {?} }" ) +with expansion: + "{ {?} }" == "{ {?} }" + +------------------------------------------------------------------------------- +toString( vectors +............................................................................... + +ToStringWhich.cpp:: +PASSED: + REQUIRE( Catch::toString( v ) == "{ StringMaker }" ) +with expansion: + "{ StringMaker }" + == + "{ StringMaker }" + +------------------------------------------------------------------------------- +toString( vectors +............................................................................... + +ToStringWhich.cpp:: +PASSED: + REQUIRE( Catch::toString( v ) == "{ StringMaker }" ) +with expansion: + "{ StringMaker }" + == + "{ StringMaker }" + +------------------------------------------------------------------------------- +std::pair -> toString +------------------------------------------------------------------------------- +ToStringPair.cpp: +............................................................................... + +ToStringPair.cpp:: +PASSED: + REQUIRE( Catch::toString( value ) == "{ 34, \"xyzzy\" }" ) +with expansion: + "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" + +------------------------------------------------------------------------------- +std::pair -> toString +------------------------------------------------------------------------------- +ToStringPair.cpp: +............................................................................... + +ToStringPair.cpp:: +PASSED: + REQUIRE( Catch::toString(value) == "{ 34, \"xyzzy\" }" ) +with expansion: + "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" + +------------------------------------------------------------------------------- +std::vector > -> toString +------------------------------------------------------------------------------- +ToStringPair.cpp: +............................................................................... + +ToStringPair.cpp:: +PASSED: + REQUIRE( Catch::toString( pr ) == "{ { \"green\", 55 } }" ) +with expansion: + "{ { "green", 55 } }" + == + "{ { "green", 55 } }" + +------------------------------------------------------------------------------- +pair > -> toString +------------------------------------------------------------------------------- +ToStringPair.cpp: +............................................................................... + +ToStringPair.cpp:: +PASSED: + REQUIRE( Catch::toString( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" ) +with expansion: + "{ { 42, "Arthur" }, { "Ford", 24 } }" + == + "{ { 42, "Arthur" }, { "Ford", 24 } }" + +------------------------------------------------------------------------------- +vector -> toString +------------------------------------------------------------------------------- +ToStringVector.cpp: +............................................................................... + +ToStringVector.cpp:: +PASSED: + REQUIRE( Catch::toString(vv) == "{ }" ) +with expansion: + "{ }" == "{ }" + +ToStringVector.cpp:: +PASSED: + REQUIRE( Catch::toString(vv) == "{ 42 }" ) +with expansion: + "{ 42 }" == "{ 42 }" + +ToStringVector.cpp:: +PASSED: + REQUIRE( Catch::toString(vv) == "{ 42, 512 }" ) +with expansion: + "{ 42, 512 }" == "{ 42, 512 }" + +------------------------------------------------------------------------------- +vector -> toString +------------------------------------------------------------------------------- +ToStringVector.cpp: +............................................................................... + +ToStringVector.cpp:: +PASSED: + REQUIRE( Catch::toString(vv) == "{ }" ) +with expansion: + "{ }" == "{ }" + +ToStringVector.cpp:: +PASSED: + REQUIRE( Catch::toString(vv) == "{ \"hello\" }" ) +with expansion: + "{ "hello" }" == "{ "hello" }" + +ToStringVector.cpp:: +PASSED: + REQUIRE( Catch::toString(vv) == "{ \"hello\", \"world\" }" ) +with expansion: + "{ "hello", "world" }" + == + "{ "hello", "world" }" + +------------------------------------------------------------------------------- +vector -> toString +------------------------------------------------------------------------------- +ToStringVector.cpp: +............................................................................... + +ToStringVector.cpp:: +PASSED: + REQUIRE( Catch::toString(vv) == "{ }" ) +with expansion: + "{ }" == "{ }" + +ToStringVector.cpp:: +PASSED: + REQUIRE( Catch::toString(vv) == "{ 42 }" ) +with expansion: + "{ 42 }" == "{ 42 }" + +ToStringVector.cpp:: +PASSED: + REQUIRE( Catch::toString(vv) == "{ 42, 512 }" ) +with expansion: + "{ 42, 512 }" == "{ 42, 512 }" + +------------------------------------------------------------------------------- +vec> -> toString +------------------------------------------------------------------------------- +ToStringVector.cpp: +............................................................................... + +ToStringVector.cpp:: +PASSED: + REQUIRE( Catch::toString(v) == "{ }" ) +with expansion: + "{ }" == "{ }" + +ToStringVector.cpp:: +PASSED: + REQUIRE( Catch::toString(v) == "{ { \"hello\" }, { \"world\" } }" ) +with expansion: + "{ { "hello" }, { "world" } }" + == + "{ { "hello" }, { "world" } }" + ------------------------------------------------------------------------------- Parse test names and tags Empty test spec should have no filters @@ -7375,6 +7675,6 @@ with expansion: true =============================================================================== -test cases: 130 | 75 passed | 54 failed | 1 failed as expected -assertions: 729 | 617 passed | 99 failed | 13 failed as expected +test cases: 148 | 93 passed | 54 failed | 1 failed as expected +assertions: 758 | 646 passed | 99 failed | 13 failed as expected diff --git a/projects/SelfTest/Baselines/console.swa4.approved.txt b/projects/SelfTest/Baselines/console.swa4.approved.txt index f48083e0..276c93ec 100644 --- a/projects/SelfTest/Baselines/console.swa4.approved.txt +++ b/projects/SelfTest/Baselines/console.swa4.approved.txt @@ -3,6 +3,78 @@ CatchSelfTest is a (develop) host application. Run with -? for options +------------------------------------------------------------------------------- +toString(enum) +------------------------------------------------------------------------------- +EnumToString.cpp: +............................................................................... + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e0) == "0" ) +with expansion: + "0" == "0" + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e1) == "1" ) +with expansion: + "1" == "1" + +------------------------------------------------------------------------------- +toString(enum w/operator<<) +------------------------------------------------------------------------------- +EnumToString.cpp: +............................................................................... + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e0) == "E2{0}" ) +with expansion: + "E2{0}" == "E2{0}" + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e1) == "E2{1}" ) +with expansion: + "E2{1}" == "E2{1}" + +------------------------------------------------------------------------------- +toString(enum class) +------------------------------------------------------------------------------- +EnumToString.cpp: +............................................................................... + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e0) == "0" ) +with expansion: + "0" == "0" + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e1) == "1" ) +with expansion: + "1" == "1" + +------------------------------------------------------------------------------- +toString(enum class w/operator<<) +------------------------------------------------------------------------------- +EnumToString.cpp: +............................................................................... + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e0) == "E2/V0" ) +with expansion: + "E2/V0" == "E2/V0" + +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e1) == "E2/V1" ) +with expansion: + "E2/V1" == "E2/V1" + ------------------------------------------------------------------------------- Some simple comparisons between doubles ------------------------------------------------------------------------------- @@ -406,6 +478,6 @@ with expansion: 9.1f != Approx( 9.1000003815 ) =============================================================================== -test cases: 15 | 11 passed | 3 failed | 1 failed as expected -assertions: 53 | 47 passed | 4 failed | 2 failed as expected +test cases: 19 | 15 passed | 3 failed | 1 failed as expected +assertions: 61 | 55 passed | 4 failed | 2 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 450c09fe..7ce10d72 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,5 +1,9 @@ - + + + + + @@ -529,6 +533,20 @@ TrickyTests.cpp: + + + + + + + + + + + + + + diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 2011abf5..5c06f6e0 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -1,5 +1,81 @@ + + + + Catch::toString(e0) == "0" + + + "0" == "0" + + + + + Catch::toString(e1) == "1" + + + "1" == "1" + + + + + + + + Catch::toString(e0) == "E2{0}" + + + "E2{0}" == "E2{0}" + + + + + Catch::toString(e1) == "E2{1}" + + + "E2{1}" == "E2{1}" + + + + + + + + Catch::toString(e0) == "0" + + + "0" == "0" + + + + + Catch::toString(e1) == "1" + + + "1" == "1" + + + + + + + + Catch::toString(e0) == "E2/V0" + + + "E2/V0" == "E2/V0" + + + + + Catch::toString(e1) == "E2/V1" + + + "E2/V1" == "E2/V1" + + + + @@ -6030,6 +6106,234 @@ there" + + + + Catch::toString( item ) == "toString( has_toString )" + + + "toString( has_toString )" +== +"toString( has_toString )" + + + + + + + + Catch::toString( item ) == "StringMaker<has_maker>" + + + "StringMaker<has_maker>" +== +"StringMaker<has_maker>" + + + + + + + + Catch::toString( item ) == "toString( has_maker_and_toString )" + + + "toString( has_maker_and_toString )" +== +"toString( has_maker_and_toString )" + + + + + + + + Catch::toString( v ) == "{ {?} }" + + + "{ {?} }" == "{ {?} }" + + + + + + + + Catch::toString( v ) == "{ StringMaker<has_maker> }" + + + "{ StringMaker<has_maker> }" +== +"{ StringMaker<has_maker> }" + + + + + + + + Catch::toString( v ) == "{ StringMaker<has_maker_and_toString> }" + + + "{ StringMaker<has_maker_and_toString> }" +== +"{ StringMaker<has_maker_and_toString> }" + + + + + + + + Catch::toString( value ) == "{ 34, \"xyzzy\" }" + + + "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" + + + + + + + + Catch::toString(value) == "{ 34, \"xyzzy\" }" + + + "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" + + + + + + + + Catch::toString( pr ) == "{ { \"green\", 55 } }" + + + "{ { "green", 55 } }" +== +"{ { "green", 55 } }" + + + + + + + + Catch::toString( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" + + + "{ { 42, "Arthur" }, { "Ford", 24 } }" +== +"{ { 42, "Arthur" }, { "Ford", 24 } }" + + + + + + + + Catch::toString(vv) == "{ }" + + + "{ }" == "{ }" + + + + + Catch::toString(vv) == "{ 42 }" + + + "{ 42 }" == "{ 42 }" + + + + + Catch::toString(vv) == "{ 42, 512 }" + + + "{ 42, 512 }" == "{ 42, 512 }" + + + + + + + + Catch::toString(vv) == "{ }" + + + "{ }" == "{ }" + + + + + Catch::toString(vv) == "{ \"hello\" }" + + + "{ "hello" }" == "{ "hello" }" + + + + + Catch::toString(vv) == "{ \"hello\", \"world\" }" + + + "{ "hello", "world" }" +== +"{ "hello", "world" }" + + + + + + + + Catch::toString(vv) == "{ }" + + + "{ }" == "{ }" + + + + + Catch::toString(vv) == "{ 42 }" + + + "{ 42 }" == "{ 42 }" + + + + + Catch::toString(vv) == "{ 42, 512 }" + + + "{ 42, 512 }" == "{ 42, 512 }" + + + + + + + + Catch::toString(v) == "{ }" + + + "{ }" == "{ }" + + + + + Catch::toString(v) == "{ { \"hello\" }, { \"world\" } }" + + + "{ { "hello" }, { "world" } }" +== +"{ { "hello" }, { "world" } }" + + + +
@@ -7636,7 +7940,7 @@ there"
- +
- +
From 4caabfa45ebe21cf9c0c07e04af3cd43614a984c Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 3 Sep 2014 19:23:22 +0100 Subject: [PATCH 014/102] build 3 --- README.md | 2 +- include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 54 ++++++++++++++++++++++++------ 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 38f6884f..f7bc851c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![catch logo](catch-logo-small.png) -*v1.1 build 2 (develop branch)* +*v1.1 build 3 (develop branch)* Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index ac17c619..07d9c8e7 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -13,7 +13,7 @@ namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 2, "develop" ); + Version libraryVersion( 1, 1, 3, "develop" ); } #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 39644f21..df8594bd 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * CATCH v1.1 build 2 (develop branch) - * Generated: 2014-08-22 19:34:41.932570 + * CATCH v1.1 build 3 (develop branch) + * Generated: 2014-09-03 19:22:56.858064 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -139,6 +139,10 @@ //#define CATCH_CONFIG_SFINAE // Not confirmed #endif +#if (_MSC_VER >= 1400) +#define CATCH_CONFIG_CPP11_NULLPTR +#endif + #endif // _MSC_VER // Use variadic macros if the compiler supports them @@ -1037,6 +1041,11 @@ inline id performOptionalSelector( id obj, SEL sel ) { #endif namespace Catch { + +// Why we're here. +template +std::string toString( T const& value ); + namespace Detail { // SFINAE is currently disabled by default for all compilers. @@ -1079,10 +1088,38 @@ namespace Detail { #endif +#if defined(CATCH_CPP11_OR_GREATER) + template::value + > + struct EnumStringMaker + { + static std::string convert( T const& ) { return "{?}"; } + }; + + template + struct EnumStringMaker + { + static std::string convert( T const& v ) + { + return ::Catch::toString( + static_cast::type>(v) + ); + } + }; +#endif template struct StringMakerBase { +#if defined(CATCH_CPP11_OR_GREATER) + template + static std::string convert( T const& v ) + { + return EnumStringMaker::convert( v ); + } +#else template static std::string convert( T const& ) { return "{?}"; } +#endif }; template<> @@ -1104,9 +1141,6 @@ namespace Detail { } // end namespace Detail -template -std::string toString( T const& value ); - template struct StringMaker : Detail::StringMakerBase::value> {}; @@ -1692,7 +1726,7 @@ namespace Catch { public: Timer() : m_ticks( 0 ) {} void start(); - unsigned int getElapsedNanoseconds() const; + unsigned int getElapsedMicroseconds() const; unsigned int getElapsedMilliseconds() const; double getElapsedSeconds() const; @@ -6530,7 +6564,7 @@ namespace Catch { namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 2, "develop" ); + Version libraryVersion( 1, 1, 3, "develop" ); } // #included from: catch_message.hpp @@ -6728,14 +6762,14 @@ namespace Catch { void Timer::start() { m_ticks = getCurrentTicks(); } - unsigned int Timer::getElapsedNanoseconds() const { + unsigned int Timer::getElapsedMicroseconds() const { return static_cast(getCurrentTicks() - m_ticks); } unsigned int Timer::getElapsedMilliseconds() const { - return static_cast((getCurrentTicks() - m_ticks)/1000); + return static_cast(getElapsedMicroseconds()/1000); } double Timer::getElapsedSeconds() const { - return (getCurrentTicks() - m_ticks)/1000000.0; + return getElapsedMicroseconds()/1000000.0; } } // namespace Catch From 95956444b75c5a806dfbf1caaf5664a697ba31e3 Mon Sep 17 00:00:00 2001 From: Andy Sawyer Date: Thu, 4 Sep 2014 00:12:25 +0100 Subject: [PATCH 015/102] catch_tostring: Move toString overload declarations - Put all the declarations of the overloads early in the file, so they get seen by the templates later on --- include/internal/catch_tostring.h | 56 ++++++++++++++++--------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/include/internal/catch_tostring.h b/include/internal/catch_tostring.h index dbb31423..62d33cfe 100644 --- a/include/internal/catch_tostring.h +++ b/include/internal/catch_tostring.h @@ -27,6 +27,35 @@ namespace Catch { template std::string toString( T const& value ); +// Built in overloads + +std::string toString( std::string const& value ); +std::string toString( std::wstring const& value ); +std::string toString( const char* const value ); +std::string toString( char* const value ); +std::string toString( const wchar_t* const value ); +std::string toString( wchar_t* const value ); +std::string toString( int value ); +std::string toString( unsigned long value ); +std::string toString( unsigned int value ); +std::string toString( const double value ); +std::string toString( const float value ); +std::string toString( bool value ); +std::string toString( char value ); +std::string toString( signed char value ); +std::string toString( unsigned char value ); + +#ifdef CATCH_CONFIG_CPP11_NULLPTR +std::string toString( std::nullptr_t ); +#endif + +#ifdef __OBJC__ + std::string toString( NSString const * const& nsstring ); + std::string toString( NSString * CATCH_ARC_STRONG const& nsstring ); + std::string toString( NSObject* const& nsObject ); +#endif + + namespace Detail { // SFINAE is currently disabled by default for all compilers. @@ -178,33 +207,6 @@ std::string toString( T const& value ) { return StringMaker::convert( value ); } -// Built in overloads - -std::string toString( std::string const& value ); -std::string toString( std::wstring const& value ); -std::string toString( const char* const value ); -std::string toString( char* const value ); -std::string toString( const wchar_t* const value ); -std::string toString( wchar_t* const value ); -std::string toString( int value ); -std::string toString( unsigned long value ); -std::string toString( unsigned int value ); -std::string toString( const double value ); -std::string toString( const float value ); -std::string toString( bool value ); -std::string toString( char value ); -std::string toString( signed char value ); -std::string toString( unsigned char value ); - -#ifdef CATCH_CONFIG_CPP11_NULLPTR -std::string toString( std::nullptr_t ); -#endif - -#ifdef __OBJC__ - std::string toString( NSString const * const& nsstring ); - std::string toString( NSString * CATCH_ARC_STRONG const& nsstring ); - std::string toString( NSObject* const& nsObject ); -#endif namespace Detail { template From 31969373437700ad989875be2dd63d5408663b56 Mon Sep 17 00:00:00 2001 From: Andy Sawyer Date: Thu, 4 Sep 2014 00:17:36 +0100 Subject: [PATCH 016/102] catch_tostring: Add includes for tuple, type_traits --- include/internal/catch_tostring.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/internal/catch_tostring.h b/include/internal/catch_tostring.h index 62d33cfe..097219bb 100644 --- a/include/internal/catch_tostring.h +++ b/include/internal/catch_tostring.h @@ -21,6 +21,11 @@ #include "catch_objc_arc.hpp" #endif +#ifdef CATCH_CPP11_OR_GREATER +#include +#include +#endif + namespace Catch { // Why we're here. From 022a0b4fcb742afa3eeaea96ef01bedd22ea6e74 Mon Sep 17 00:00:00 2001 From: Andy Sawyer Date: Thu, 4 Sep 2014 00:31:11 +0100 Subject: [PATCH 017/102] catch_tostring: toString for std::tuple --- include/internal/catch_tostring.h | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/include/internal/catch_tostring.h b/include/internal/catch_tostring.h index 097219bb..cf60547f 100644 --- a/include/internal/catch_tostring.h +++ b/include/internal/catch_tostring.h @@ -193,6 +193,50 @@ struct StringMaker > { } }; + +#ifdef CATCH_CPP11_OR_GREATER + /* + toString for tuples + */ +namespace TupleDetail { + template< + typename Tuple, + std::size_t N = 0, + bool = (N < std::tuple_size::value) + > + struct ElementPrinter { + static void print( const Tuple& tuple, std::ostream& os ) + { + os << ( N ? ", " : " " ) + << Catch::toString(std::get(tuple)); + ElementPrinter::print(tuple,os); + } + }; + + template< + typename Tuple, + std::size_t N + > + struct ElementPrinter { + static void print( const Tuple&, std::ostream& ) {} + }; + +} + +template +struct StringMaker> { + + static std::string convert( const std::tuple& tuple ) + { + std::ostringstream os; + os << '{'; + TupleDetail::ElementPrinter>::print( tuple, os ); + os << " }"; + return os.str(); + } +}; +#endif + namespace Detail { template std::string makeString( T const& value ) { From 13cbdf7e7d84e281820500661fdf516a4f663025 Mon Sep 17 00:00:00 2001 From: Andy Sawyer Date: Thu, 4 Sep 2014 00:32:05 +0100 Subject: [PATCH 018/102] Add tests for toString(std::tuple<...>) --- projects/CMake/CMakeLists.txt | 6 ++++ projects/SelfTest/ToStringTuple.cpp | 48 +++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 projects/SelfTest/ToStringTuple.cpp diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 952ba43e..240e1ebe 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -6,6 +6,11 @@ project(Catch) get_filename_component(CATCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) get_filename_component(CATCH_DIR "${CATCH_DIR}" PATH) set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest) +if(USE_CPP11) + ## We can't turn this on by default, since it breaks on travis + message(STATUS "Enabling C++11") + set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") +endif() # define the sources of the self test set(SOURCES @@ -25,6 +30,7 @@ set(SOURCES ${SELF_TEST_DIR}/ToStringPair.cpp ${SELF_TEST_DIR}/ToStringVector.cpp ${SELF_TEST_DIR}/ToStringWhich.cpp + ${SELF_TEST_DIR}/ToStringTuple.cpp ) # configure the executable diff --git a/projects/SelfTest/ToStringTuple.cpp b/projects/SelfTest/ToStringTuple.cpp new file mode 100644 index 00000000..46aa314b --- /dev/null +++ b/projects/SelfTest/ToStringTuple.cpp @@ -0,0 +1,48 @@ +#include "catch.hpp" + +#ifdef CATCH_CPP11_OR_GREATER + +TEST_CASE( "tuple<>", "[toString][tuple]" ) +{ + typedef std::tuple<> type; + CHECK( "{ }" == Catch::toString(type{}) ); + type value {}; + CHECK( "{ }" == Catch::toString(value) ); +} + +TEST_CASE( "tuple", "[toString][tuple]" ) +{ + typedef std::tuple type; + CHECK( "{ 0 }" == Catch::toString(type{0}) ); +} + + +TEST_CASE( "tuple", "[toString][tuple]" ) +{ + typedef std::tuple type; + CHECK( "1.2f" == Catch::toString(float(1.2)) ); + CHECK( "{ 1.2f, 0 }" == Catch::toString(type{1.2,0}) ); +} + +TEST_CASE( "tuple", "[toString][tuple]" ) +{ + typedef std::tuple type; + CHECK( "{ \"hello\", \"world\" }" == Catch::toString(type{"hello","world"}) ); +} + +TEST_CASE( "tuple,tuple<>,float>", "[toString][tuple]" ) +{ + typedef std::tuple,std::tuple<>,float> type; + type value { {42}, {}, 1.2f }; + CHECK( "{ { 42 }, { }, 1.2f }" == Catch::toString(value) ); +} + +TEST_CASE( "tuple", "[toString][tuple]" ) +{ + typedef std::tuple type; + type value { nullptr, 42, "Catch me" }; + CHECK( "{ nullptr, 42, \"Catch me\" }" == Catch::toString(value) ); +} + +#endif /* #ifdef CATCH_CPP11_OR_GREATER */ + From f559a51926c6590db94029fd116e5cec6088d41f Mon Sep 17 00:00:00 2001 From: Andy Sawyer Date: Thu, 4 Sep 2014 01:05:51 +0100 Subject: [PATCH 019/102] ToStringTuple - gcc doesn't like tuple init_list ctor --- projects/SelfTest/ToStringTuple.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/SelfTest/ToStringTuple.cpp b/projects/SelfTest/ToStringTuple.cpp index 46aa314b..012ee665 100644 --- a/projects/SelfTest/ToStringTuple.cpp +++ b/projects/SelfTest/ToStringTuple.cpp @@ -33,7 +33,7 @@ TEST_CASE( "tuple", "[toString][tuple]" ) TEST_CASE( "tuple,tuple<>,float>", "[toString][tuple]" ) { typedef std::tuple,std::tuple<>,float> type; - type value { {42}, {}, 1.2f }; + type value { std::tuple{42}, {}, 1.2f }; CHECK( "{ { 42 }, { }, 1.2f }" == Catch::toString(value) ); } From 886ef1620a224b1fd3d15001dcae4fc9a5e71c83 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 4 Sep 2014 07:27:09 +0100 Subject: [PATCH 020/102] Some minor tidy-up/ style alignment of recent toString merges --- .../Baselines/console.std.approved.txt | 2 +- .../Baselines/console.sw.approved.txt | 10 ++++- .../Baselines/console.swa4.approved.txt | 10 ++++- .../SelfTest/Baselines/junit.sw.approved.txt | 2 +- .../SelfTest/Baselines/xml.sw.approved.txt | 14 +++++- projects/SelfTest/EnumToString.cpp | 43 +++++++++++-------- projects/SelfTest/ToStringPair.cpp | 12 ++---- projects/SelfTest/ToStringVector.cpp | 21 +++++---- projects/SelfTest/ToStringWhich.cpp | 18 +++----- 9 files changed, 79 insertions(+), 53 deletions(-) diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index d2e42b43..a97b7a3a 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -787,5 +787,5 @@ with expansion: =============================================================================== test cases: 148 | 109 passed | 38 failed | 1 failed as expected -assertions: 738 | 646 passed | 79 failed | 13 failed as expected +assertions: 739 | 647 passed | 79 failed | 13 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 169f2633..54b7c915 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -75,6 +75,14 @@ PASSED: with expansion: "E2/V1" == "E2/V1" +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e3) == "Unknown enum value 10" ) +with expansion: + "Unknown enum value 10" + == + "Unknown enum value 10" + ------------------------------------------------------------------------------- Some simple comparisons between doubles ------------------------------------------------------------------------------- @@ -7676,5 +7684,5 @@ with expansion: =============================================================================== test cases: 148 | 93 passed | 54 failed | 1 failed as expected -assertions: 758 | 646 passed | 99 failed | 13 failed as expected +assertions: 759 | 647 passed | 99 failed | 13 failed as expected diff --git a/projects/SelfTest/Baselines/console.swa4.approved.txt b/projects/SelfTest/Baselines/console.swa4.approved.txt index 276c93ec..c8993019 100644 --- a/projects/SelfTest/Baselines/console.swa4.approved.txt +++ b/projects/SelfTest/Baselines/console.swa4.approved.txt @@ -75,6 +75,14 @@ PASSED: with expansion: "E2/V1" == "E2/V1" +EnumToString.cpp:: +PASSED: + CHECK( Catch::toString(e3) == "Unknown enum value 10" ) +with expansion: + "Unknown enum value 10" + == + "Unknown enum value 10" + ------------------------------------------------------------------------------- Some simple comparisons between doubles ------------------------------------------------------------------------------- @@ -479,5 +487,5 @@ with expansion: =============================================================================== test cases: 19 | 15 passed | 3 failed | 1 failed as expected -assertions: 61 | 55 passed | 4 failed | 2 failed as expected +assertions: 62 | 56 passed | 4 failed | 2 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 7ce10d72..07984f57 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,5 +1,5 @@ - + diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 5c06f6e0..146a9eb3 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -74,6 +74,16 @@ "E2/V1" == "E2/V1"
+ + + Catch::toString(e3) == "Unknown enum value 10" + + + "Unknown enum value 10" +== +"Unknown enum value 10" + + @@ -7940,7 +7950,7 @@ there"
- + - + diff --git a/projects/SelfTest/EnumToString.cpp b/projects/SelfTest/EnumToString.cpp index 40c11ca9..b35721dc 100644 --- a/projects/SelfTest/EnumToString.cpp +++ b/projects/SelfTest/EnumToString.cpp @@ -8,8 +8,7 @@ // Enum without user-provided stream operator enum Enum1 { Enum1Value0, Enum1Value1 }; -TEST_CASE( "toString(enum)", "[toString][enum]" ) -{ +TEST_CASE( "toString(enum)", "[toString][enum]" ) { Enum1 e0 = Enum1Value0; CHECK( Catch::toString(e0) == "0" ); Enum1 e1 = Enum1Value1; @@ -19,13 +18,11 @@ TEST_CASE( "toString(enum)", "[toString][enum]" ) // Enum with user-provided stream operator enum Enum2 { Enum2Value0, Enum2Value1 }; -inline std::ostream& operator<<( std::ostream& os, Enum2 v ) -{ +inline std::ostream& operator<<( std::ostream& os, Enum2 v ) { return os << "E2{" << static_cast(v) << "}"; } -TEST_CASE( "toString(enum w/operator<<)", "[toString][enum]" ) -{ +TEST_CASE( "toString(enum w/operator<<)", "[toString][enum]" ) { Enum2 e0 = Enum2Value0; CHECK( Catch::toString(e0) == "E2{0}" ); Enum2 e1 = Enum2Value1; @@ -33,11 +30,15 @@ TEST_CASE( "toString(enum w/operator<<)", "[toString][enum]" ) } #if defined(CATCH_CPP11_OR_GREATER) +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wc++98-compat" +#endif + // Enum class without user-provided stream operator enum class EnumClass1 { EnumClass1Value0, EnumClass1Value1 }; -TEST_CASE( "toString(enum class)", "[toString][enum][enumClass]" ) -{ +TEST_CASE( "toString(enum class)", "[toString][enum][enumClass]" ) { EnumClass1 e0 = EnumClass1::EnumClass1Value0; CHECK( Catch::toString(e0) == "0" ); EnumClass1 e1 = EnumClass1::EnumClass1Value1; @@ -47,25 +48,29 @@ TEST_CASE( "toString(enum class)", "[toString][enum][enumClass]" ) // Enum class with user-provided stream operator enum class EnumClass2 : short { EnumClass2Value0, EnumClass2Value1 }; -inline std::ostream& operator<<( std::ostream& os, EnumClass2 e2 ) -{ - switch( e2 ) - { - case EnumClass2::EnumClass2Value0: - return os << "E2/V0"; - case EnumClass2::EnumClass2Value1: - return os << "E2/V1"; +inline std::ostream& operator<<( std::ostream& os, EnumClass2 e2 ) { + switch( (int)e2 ) { + case (int)EnumClass2::EnumClass2Value0: + return os << "E2/V0"; + case (int)EnumClass2::EnumClass2Value1: + return os << "E2/V1"; + default: + return os << "Unknown enum value " << (int)e2; } - return os << "unexpected..."; } -TEST_CASE( "toString(enum class w/operator<<)", "[toString][enum][enumClass]" ) -{ +TEST_CASE( "toString(enum class w/operator<<)", "[toString][enum][enumClass]" ) { EnumClass2 e0 = EnumClass2::EnumClass2Value0; CHECK( Catch::toString(e0) == "E2/V0" ); EnumClass2 e1 = EnumClass2::EnumClass2Value1; CHECK( Catch::toString(e1) == "E2/V1" ); + + EnumClass2 e3 = static_cast(10); + CHECK( Catch::toString(e3) == "Unknown enum value 10" ); } +#ifdef __clang__ +#pragma clang diagnostic pop #endif +#endif // CATCH_CPP11_OR_GREATER diff --git a/projects/SelfTest/ToStringPair.cpp b/projects/SelfTest/ToStringPair.cpp index 2de4a55a..8f510700 100644 --- a/projects/SelfTest/ToStringPair.cpp +++ b/projects/SelfTest/ToStringPair.cpp @@ -18,28 +18,24 @@ namespace Catch { }; } -TEST_CASE( "std::pair -> toString", "[toString][pair]" ) -{ +TEST_CASE( "std::pair -> toString", "[toString][pair]" ) { std::pair value( 34, "xyzzy" ); REQUIRE( Catch::toString( value ) == "{ 34, \"xyzzy\" }" ); } -TEST_CASE( "std::pair -> toString", "[toString][pair]" ) -{ +TEST_CASE( "std::pair -> toString", "[toString][pair]" ) { std::pair value( 34, "xyzzy" ); REQUIRE( Catch::toString(value) == "{ 34, \"xyzzy\" }" ); } -TEST_CASE( "std::vector > -> toString", "[toString][pair]" ) -{ +TEST_CASE( "std::vector > -> toString", "[toString][pair]" ) { std::vector > pr; pr.push_back( std::make_pair("green", 55 ) ); REQUIRE( Catch::toString( pr ) == "{ { \"green\", 55 } }" ); } // This is pretty contrived - I figure if this works, anything will... -TEST_CASE( "pair > -> toString", "[toString][pair]" ) -{ +TEST_CASE( "pair > -> toString", "[toString][pair]" ) { typedef std::pair left_t; typedef std::pair right_t; diff --git a/projects/SelfTest/ToStringVector.cpp b/projects/SelfTest/ToStringVector.cpp index f3b036e5..44790605 100644 --- a/projects/SelfTest/ToStringVector.cpp +++ b/projects/SelfTest/ToStringVector.cpp @@ -24,6 +24,11 @@ TEST_CASE( "vector -> toString", "[toString][vector]" ) } #if defined(CATCH_CPP11_OR_GREATER) +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wc++98-compat" +#endif + /* Note: These tests *can* be made to work with C++ < 11, but the allocator is a lot more work... @@ -34,12 +39,10 @@ namespace { struct minimal_allocator { typedef T value_type; typedef std::size_t size_type; - T *allocate( size_type n ) - { + T *allocate( size_type n ) { return static_cast( ::operator new( n * sizeof(T) ) ); } - void deallocate( T *p, size_type /*n*/ ) - { + void deallocate( T *p, size_type /*n*/ ) { ::operator delete( static_cast(p) ); } template @@ -49,8 +52,7 @@ namespace { }; } -TEST_CASE( "vector -> toString", "[toString][vector,allocator]" ) -{ +TEST_CASE( "vector -> toString", "[toString][vector,allocator]" ) { std::vector > vv; REQUIRE( Catch::toString(vv) == "{ }" ); vv.push_back( 42 ); @@ -59,8 +61,7 @@ TEST_CASE( "vector -> toString", "[toString][vector,allocator]" ) REQUIRE( Catch::toString(vv) == "{ 42, 512 }" ); } -TEST_CASE( "vec> -> toString", "[toString][vector,allocator]" ) -{ +TEST_CASE( "vec> -> toString", "[toString][vector,allocator]" ) { typedef std::vector > inner; typedef std::vector vector; vector v; @@ -69,4 +70,8 @@ TEST_CASE( "vec> -> toString", "[toString][vector,allocator]" v.push_back( inner { "world" } ); REQUIRE( Catch::toString(v) == "{ { \"hello\" }, { \"world\" } }" ); } + +#ifdef __clang__ +#pragma clang diagnostic pop #endif +#endif // CATCH_CPP11_OR_GREATER diff --git a/projects/SelfTest/ToStringWhich.cpp b/projects/SelfTest/ToStringWhich.cpp index 785c65b7..1d4aa892 100644 --- a/projects/SelfTest/ToStringWhich.cpp +++ b/projects/SelfTest/ToStringWhich.cpp @@ -31,43 +31,37 @@ namespace Catch { } // Call the overload -TEST_CASE( "toString( has_toString )", "[toString]" ) -{ +TEST_CASE( "toString( has_toString )", "[toString]" ) { has_toString item; REQUIRE( Catch::toString( item ) == "toString( has_toString )" ); } // Call the overload -TEST_CASE( "toString( has_maker )", "[toString]" ) -{ +TEST_CASE( "toString( has_maker )", "[toString]" ) { has_maker item; REQUIRE( Catch::toString( item ) == "StringMaker" ); } // Call the overload -TEST_CASE( "toString( has_maker_and_toString )", "[toString]" ) -{ +TEST_CASE( "toString( has_maker_and_toString )", "[toString]" ) { has_maker_and_toString item; REQUIRE( Catch::toString( item ) == "toString( has_maker_and_toString )" ); } // Vectors... -TEST_CASE( "toString( vectors v(1); // This invokes template toString which actually gives us '{ ? }' REQUIRE( Catch::toString( v ) == "{ {?} }" ); } -TEST_CASE( "toString( vectors v(1); REQUIRE( Catch::toString( v ) == "{ StringMaker }" ); } -TEST_CASE( "toString( vectors v(1); // Note: This invokes the template toString -> StringMaker REQUIRE( Catch::toString( v ) == "{ StringMaker }" ); From 3e1d3c72712db3fe4ec7ed288ca9ae011660d1a7 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 8 Sep 2014 08:14:22 +0100 Subject: [PATCH 021/102] Give (currently not used, so global only) group a name --- include/catch_runner.hpp | 4 ++-- projects/SelfTest/Baselines/junit.sw.approved.txt | 2 +- projects/SelfTest/Baselines/xml.sw.approved.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/catch_runner.hpp b/include/catch_runner.hpp index 42069b9f..e6303d88 100644 --- a/include/catch_runner.hpp +++ b/include/catch_runner.hpp @@ -37,7 +37,7 @@ namespace Catch { Totals totals; - context.testGroupStarting( "", 1, 1 ); // deprecated? + context.testGroupStarting( "all tests", 1, 1 ); // deprecated? TestSpec testSpec = m_config->testSpec(); if( !testSpec.hasFilters() ) @@ -60,7 +60,7 @@ namespace Catch { m_testsAlreadyRun.insert( *it ); } } - context.testGroupEnded( "", totals, 1, 1 ); + context.testGroupEnded( "all tests", totals, 1, 1 ); return totals; } diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 07984f57..7529791d 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,5 +1,5 @@ - + diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 146a9eb3..200c28f7 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -1,5 +1,5 @@ - + From ea33961b4362ba9cee6e060e4ec9b94da366e960 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 8 Sep 2014 08:14:59 +0100 Subject: [PATCH 022/102] Factored out mention of "unprintable string" ("{?}") --- include/internal/catch_capture.hpp | 2 +- include/internal/catch_tostring.h | 23 +++++++++++++++-------- include/internal/catch_tostring.hpp | 2 ++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 1285b31f..39e5fc87 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -134,7 +134,7 @@ std::string matcherAsString = ::Catch::Matchers::matcher.toString(); \ __catchResult \ .setLhs( Catch::toString( arg ) ) \ - .setRhs( matcherAsString == "{?}" ? #matcher : matcherAsString ) \ + .setRhs( matcherAsString == Catch::Detail::unprintableString ? #matcher : matcherAsString ) \ .setOp( "matches" ) \ .setResultType( ::Catch::Matchers::matcher.match( arg ) ); \ __catchResult.captureExpression(); \ diff --git a/include/internal/catch_tostring.h b/include/internal/catch_tostring.h index dbb31423..674533ff 100644 --- a/include/internal/catch_tostring.h +++ b/include/internal/catch_tostring.h @@ -29,6 +29,8 @@ std::string toString( T const& value ); namespace Detail { + extern std::string unprintableString; + // SFINAE is currently disabled by default for all compilers. // If the non SFINAE version of IsStreamInsertable is ambiguous for you // and your compiler supports SFINAE, try #defining CATCH_CONFIG_SFINAE @@ -71,11 +73,11 @@ namespace Detail { #if defined(CATCH_CPP11_OR_GREATER) template::value + bool IsEnum = std::is_enum::value > struct EnumStringMaker { - static std::string convert( T const& ) { return "{?}"; } + static std::string convert( T const& ) { return unprintableString; } }; template @@ -99,7 +101,7 @@ namespace Detail { } #else template - static std::string convert( T const& ) { return "{?}"; } + static std::string convert( T const& ) { return unprintableString; } #endif }; @@ -152,12 +154,17 @@ namespace Detail { std::string rangeToString( InputIterator first, InputIterator last ); } +//template +//struct StringMaker > { +// static std::string convert( std::vector const& v ) { +// return Detail::rangeToString( v.begin(), v.end() ); +// } +//}; + template -struct StringMaker > { - static std::string convert( std::vector const& v ) { - return Detail::rangeToString( v.begin(), v.end() ); - } -}; +std::string toString( std::vector const& v ) { + return Detail::rangeToString( v.begin(), v.end() ); +} namespace Detail { template diff --git a/include/internal/catch_tostring.hpp b/include/internal/catch_tostring.hpp index f9369f1e..9b234b18 100644 --- a/include/internal/catch_tostring.hpp +++ b/include/internal/catch_tostring.hpp @@ -15,6 +15,8 @@ namespace Catch { namespace Detail { + std::string unprintableString = "{?}"; + namespace { struct Endianness { enum Arch { Big, Little }; From fa0122bf54062dc29d5d8b34743c2bce6c2c4482 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 15 Sep 2014 18:39:31 +0100 Subject: [PATCH 023/102] Allow testing ordering to be specified as declaration, lexicographical, or random. Allow random seed to be specified --- include/catch_runner.hpp | 3 ++ include/external/clara.h | 2 +- include/internal/catch_commandline.hpp | 33 +++++++++++++++++-- include/internal/catch_config.hpp | 10 ++++-- include/internal/catch_interfaces_config.h | 7 ++++ .../catch_test_case_registry_impl.hpp | 19 +++++++++++ include/reporters/catch_reporter_console.hpp | 3 ++ 7 files changed, 72 insertions(+), 5 deletions(-) diff --git a/include/catch_runner.hpp b/include/catch_runner.hpp index e6303d88..c9f43ed2 100644 --- a/include/catch_runner.hpp +++ b/include/catch_runner.hpp @@ -170,6 +170,9 @@ namespace Catch { try { config(); // Force config to be constructed + + std::srand( m_configData.rngSeed ); + Runner runner( m_config ); // Handle list request diff --git a/include/external/clara.h b/include/external/clara.h index d8e83ac5..dba26a95 100644 --- a/include/external/clara.h +++ b/include/external/clara.h @@ -791,7 +791,7 @@ namespace Clara { if( it == itEnd ) { if( token.type == Parser::Token::Positional || !m_throwOnUnrecognisedTokens ) unusedTokens.push_back( token ); - else if( m_throwOnUnrecognisedTokens ) + else if( errors.empty() && m_throwOnUnrecognisedTokens ) errors.push_back( "unrecognised option: " + token.data ); } } diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp index c7c33845..a17059f4 100644 --- a/include/internal/catch_commandline.hpp +++ b/include/internal/catch_commandline.hpp @@ -29,7 +29,28 @@ namespace Catch { config.warnings = static_cast( config.warnings | WarnAbout::NoAssertions ); else throw std::runtime_error( "Unrecognised warning: '" + _warning + "'" ); - + } + inline void setOrder( ConfigData& config, std::string const& order ) { + if( startsWith( "declared", order ) ) + config.runOrder = RunTests::InDeclarationOrder; + else if( startsWith( "lexical", order ) ) + config.runOrder = RunTests::InLexicographicalOrder; + else if( startsWith( "random", order ) ) + config.runOrder = RunTests::InRandomOrder; + else + throw std::runtime_error( "Unrecognised ordering: '" + order + "'" ); + } + inline void setRngSeed( ConfigData& config, std::string const& seed ) { + if( seed == "time" ) { + config.rngSeed = static_cast( std::time(0) ); + } + else { + std::stringstream ss; + ss << seed; + ss >> config.rngSeed; + if( ss.fail() ) + throw std::runtime_error( "Argment to --rng-seed should be the word 'time' or a number" ); + } } inline void setVerbosity( ConfigData& config, int level ) { // !TBD: accept strings? @@ -137,10 +158,18 @@ namespace Catch { .describe( "list all/matching test cases names only" ) .bind( &ConfigData::listTestNamesOnly ); - cli["--list-reporters"] + cli["--list-reporters"] .describe( "list all reporters" ) .bind( &ConfigData::listReporters ); + cli["--order"] + .describe( "test case order (defaults to decl)" ) + .bind( &setOrder, "decl|lex|rand" ); + + cli["--rng-seed"] + .describe( "set a specific seed for random numbers" ) + .bind( &setRngSeed, "'time'|number" ); + return cli; } diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp index 1217b9a9..37ca6579 100644 --- a/include/internal/catch_config.hpp +++ b/include/internal/catch_config.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #ifndef CATCH_CONFIG_CONSOLE_WIDTH #define CATCH_CONFIG_CONSOLE_WIDTH 80 @@ -37,9 +38,11 @@ namespace Catch { showHelp( false ), showInvisibles( false ), abortAfter( -1 ), + rngSeed( 0 ), verbosity( Verbosity::Normal ), warnings( WarnAbout::Nothing ), - showDurations( ShowDurations::DefaultForReporter ) + showDurations( ShowDurations::DefaultForReporter ), + runOrder( RunTests::InDeclarationOrder ) {} bool listTests; @@ -54,10 +57,12 @@ namespace Catch { bool showInvisibles; int abortAfter; + unsigned int rngSeed; Verbosity::Level verbosity; WarnAbout::What warnings; ShowDurations::OrNot showDurations; + RunTests::InWhatOrder runOrder; std::string reporterName; std::string outputFilename; @@ -141,7 +146,8 @@ namespace Catch { virtual bool includeSuccessfulResults() const { return m_data.showSuccessfulTests; } virtual bool warnAboutMissingAssertions() const { return m_data.warnings & WarnAbout::NoAssertions; } virtual ShowDurations::OrNot showDurations() const { return m_data.showDurations; } - + virtual RunTests::InWhatOrder runOrder() const { return m_data.runOrder; } + virtual unsigned int rngSeed() const { return m_data.rngSeed; } private: ConfigData m_data; diff --git a/include/internal/catch_interfaces_config.h b/include/internal/catch_interfaces_config.h index c7610d99..5f30ac1d 100644 --- a/include/internal/catch_interfaces_config.h +++ b/include/internal/catch_interfaces_config.h @@ -32,6 +32,11 @@ namespace Catch { Always, Never }; }; + struct RunTests { enum InWhatOrder { + InDeclarationOrder, + InLexicographicalOrder, + InRandomOrder + }; }; class TestSpec; @@ -49,6 +54,8 @@ namespace Catch { virtual bool showInvisibles() const = 0; virtual ShowDurations::OrNot showDurations() const = 0; virtual TestSpec const& testSpec() const = 0; + virtual RunTests::InWhatOrder runOrder() const = 0; + virtual unsigned int rngSeed() const = 0; }; } diff --git a/include/internal/catch_test_case_registry_impl.hpp b/include/internal/catch_test_case_registry_impl.hpp index ecffa2e5..ad733dbc 100644 --- a/include/internal/catch_test_case_registry_impl.hpp +++ b/include/internal/catch_test_case_registry_impl.hpp @@ -59,7 +59,15 @@ namespace Catch { return m_nonHiddenFunctions; } + struct LexSort { + bool operator() (TestCase i,TestCase j) { return (i& matchingTestCases ) const { + struct RandomNumberGenerator { + int operator()( int n ) { return std::rand() % n; } + }; + for( std::vector::const_iterator it = m_functionsInOrder.begin(), itEnd = m_functionsInOrder.end(); it != itEnd; @@ -67,6 +75,17 @@ namespace Catch { if( testSpec.matches( *it ) && ( config.allowThrows() || !it->throws() ) ) matchingTestCases.push_back( *it ); } + switch( config.runOrder() ) { + case RunTests::InLexicographicalOrder: + std::sort( matchingTestCases.begin(), matchingTestCases.end(), LexSort() ); + break; + case RunTests::InRandomOrder: + std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), RandomNumberGenerator() ); + break; + case RunTests::InDeclarationOrder: + // already in declaration order + break; + } } private: diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp index 83498327..7c0a23bf 100644 --- a/include/reporters/catch_reporter_console.hpp +++ b/include/reporters/catch_reporter_console.hpp @@ -271,6 +271,9 @@ namespace Catch { stream << " host application.\n" << "Run with -? for options\n\n"; + if( m_config->rngSeed() != 0 ) + stream << "Randomness seeded to: " << m_config->rngSeed() << "\n\n"; + currentTestRunInfo.used = true; } void lazyPrintGroupInfo() { From 6a8e8ada0d8e26d7fc573cf7552ed42291fa3cc5 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 15 Sep 2014 18:40:24 +0100 Subject: [PATCH 024/102] build 4 --- README.md | 2 +- include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 111 ++++++++++++++++++++++++----- 3 files changed, 96 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index f7bc851c..8f922cd8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![catch logo](catch-logo-small.png) -*v1.1 build 3 (develop branch)* +*v1.1 build 4 (develop branch)* Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index 07d9c8e7..481ca4db 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -13,7 +13,7 @@ namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 3, "develop" ); + Version libraryVersion( 1, 1, 4, "develop" ); } #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED diff --git a/single_include/catch.hpp b/single_include/catch.hpp index df8594bd..e25907f9 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * CATCH v1.1 build 3 (develop branch) - * Generated: 2014-09-03 19:22:56.858064 + * CATCH v1.1 build 4 (develop branch) + * Generated: 2014-09-15 18:39:57.728720 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -1048,6 +1048,8 @@ std::string toString( T const& value ); namespace Detail { + extern std::string unprintableString; + // SFINAE is currently disabled by default for all compilers. // If the non SFINAE version of IsStreamInsertable is ambiguous for you // and your compiler supports SFINAE, try #defining CATCH_CONFIG_SFINAE @@ -1090,11 +1092,11 @@ namespace Detail { #if defined(CATCH_CPP11_OR_GREATER) template::value + bool IsEnum = std::is_enum::value > struct EnumStringMaker { - static std::string convert( T const& ) { return "{?}"; } + static std::string convert( T const& ) { return unprintableString; } }; template @@ -1118,7 +1120,7 @@ namespace Detail { } #else template - static std::string convert( T const& ) { return "{?}"; } + static std::string convert( T const& ) { return unprintableString; } #endif }; @@ -1171,12 +1173,17 @@ namespace Detail { std::string rangeToString( InputIterator first, InputIterator last ); } +//template +//struct StringMaker > { +// static std::string convert( std::vector const& v ) { +// return Detail::rangeToString( v.begin(), v.end() ); +// } +//}; + template -struct StringMaker > { - static std::string convert( std::vector const& v ) { - return Detail::rangeToString( v.begin(), v.end() ); - } -}; +std::string toString( std::vector const& v ) { + return Detail::rangeToString( v.begin(), v.end() ); +} namespace Detail { template @@ -1613,7 +1620,7 @@ namespace Catch { std::string matcherAsString = ::Catch::Matchers::matcher.toString(); \ __catchResult \ .setLhs( Catch::toString( arg ) ) \ - .setRhs( matcherAsString == "{?}" ? #matcher : matcherAsString ) \ + .setRhs( matcherAsString == Catch::Detail::unprintableString ? #matcher : matcherAsString ) \ .setOp( "matches" ) \ .setResultType( ::Catch::Matchers::matcher.match( arg ) ); \ __catchResult.captureExpression(); \ @@ -3000,6 +3007,11 @@ namespace Catch { Always, Never }; }; + struct RunTests { enum InWhatOrder { + InDeclarationOrder, + InLexicographicalOrder, + InRandomOrder + }; }; class TestSpec; @@ -3017,6 +3029,8 @@ namespace Catch { virtual bool showInvisibles() const = 0; virtual ShowDurations::OrNot showDurations() const = 0; virtual TestSpec const& testSpec() const = 0; + virtual RunTests::InWhatOrder runOrder() const = 0; + virtual unsigned int rngSeed() const = 0; }; } @@ -3048,6 +3062,7 @@ namespace Catch { #include #include #include +#include #ifndef CATCH_CONFIG_CONSOLE_WIDTH #define CATCH_CONFIG_CONSOLE_WIDTH 80 @@ -3068,9 +3083,11 @@ namespace Catch { showHelp( false ), showInvisibles( false ), abortAfter( -1 ), + rngSeed( 0 ), verbosity( Verbosity::Normal ), warnings( WarnAbout::Nothing ), - showDurations( ShowDurations::DefaultForReporter ) + showDurations( ShowDurations::DefaultForReporter ), + runOrder( RunTests::InDeclarationOrder ) {} bool listTests; @@ -3085,10 +3102,12 @@ namespace Catch { bool showInvisibles; int abortAfter; + unsigned int rngSeed; Verbosity::Level verbosity; WarnAbout::What warnings; ShowDurations::OrNot showDurations; + RunTests::InWhatOrder runOrder; std::string reporterName; std::string outputFilename; @@ -3170,6 +3189,8 @@ namespace Catch { virtual bool includeSuccessfulResults() const { return m_data.showSuccessfulTests; } virtual bool warnAboutMissingAssertions() const { return m_data.warnings & WarnAbout::NoAssertions; } virtual ShowDurations::OrNot showDurations() const { return m_data.showDurations; } + virtual RunTests::InWhatOrder runOrder() const { return m_data.runOrder; } + virtual unsigned int rngSeed() const { return m_data.rngSeed; } private: ConfigData m_data; @@ -3968,7 +3989,7 @@ namespace Clara { if( it == itEnd ) { if( token.type == Parser::Token::Positional || !m_throwOnUnrecognisedTokens ) unusedTokens.push_back( token ); - else if( m_throwOnUnrecognisedTokens ) + else if( errors.empty() && m_throwOnUnrecognisedTokens ) errors.push_back( "unrecognised option: " + token.data ); } } @@ -4066,7 +4087,28 @@ namespace Catch { config.warnings = static_cast( config.warnings | WarnAbout::NoAssertions ); else throw std::runtime_error( "Unrecognised warning: '" + _warning + "'" ); - + } + inline void setOrder( ConfigData& config, std::string const& order ) { + if( startsWith( "declared", order ) ) + config.runOrder = RunTests::InDeclarationOrder; + else if( startsWith( "lexical", order ) ) + config.runOrder = RunTests::InLexicographicalOrder; + else if( startsWith( "random", order ) ) + config.runOrder = RunTests::InRandomOrder; + else + throw std::runtime_error( "Unrecognised ordering: '" + order + "'" ); + } + inline void setRngSeed( ConfigData& config, std::string const& seed ) { + if( seed == "time" ) { + config.rngSeed = static_cast( std::time(0) ); + } + else { + std::stringstream ss; + ss << seed; + ss >> config.rngSeed; + if( ss.fail() ) + throw std::runtime_error( "Argment to --rng-seed should be the word 'time' or a number" ); + } } inline void setVerbosity( ConfigData& config, int level ) { // !TBD: accept strings? @@ -4178,6 +4220,14 @@ namespace Catch { .describe( "list all reporters" ) .bind( &ConfigData::listReporters ); + cli["--order"] + .describe( "test case order (defaults to decl)" ) + .bind( &setOrder, "decl|lex|rand" ); + + cli["--rng-seed"] + .describe( "set a specific seed for random numbers" ) + .bind( &setRngSeed, "'time'|number" ); + return cli; } @@ -5400,7 +5450,7 @@ namespace Catch { Totals totals; - context.testGroupStarting( "", 1, 1 ); // deprecated? + context.testGroupStarting( "all tests", 1, 1 ); // deprecated? TestSpec testSpec = m_config->testSpec(); if( !testSpec.hasFilters() ) @@ -5423,7 +5473,7 @@ namespace Catch { m_testsAlreadyRun.insert( *it ); } } - context.testGroupEnded( "", totals, 1, 1 ); + context.testGroupEnded( "all tests", totals, 1, 1 ); return totals; } @@ -5533,6 +5583,9 @@ namespace Catch { try { config(); // Force config to be constructed + + std::srand( m_configData.rngSeed ); + Runner runner( m_config ); // Handle list request @@ -5625,7 +5678,15 @@ namespace Catch { return m_nonHiddenFunctions; } + struct LexSort { + bool operator() (TestCase i,TestCase j) { return (i& matchingTestCases ) const { + struct RandomNumberGenerator { + int operator()( int n ) { return std::rand() % n; } + }; + for( std::vector::const_iterator it = m_functionsInOrder.begin(), itEnd = m_functionsInOrder.end(); it != itEnd; @@ -5633,6 +5694,17 @@ namespace Catch { if( testSpec.matches( *it ) && ( config.allowThrows() || !it->throws() ) ) matchingTestCases.push_back( *it ); } + switch( config.runOrder() ) { + case RunTests::InLexicographicalOrder: + std::sort( matchingTestCases.begin(), matchingTestCases.end(), LexSort() ); + break; + case RunTests::InRandomOrder: + std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), RandomNumberGenerator() ); + break; + case RunTests::InDeclarationOrder: + // already in declaration order + break; + } } private: @@ -6564,7 +6636,7 @@ namespace Catch { namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 3, "develop" ); + Version libraryVersion( 1, 1, 4, "develop" ); } // #included from: catch_message.hpp @@ -6981,6 +7053,8 @@ namespace Catch { namespace Detail { + std::string unprintableString = "{?}"; + namespace { struct Endianness { enum Arch { Big, Little }; @@ -8441,6 +8515,9 @@ namespace Catch { stream << " host application.\n" << "Run with -? for options\n\n"; + if( m_config->rngSeed() != 0 ) + stream << "Randomness seeded to: " << m_config->rngSeed() << "\n\n"; + currentTestRunInfo.used = true; } void lazyPrintGroupInfo() { From 9630454b0f2695d69b5868745ff95c03b97a403f Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 15 Sep 2014 23:32:13 +0100 Subject: [PATCH 025/102] Added missing #include --- include/internal/catch_test_case_registry_impl.hpp | 1 + single_include/catch.hpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/internal/catch_test_case_registry_impl.hpp b/include/internal/catch_test_case_registry_impl.hpp index ad733dbc..7756b0bc 100644 --- a/include/internal/catch_test_case_registry_impl.hpp +++ b/include/internal/catch_test_case_registry_impl.hpp @@ -17,6 +17,7 @@ #include #include #include +#include namespace Catch { diff --git a/single_include/catch.hpp b/single_include/catch.hpp index e25907f9..eb102586 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* * CATCH v1.1 build 4 (develop branch) - * Generated: 2014-09-15 18:39:57.728720 + * Generated: 2014-09-15 23:31:31.318013 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -5636,6 +5636,7 @@ namespace Catch { #include #include #include +#include namespace Catch { From 6492560394131a2a77b6b1eff4a369c5268fe30b Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 15 Sep 2014 23:36:39 +0100 Subject: [PATCH 026/102] Made sorting functors const --- include/internal/catch_test_case_registry_impl.hpp | 9 +++++---- single_include/catch.hpp | 11 +++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/internal/catch_test_case_registry_impl.hpp b/include/internal/catch_test_case_registry_impl.hpp index 7756b0bc..9e3ef11b 100644 --- a/include/internal/catch_test_case_registry_impl.hpp +++ b/include/internal/catch_test_case_registry_impl.hpp @@ -60,13 +60,14 @@ namespace Catch { return m_nonHiddenFunctions; } - struct LexSort { - bool operator() (TestCase i,TestCase j) { return (i& matchingTestCases ) const { + struct LexSort { + bool operator() (TestCase i,TestCase j) const { return (i::const_iterator it = m_functionsInOrder.begin(), diff --git a/single_include/catch.hpp b/single_include/catch.hpp index eb102586..0c3c5825 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* * CATCH v1.1 build 4 (develop branch) - * Generated: 2014-09-15 23:31:31.318013 + * Generated: 2014-09-15 23:36:12.995567 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -5679,13 +5679,12 @@ namespace Catch { return m_nonHiddenFunctions; } - struct LexSort { - bool operator() (TestCase i,TestCase j) { return (i& matchingTestCases ) const { + struct LexSort { + bool operator() (TestCase i,TestCase j) const { return (i::const_iterator it = m_functionsInOrder.begin(), From 73a0744452fc94c2b5c310e4b6957f35173a7cfa Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 17 Sep 2014 18:06:47 +0100 Subject: [PATCH 027/102] Backed out PR #307 (use nullptr from VS2005) as it seems clr specific --- include/internal/catch_compiler_capabilities.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/internal/catch_compiler_capabilities.h b/include/internal/catch_compiler_capabilities.h index 89073bec..76d0ffda 100644 --- a/include/internal/catch_compiler_capabilities.h +++ b/include/internal/catch_compiler_capabilities.h @@ -84,10 +84,6 @@ //#define CATCH_CONFIG_SFINAE // Not confirmed #endif -#if (_MSC_VER >= 1400) -#define CATCH_CONFIG_CPP11_NULLPTR -#endif - #endif // _MSC_VER // Use variadic macros if the compiler supports them From 16a7db036f04559a4d369b0b8a2b839c40eafbb5 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 18 Sep 2014 18:23:47 +0100 Subject: [PATCH 028/102] enable nullptr for VS2010 --- include/internal/catch_compiler_capabilities.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/internal/catch_compiler_capabilities.h b/include/internal/catch_compiler_capabilities.h index 76d0ffda..5ed98c2f 100644 --- a/include/internal/catch_compiler_capabilities.h +++ b/include/internal/catch_compiler_capabilities.h @@ -80,6 +80,10 @@ // Visual C++ #ifdef _MSC_VER +#if (_MSC_VER >= 1600) +#define CATCH_CONFIG_CPP11_NULLPTR +#endif + #if (_MSC_VER >= 1310 ) // (VC++ 7.0+) //#define CATCH_CONFIG_SFINAE // Not confirmed #endif From b62a1b53341f0789f06d9a3c7dceb29a76cf9668 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 18 Sep 2014 18:24:41 +0100 Subject: [PATCH 029/102] Moved RandomNumberGenerator out of function and pass in a named instance instead of a temporary - both for C++03 compatibility reasons --- .../catch_test_case_registry_impl.hpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/include/internal/catch_test_case_registry_impl.hpp b/include/internal/catch_test_case_registry_impl.hpp index 9e3ef11b..5d24b15c 100644 --- a/include/internal/catch_test_case_registry_impl.hpp +++ b/include/internal/catch_test_case_registry_impl.hpp @@ -22,6 +22,13 @@ namespace Catch { class TestRegistry : public ITestCaseRegistry { + struct LexSort { + bool operator() (TestCase i,TestCase j) const { return (i& matchingTestCases ) const { - struct LexSort { - bool operator() (TestCase i,TestCase j) const { return (i::const_iterator it = m_functionsInOrder.begin(), itEnd = m_functionsInOrder.end(); @@ -82,7 +81,10 @@ namespace Catch { std::sort( matchingTestCases.begin(), matchingTestCases.end(), LexSort() ); break; case RunTests::InRandomOrder: - std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), RandomNumberGenerator() ); + { + RandomNumberGenerator rng; + std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng ); + } break; case RunTests::InDeclarationOrder: // already in declaration order From ee3b265aa19fd684d1a875c15be02080d0c35d31 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 18 Sep 2014 18:25:10 +0100 Subject: [PATCH 030/102] build 5 --- README.md | 2 +- include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 32 +++++++++++++++++------------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 8f922cd8..e675aae0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![catch logo](catch-logo-small.png) -*v1.1 build 4 (develop branch)* +*v1.1 build 5 (develop branch)* Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index 481ca4db..f9eccf43 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -13,7 +13,7 @@ namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 4, "develop" ); + Version libraryVersion( 1, 1, 5, "develop" ); } #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 0c3c5825..97061340 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * CATCH v1.1 build 4 (develop branch) - * Generated: 2014-09-15 23:36:12.995567 + * CATCH v1.1 build 5 (develop branch) + * Generated: 2014-09-18 18:24:52.876757 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -135,12 +135,12 @@ // Visual C++ #ifdef _MSC_VER -#if (_MSC_VER >= 1310 ) // (VC++ 7.0+) -//#define CATCH_CONFIG_SFINAE // Not confirmed +#if (_MSC_VER >= 1600) +#define CATCH_CONFIG_CPP11_NULLPTR #endif -#if (_MSC_VER >= 1400) -#define CATCH_CONFIG_CPP11_NULLPTR +#if (_MSC_VER >= 1310 ) // (VC++ 7.0+) +//#define CATCH_CONFIG_SFINAE // Not confirmed #endif #endif // _MSC_VER @@ -5641,6 +5641,13 @@ namespace Catch { namespace Catch { class TestRegistry : public ITestCaseRegistry { + struct LexSort { + bool operator() (TestCase i,TestCase j) const { return (i& matchingTestCases ) const { - struct LexSort { - bool operator() (TestCase i,TestCase j) const { return (i::const_iterator it = m_functionsInOrder.begin(), itEnd = m_functionsInOrder.end(); @@ -5699,7 +5700,10 @@ namespace Catch { std::sort( matchingTestCases.begin(), matchingTestCases.end(), LexSort() ); break; case RunTests::InRandomOrder: - std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), RandomNumberGenerator() ); + { + RandomNumberGenerator rng; + std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng ); + } break; case RunTests::InDeclarationOrder: // already in declaration order @@ -6636,7 +6640,7 @@ namespace Catch { namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 4, "develop" ); + Version libraryVersion( 1, 1, 5, "develop" ); } // #included from: catch_message.hpp From 8ec9a5a547c47449c3c03bd19b3a0b5b80f41808 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 2 Oct 2014 18:25:05 +0100 Subject: [PATCH 031/102] Updated project for Xcode 6 --- .../CatchSelfTest.xcodeproj/project.pbxproj | 6 +++++- .../xcshareddata/CatchSelfTest.xccheckout | 20 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj index 1ba0395b..70f402e1 100644 --- a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj +++ b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj @@ -506,7 +506,7 @@ 4A6D0C17149B3D3B00DB3EAA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0500; + LastUpgradeCheck = 0600; }; buildConfigurationList = 4A6D0C1A149B3D3B00DB3EAA /* Build configuration list for PBXProject "CatchSelfTest" */; compatibilityVersion = "Xcode 3.2"; @@ -582,9 +582,11 @@ CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__EXIT_TIME_DESTRUCTORS = NO; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; @@ -631,10 +633,12 @@ CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__EXIT_TIME_DESTRUCTORS = NO; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; diff --git a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.xcworkspace/xcshareddata/CatchSelfTest.xccheckout b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.xcworkspace/xcshareddata/CatchSelfTest.xccheckout index 149325a9..26209720 100644 --- a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.xcworkspace/xcshareddata/CatchSelfTest.xccheckout +++ b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.xcworkspace/xcshareddata/CatchSelfTest.xccheckout @@ -12,20 +12,24 @@ 01DD8CA9-7DC3-46BC-B998-EFF40EA3485F ssh://github.com/philsquared/Catch.git + 90C00904F36E6ADB57A7313E998815D255B0DEAF + github.com:philsquared/Catch.git IDESourceControlProjectPath - projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.xcworkspace + projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj IDESourceControlProjectRelativeInstallPathDictionary 01DD8CA9-7DC3-46BC-B998-EFF40EA3485F + ../../../../../../Catch + 90C00904F36E6ADB57A7313E998815D255B0DEAF ../../../../.. IDESourceControlProjectURL - ssh://github.com/philsquared/Catch.git + github.com:philsquared/Catch.git IDESourceControlProjectVersion - 110 + 111 IDESourceControlProjectWCCIdentifier - 01DD8CA9-7DC3-46BC-B998-EFF40EA3485F + 90C00904F36E6ADB57A7313E998815D255B0DEAF IDESourceControlProjectWCConfigurations @@ -36,6 +40,14 @@ IDESourceControlWCCName Catch + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + 90C00904F36E6ADB57A7313E998815D255B0DEAF + IDESourceControlWCCName + Catch-Dev2 + From b1936d3b0e64c073813e6159ebde8225390d9e06 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 2 Oct 2014 18:28:45 +0100 Subject: [PATCH 032/102] Calls method of FatalConditionHandler (to avoid warnings) --- include/internal/catch_fatal_condition.hpp | 14 +++++++++++--- include/internal/catch_runner_impl.hpp | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/internal/catch_fatal_condition.hpp b/include/internal/catch_fatal_condition.hpp index e87e9cfc..4433dfed 100644 --- a/include/internal/catch_fatal_condition.hpp +++ b/include/internal/catch_fatal_condition.hpp @@ -58,14 +58,22 @@ namespace Catch { fatal( "", -sig ); } - FatalConditionHandler() { + FatalConditionHandler() : m_isSet( true ) { for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) signal( signalDefs[i].id, handleSignal ); } ~FatalConditionHandler() { - for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) - signal( signalDefs[i].id, SIG_DFL ); + reset(); } + void reset() { + if( m_isSet ) { + for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) + signal( signalDefs[i].id, SIG_DFL ); + m_isSet = false; + } + } + + bool m_isSet; }; } // namespace Catch diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp index 7b9dcb66..8a65f26d 100644 --- a/include/internal/catch_runner_impl.hpp +++ b/include/internal/catch_runner_impl.hpp @@ -296,6 +296,7 @@ namespace Catch { void invokeActiveTestCase() { FatalConditionHandler fatalConditionHandler; // Handle signals m_activeTestCase->invoke(); + fatalConditionHandler.reset(); } private: From 4b3fa4742b0bb20a54cb77158fd5cc5d27431531 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 2 Oct 2014 18:47:07 +0100 Subject: [PATCH 033/102] Use reset instead of assignment when updating auto_ptr/unique_ptr --- include/external/clara.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/external/clara.h b/include/external/clara.h index dba26a95..ce2ef2ec 100644 --- a/include/external/clara.h +++ b/include/external/clara.h @@ -620,7 +620,7 @@ namespace Clara { m_throwOnUnrecognisedTokens( other.m_throwOnUnrecognisedTokens ) { if( other.m_floatingArg.get() ) - m_floatingArg = ArgAutoPtr( new Arg( *other.m_floatingArg ) ); + m_floatingArg.reset( new Arg( *other.m_floatingArg ) ); } CommandLine& setThrowOnUnrecognisedTokens( bool shouldThrow = true ) { @@ -649,7 +649,7 @@ namespace Clara { ArgBuilder operator[]( UnpositionalTag ) { if( m_floatingArg.get() ) throw std::logic_error( "Only one unpositional argument can be added" ); - m_floatingArg = ArgAutoPtr( new Arg() ); + m_floatingArg.reset( new Arg() ); ArgBuilder builder( m_floatingArg.get() ); return builder; } From 85b4e94192072e8e56b919ae52ffd91a80fd5dee Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 2 Oct 2014 18:51:05 +0100 Subject: [PATCH 034/102] build 6 --- README.md | 2 +- include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 25 +++++++++++++++++-------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e675aae0..b122f69a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![catch logo](catch-logo-small.png) -*v1.1 build 5 (develop branch)* +*v1.1 build 6 (develop branch)* Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index f9eccf43..1ca0c291 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -13,7 +13,7 @@ namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 5, "develop" ); + Version libraryVersion( 1, 1, 6, "develop" ); } #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 97061340..cc47d626 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * CATCH v1.1 build 5 (develop branch) - * Generated: 2014-09-18 18:24:52.876757 + * CATCH v1.1 build 6 (develop branch) + * Generated: 2014-10-02 18:50:47.450525 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -3819,7 +3819,7 @@ namespace Clara { m_throwOnUnrecognisedTokens( other.m_throwOnUnrecognisedTokens ) { if( other.m_floatingArg.get() ) - m_floatingArg = ArgAutoPtr( new Arg( *other.m_floatingArg ) ); + m_floatingArg.reset( new Arg( *other.m_floatingArg ) ); } CommandLine& setThrowOnUnrecognisedTokens( bool shouldThrow = true ) { @@ -3847,7 +3847,7 @@ namespace Clara { ArgBuilder operator[]( UnpositionalTag ) { if( m_floatingArg.get() ) throw std::logic_error( "Only one unpositional argument can be added" ); - m_floatingArg = ArgAutoPtr( new Arg() ); + m_floatingArg.reset( new Arg() ); ArgBuilder builder( m_floatingArg.get() ); return builder; } @@ -5054,14 +5054,22 @@ namespace Catch { fatal( "", -sig ); } - FatalConditionHandler() { + FatalConditionHandler() : m_isSet( true ) { for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) signal( signalDefs[i].id, handleSignal ); } ~FatalConditionHandler() { - for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) - signal( signalDefs[i].id, SIG_DFL ); + reset(); } + void reset() { + if( m_isSet ) { + for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) + signal( signalDefs[i].id, SIG_DFL ); + m_isSet = false; + } + } + + bool m_isSet; }; } // namespace Catch @@ -5341,6 +5349,7 @@ namespace Catch { void invokeActiveTestCase() { FatalConditionHandler fatalConditionHandler; // Handle signals m_activeTestCase->invoke(); + fatalConditionHandler.reset(); } private: @@ -6640,7 +6649,7 @@ namespace Catch { namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 5, "develop" ); + Version libraryVersion( 1, 1, 6, "develop" ); } // #included from: catch_message.hpp From 383d7c06a1ac91b3bb471cc6ea9aa275c1f996c2 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 2 Oct 2014 19:08:19 +0100 Subject: [PATCH 035/102] Only use std::cout/ cert via Catch::cout/ cert - and make those conditional on CATCH_CONFIG_NOSTDOUT --- include/catch_runner.hpp | 18 ++-- include/internal/catch_config.hpp | 8 +- .../internal/catch_console_colour_impl.hpp | 2 +- include/internal/catch_context_impl.hpp | 4 +- include/internal/catch_debugger.hpp | 4 +- include/internal/catch_list.hpp | 28 +++--- include/internal/catch_runner_impl.hpp | 4 +- include/internal/catch_stream.h | 3 + include/internal/catch_stream.hpp | 10 ++ include/internal/catch_tag_alias_registry.hpp | 2 +- include/internal/catch_test_case_info.hpp | 4 +- .../catch_test_case_registry_impl.hpp | 2 +- include/internal/catch_xmlwriter.hpp | 4 +- projects/SelfTest/TestMain.cpp | 4 +- single_include/catch.hpp | 95 +++++++++++-------- 15 files changed, 109 insertions(+), 83 deletions(-) diff --git a/include/catch_runner.hpp b/include/catch_runner.hpp index c9f43ed2..ea6299d0 100644 --- a/include/catch_runner.hpp +++ b/include/catch_runner.hpp @@ -108,7 +108,7 @@ namespace Catch { : m_cli( makeCommandLineParser() ) { if( alreadyInstantiated ) { std::string msg = "Only one instance of Catch::Session can ever be used"; - std::cerr << msg << std::endl; + Catch::cerr() << msg << std::endl; throw std::logic_error( msg ); } alreadyInstantiated = true; @@ -118,15 +118,15 @@ namespace Catch { } void showHelp( std::string const& processName ) { - std::cout << "\nCatch v" << libraryVersion.majorVersion << "." + Catch::cout() << "\nCatch v" << libraryVersion.majorVersion << "." << libraryVersion.minorVersion << " build " << libraryVersion.buildNumber; if( libraryVersion.branchName != std::string( "master" ) ) - std::cout << " (" << libraryVersion.branchName << " branch)"; - std::cout << "\n"; + Catch::cout() << " (" << libraryVersion.branchName << " branch)"; + Catch::cout() << "\n"; - m_cli.usage( std::cout, processName ); - std::cout << "For more detail usage please see the project docs\n" << std::endl; + m_cli.usage( Catch::cout(), processName ); + Catch::cout() << "For more detail usage please see the project docs\n" << std::endl; } int applyCommandLine( int argc, char* const argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) { @@ -140,11 +140,11 @@ namespace Catch { catch( std::exception& ex ) { { Colour colourGuard( Colour::Red ); - std::cerr << "\nError(s) in input:\n" + Catch::cerr() << "\nError(s) in input:\n" << Text( ex.what(), TextAttributes().setIndent(2) ) << "\n\n"; } - m_cli.usage( std::cout, m_configData.processName ); + m_cli.usage( Catch::cout(), m_configData.processName ); return (std::numeric_limits::max)(); } return 0; @@ -182,7 +182,7 @@ namespace Catch { return static_cast( runner.runTests().assertions.failed ); } catch( std::exception& ex ) { - std::cerr << ex.what() << std::endl; + Catch::cerr() << ex.what() << std::endl; return (std::numeric_limits::max)(); } } diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp index 37ca6579..3e332087 100644 --- a/include/internal/catch_config.hpp +++ b/include/internal/catch_config.hpp @@ -81,12 +81,12 @@ namespace Catch { public: Config() - : m_os( std::cout.rdbuf() ) + : m_os( Catch::cout().rdbuf() ) {} Config( ConfigData const& data ) : m_data( data ), - m_os( std::cout.rdbuf() ) + m_os( Catch::cout().rdbuf() ) { if( !data.testsOrTags.empty() ) { TestSpecParser parser( ITagAliasRegistry::get() ); @@ -97,7 +97,7 @@ namespace Catch { } virtual ~Config() { - m_os.rdbuf( std::cout.rdbuf() ); + m_os.rdbuf( Catch::cout().rdbuf() ); m_stream.release(); } @@ -119,7 +119,7 @@ namespace Catch { bool shouldDebugBreak() const { return m_data.shouldDebugBreak; } void setStreamBuf( std::streambuf* buf ) { - m_os.rdbuf( buf ? buf : std::cout.rdbuf() ); + m_os.rdbuf( buf ? buf : Catch::cout().rdbuf() ); } void useStream( std::string const& streamName ) { diff --git a/include/internal/catch_console_colour_impl.hpp b/include/internal/catch_console_colour_impl.hpp index 5f215062..3920a98a 100644 --- a/include/internal/catch_console_colour_impl.hpp +++ b/include/internal/catch_console_colour_impl.hpp @@ -115,7 +115,7 @@ namespace { } private: void setColour( const char* _escapeCode ) { - std::cout << '\033' << _escapeCode; + Catch::cout() << '\033' << _escapeCode; } }; diff --git a/include/internal/catch_context_impl.hpp b/include/internal/catch_context_impl.hpp index 75bbfb0c..19534de0 100644 --- a/include/internal/catch_context_impl.hpp +++ b/include/internal/catch_context_impl.hpp @@ -96,8 +96,8 @@ namespace Catch { } Stream createStream( std::string const& streamName ) { - if( streamName == "stdout" ) return Stream( std::cout.rdbuf(), false ); - if( streamName == "stderr" ) return Stream( std::cerr.rdbuf(), false ); + if( streamName == "stdout" ) return Stream( Catch::cout().rdbuf(), false ); + if( streamName == "stderr" ) return Stream( Catch::cerr().rdbuf(), false ); if( streamName == "debug" ) return Stream( new StreamBufImpl, true ); throw std::domain_error( "Unknown stream: " + streamName ); diff --git a/include/internal/catch_debugger.hpp b/include/internal/catch_debugger.hpp index 49c485ff..4151aec7 100644 --- a/include/internal/catch_debugger.hpp +++ b/include/internal/catch_debugger.hpp @@ -51,7 +51,7 @@ size = sizeof(info); if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0) != 0 ) { - std::cerr << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl; + Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl; return false; } @@ -92,7 +92,7 @@ namespace Catch { void writeToDebugConsole( std::string const& text ) { // !TBD: Need a version for Mac/ XCode and other IDEs - std::cout << text; + Catch::cout() << text; } } #endif // Platform diff --git a/include/internal/catch_list.hpp b/include/internal/catch_list.hpp index 53cd37d6..34ffbc26 100644 --- a/include/internal/catch_list.hpp +++ b/include/internal/catch_list.hpp @@ -23,9 +23,9 @@ namespace Catch { TestSpec testSpec = config.testSpec(); if( config.testSpec().hasFilters() ) - std::cout << "Matching test cases:\n"; + Catch::cout() << "Matching test cases:\n"; else { - std::cout << "All available test cases:\n"; + Catch::cout() << "All available test cases:\n"; testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec(); } @@ -46,15 +46,15 @@ namespace Catch { : Colour::None; Colour colourGuard( colour ); - std::cout << Text( testCaseInfo.name, nameAttr ) << std::endl; + Catch::cout() << Text( testCaseInfo.name, nameAttr ) << std::endl; if( !testCaseInfo.tags.empty() ) - std::cout << Text( testCaseInfo.tagsAsString, tagsAttr ) << std::endl; + Catch::cout() << Text( testCaseInfo.tagsAsString, tagsAttr ) << std::endl; } if( !config.testSpec().hasFilters() ) - std::cout << pluralise( matchedTests, "test case" ) << "\n" << std::endl; + Catch::cout() << pluralise( matchedTests, "test case" ) << "\n" << std::endl; else - std::cout << pluralise( matchedTests, "matching test case" ) << "\n" << std::endl; + Catch::cout() << pluralise( matchedTests, "matching test case" ) << "\n" << std::endl; return matchedTests; } @@ -70,7 +70,7 @@ namespace Catch { ++it ) { matchedTests++; TestCaseInfo const& testCaseInfo = it->getTestCaseInfo(); - std::cout << testCaseInfo.name << std::endl; + Catch::cout() << testCaseInfo.name << std::endl; } return matchedTests; } @@ -96,9 +96,9 @@ namespace Catch { inline std::size_t listTags( Config const& config ) { TestSpec testSpec = config.testSpec(); if( config.testSpec().hasFilters() ) - std::cout << "Tags for matching test cases:\n"; + Catch::cout() << "Tags for matching test cases:\n"; else { - std::cout << "All available tags:\n"; + Catch::cout() << "All available tags:\n"; testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec(); } @@ -132,14 +132,14 @@ namespace Catch { .setInitialIndent( 0 ) .setIndent( oss.str().size() ) .setWidth( CATCH_CONFIG_CONSOLE_WIDTH-10 ) ); - std::cout << oss.str() << wrapper << "\n"; + Catch::cout() << oss.str() << wrapper << "\n"; } - std::cout << pluralise( tagCounts.size(), "tag" ) << "\n" << std::endl; + Catch::cout() << pluralise( tagCounts.size(), "tag" ) << "\n" << std::endl; return tagCounts.size(); } inline std::size_t listReporters( Config const& /*config*/ ) { - std::cout << "Available reports:\n"; + Catch::cout() << "Available reports:\n"; IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); IReporterRegistry::FactoryMap::const_iterator itBegin = factories.begin(), itEnd = factories.end(), it; std::size_t maxNameLen = 0; @@ -151,13 +151,13 @@ namespace Catch { .setInitialIndent( 0 ) .setIndent( 7+maxNameLen ) .setWidth( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 ) ); - std::cout << " " + Catch::cout() << " " << it->first << ":" << std::string( maxNameLen - it->first.size() + 2, ' ' ) << wrapper << "\n"; } - std::cout << std::endl; + Catch::cout() << std::endl; return factories.size(); } diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp index 8a65f26d..e6893518 100644 --- a/include/internal/catch_runner_impl.hpp +++ b/include/internal/catch_runner_impl.hpp @@ -262,8 +262,8 @@ namespace Catch { Timer timer; timer.start(); if( m_reporter->getPreferences().shouldRedirectStdOut ) { - StreamRedirect coutRedir( std::cout, redirectedCout ); - StreamRedirect cerrRedir( std::cerr, redirectedCerr ); + StreamRedirect coutRedir( Catch::cout(), redirectedCout ); + StreamRedirect cerrRedir( Catch::cerr(), redirectedCerr ); invokeActiveTestCase(); } else { diff --git a/include/internal/catch_stream.h b/include/internal/catch_stream.h index 70ddb58c..402a6617 100644 --- a/include/internal/catch_stream.h +++ b/include/internal/catch_stream.h @@ -28,6 +28,9 @@ namespace Catch { private: bool isOwned; }; + + std::ostream& cout(); + std::ostream& cerr(); } #endif // TWOBLUECUBES_CATCH_STREAM_H_INCLUDED diff --git a/include/internal/catch_stream.hpp b/include/internal/catch_stream.hpp index adfacbf1..604ed97b 100644 --- a/include/internal/catch_stream.hpp +++ b/include/internal/catch_stream.hpp @@ -15,6 +15,7 @@ #include #include +#include namespace Catch { @@ -78,6 +79,15 @@ namespace Catch { isOwned = false; } } + +#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement this functions + std::ostream& cout() { + return std::cout; + } + std::ostream& cerr() { + return std::cerr; + } +#endif } #endif // TWOBLUECUBES_CATCH_STREAM_HPP_INCLUDED diff --git a/include/internal/catch_tag_alias_registry.hpp b/include/internal/catch_tag_alias_registry.hpp index fea7ce9c..e5ad11b2 100644 --- a/include/internal/catch_tag_alias_registry.hpp +++ b/include/internal/catch_tag_alias_registry.hpp @@ -73,7 +73,7 @@ namespace Catch { } catch( std::exception& ex ) { Colour colourGuard( Colour::Red ); - std::cerr << ex.what() << std::endl; + Catch::cerr() << ex.what() << std::endl; exit(1); } } diff --git a/include/internal/catch_test_case_info.hpp b/include/internal/catch_test_case_info.hpp index e3fa1f7d..b06c86fb 100644 --- a/include/internal/catch_test_case_info.hpp +++ b/include/internal/catch_test_case_info.hpp @@ -36,13 +36,13 @@ namespace Catch { if( isReservedTag( tag ) ) { { Colour colourGuard( Colour::Red ); - std::cerr + Catch::cerr() << "Tag name [" << tag << "] not allowed.\n" << "Tag names starting with non alpha-numeric characters are reserved\n"; } { Colour colourGuard( Colour::FileName ); - std::cerr << _lineInfo << std::endl; + Catch::cerr() << _lineInfo << std::endl; } exit(1); } diff --git a/include/internal/catch_test_case_registry_impl.hpp b/include/internal/catch_test_case_registry_impl.hpp index 5d24b15c..6c01a187 100644 --- a/include/internal/catch_test_case_registry_impl.hpp +++ b/include/internal/catch_test_case_registry_impl.hpp @@ -51,7 +51,7 @@ namespace Catch { TestCase const& prev = *m_functions.find( testCase ); { Colour colourGuard( Colour::Red ); - std::cerr << "error: TEST_CASE( \"" << name << "\" ) already defined.\n" + Catch::cerr() << "error: TEST_CASE( \"" << name << "\" ) already defined.\n" << "\tFirst seen at " << prev.getTestCaseInfo().lineInfo << "\n" << "\tRedefined at " << testCase.getTestCaseInfo().lineInfo << std::endl; } diff --git a/include/internal/catch_xmlwriter.hpp b/include/internal/catch_xmlwriter.hpp index 52d66bce..79b7c5a0 100644 --- a/include/internal/catch_xmlwriter.hpp +++ b/include/internal/catch_xmlwriter.hpp @@ -9,9 +9,9 @@ #define TWOBLUECUBES_CATCH_XMLWRITER_HPP_INCLUDED #include -#include #include #include +#include namespace Catch { @@ -52,7 +52,7 @@ namespace Catch { XmlWriter() : m_tagIsOpen( false ), m_needsNewline( false ), - m_os( &std::cout ) + m_os( &Catch::cout() ) {} XmlWriter( std::ostream& os ) diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index edc8aa1f..a377e597 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -355,14 +355,14 @@ TEST_CASE( "Strings can be rendered with colour", "[colour][.]" ) { cs .addColour( Colour::Red, 0 ) .addColour( Colour::Green, -1 ); - std::cout << cs << std::endl; + Catch::cout() << cs << std::endl; } { ColourString cs( "hello" ); cs .addColour( Colour::Blue, 1, -2 ); - std::cout << cs << std::endl; + Catch::cout() << cs << std::endl; } } diff --git a/single_include/catch.hpp b/single_include/catch.hpp index cc47d626..c5191bf5 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* * CATCH v1.1 build 6 (develop branch) - * Generated: 2014-10-02 18:50:47.450525 + * Generated: 2014-10-02 19:07:23.164698 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -3056,6 +3056,9 @@ namespace Catch { private: bool isOwned; }; + + std::ostream& cout(); + std::ostream& cerr(); } #include @@ -3125,12 +3128,12 @@ namespace Catch { public: Config() - : m_os( std::cout.rdbuf() ) + : m_os( Catch::cout().rdbuf() ) {} Config( ConfigData const& data ) : m_data( data ), - m_os( std::cout.rdbuf() ) + m_os( Catch::cout().rdbuf() ) { if( !data.testsOrTags.empty() ) { TestSpecParser parser( ITagAliasRegistry::get() ); @@ -3141,7 +3144,7 @@ namespace Catch { } virtual ~Config() { - m_os.rdbuf( std::cout.rdbuf() ); + m_os.rdbuf( Catch::cout().rdbuf() ); m_stream.release(); } @@ -3163,7 +3166,7 @@ namespace Catch { bool shouldDebugBreak() const { return m_data.shouldDebugBreak; } void setStreamBuf( std::streambuf* buf ) { - m_os.rdbuf( buf ? buf : std::cout.rdbuf() ); + m_os.rdbuf( buf ? buf : Catch::cout().rdbuf() ); } void useStream( std::string const& streamName ) { @@ -4712,9 +4715,9 @@ namespace Catch { TestSpec testSpec = config.testSpec(); if( config.testSpec().hasFilters() ) - std::cout << "Matching test cases:\n"; + Catch::cout() << "Matching test cases:\n"; else { - std::cout << "All available test cases:\n"; + Catch::cout() << "All available test cases:\n"; testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec(); } @@ -4735,15 +4738,15 @@ namespace Catch { : Colour::None; Colour colourGuard( colour ); - std::cout << Text( testCaseInfo.name, nameAttr ) << std::endl; + Catch::cout() << Text( testCaseInfo.name, nameAttr ) << std::endl; if( !testCaseInfo.tags.empty() ) - std::cout << Text( testCaseInfo.tagsAsString, tagsAttr ) << std::endl; + Catch::cout() << Text( testCaseInfo.tagsAsString, tagsAttr ) << std::endl; } if( !config.testSpec().hasFilters() ) - std::cout << pluralise( matchedTests, "test case" ) << "\n" << std::endl; + Catch::cout() << pluralise( matchedTests, "test case" ) << "\n" << std::endl; else - std::cout << pluralise( matchedTests, "matching test case" ) << "\n" << std::endl; + Catch::cout() << pluralise( matchedTests, "matching test case" ) << "\n" << std::endl; return matchedTests; } @@ -4759,7 +4762,7 @@ namespace Catch { ++it ) { matchedTests++; TestCaseInfo const& testCaseInfo = it->getTestCaseInfo(); - std::cout << testCaseInfo.name << std::endl; + Catch::cout() << testCaseInfo.name << std::endl; } return matchedTests; } @@ -4785,9 +4788,9 @@ namespace Catch { inline std::size_t listTags( Config const& config ) { TestSpec testSpec = config.testSpec(); if( config.testSpec().hasFilters() ) - std::cout << "Tags for matching test cases:\n"; + Catch::cout() << "Tags for matching test cases:\n"; else { - std::cout << "All available tags:\n"; + Catch::cout() << "All available tags:\n"; testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec(); } @@ -4821,14 +4824,14 @@ namespace Catch { .setInitialIndent( 0 ) .setIndent( oss.str().size() ) .setWidth( CATCH_CONFIG_CONSOLE_WIDTH-10 ) ); - std::cout << oss.str() << wrapper << "\n"; + Catch::cout() << oss.str() << wrapper << "\n"; } - std::cout << pluralise( tagCounts.size(), "tag" ) << "\n" << std::endl; + Catch::cout() << pluralise( tagCounts.size(), "tag" ) << "\n" << std::endl; return tagCounts.size(); } inline std::size_t listReporters( Config const& /*config*/ ) { - std::cout << "Available reports:\n"; + Catch::cout() << "Available reports:\n"; IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); IReporterRegistry::FactoryMap::const_iterator itBegin = factories.begin(), itEnd = factories.end(), it; std::size_t maxNameLen = 0; @@ -4840,13 +4843,13 @@ namespace Catch { .setInitialIndent( 0 ) .setIndent( 7+maxNameLen ) .setWidth( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 ) ); - std::cout << " " + Catch::cout() << " " << it->first << ":" << std::string( maxNameLen - it->first.size() + 2, ' ' ) << wrapper << "\n"; } - std::cout << std::endl; + Catch::cout() << std::endl; return factories.size(); } @@ -5315,8 +5318,8 @@ namespace Catch { Timer timer; timer.start(); if( m_reporter->getPreferences().shouldRedirectStdOut ) { - StreamRedirect coutRedir( std::cout, redirectedCout ); - StreamRedirect cerrRedir( std::cerr, redirectedCerr ); + StreamRedirect coutRedir( Catch::cout(), redirectedCout ); + StreamRedirect cerrRedir( Catch::cerr(), redirectedCerr ); invokeActiveTestCase(); } else { @@ -5530,7 +5533,7 @@ namespace Catch { : m_cli( makeCommandLineParser() ) { if( alreadyInstantiated ) { std::string msg = "Only one instance of Catch::Session can ever be used"; - std::cerr << msg << std::endl; + Catch::cerr() << msg << std::endl; throw std::logic_error( msg ); } alreadyInstantiated = true; @@ -5540,15 +5543,15 @@ namespace Catch { } void showHelp( std::string const& processName ) { - std::cout << "\nCatch v" << libraryVersion.majorVersion << "." + Catch::cout() << "\nCatch v" << libraryVersion.majorVersion << "." << libraryVersion.minorVersion << " build " << libraryVersion.buildNumber; if( libraryVersion.branchName != std::string( "master" ) ) - std::cout << " (" << libraryVersion.branchName << " branch)"; - std::cout << "\n"; + Catch::cout() << " (" << libraryVersion.branchName << " branch)"; + Catch::cout() << "\n"; - m_cli.usage( std::cout, processName ); - std::cout << "For more detail usage please see the project docs\n" << std::endl; + m_cli.usage( Catch::cout(), processName ); + Catch::cout() << "For more detail usage please see the project docs\n" << std::endl; } int applyCommandLine( int argc, char* const argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) { @@ -5562,11 +5565,11 @@ namespace Catch { catch( std::exception& ex ) { { Colour colourGuard( Colour::Red ); - std::cerr << "\nError(s) in input:\n" + Catch::cerr() << "\nError(s) in input:\n" << Text( ex.what(), TextAttributes().setIndent(2) ) << "\n\n"; } - m_cli.usage( std::cout, m_configData.processName ); + m_cli.usage( Catch::cout(), m_configData.processName ); return (std::numeric_limits::max)(); } return 0; @@ -5604,7 +5607,7 @@ namespace Catch { return static_cast( runner.runTests().assertions.failed ); } catch( std::exception& ex ) { - std::cerr << ex.what() << std::endl; + Catch::cerr() << ex.what() << std::endl; return (std::numeric_limits::max)(); } } @@ -5679,7 +5682,7 @@ namespace Catch { TestCase const& prev = *m_functions.find( testCase ); { Colour colourGuard( Colour::Red ); - std::cerr << "error: TEST_CASE( \"" << name << "\" ) already defined.\n" + Catch::cerr() << "error: TEST_CASE( \"" << name << "\" ) already defined.\n" << "\tFirst seen at " << prev.getTestCaseInfo().lineInfo << "\n" << "\tRedefined at " << testCase.getTestCaseInfo().lineInfo << std::endl; } @@ -5992,6 +5995,7 @@ namespace Catch { #include #include +#include namespace Catch { @@ -6055,6 +6059,15 @@ namespace Catch { isOwned = false; } } + +#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement this functions + std::ostream& cout() { + return std::cout; + } + std::ostream& cerr() { + return std::cerr; + } +#endif } namespace Catch { @@ -6140,8 +6153,8 @@ namespace Catch { } Stream createStream( std::string const& streamName ) { - if( streamName == "stdout" ) return Stream( std::cout.rdbuf(), false ); - if( streamName == "stderr" ) return Stream( std::cerr.rdbuf(), false ); + if( streamName == "stdout" ) return Stream( Catch::cout().rdbuf(), false ); + if( streamName == "stderr" ) return Stream( Catch::cerr().rdbuf(), false ); if( streamName == "debug" ) return Stream( new StreamBufImpl, true ); throw std::domain_error( "Unknown stream: " + streamName ); @@ -6261,7 +6274,7 @@ namespace { } private: void setColour( const char* _escapeCode ) { - std::cout << '\033' << _escapeCode; + Catch::cout() << '\033' << _escapeCode; } }; @@ -6490,13 +6503,13 @@ namespace Catch { if( isReservedTag( tag ) ) { { Colour colourGuard( Colour::Red ); - std::cerr + Catch::cerr() << "Tag name [" << tag << "] not allowed.\n" << "Tag names starting with non alpha-numeric characters are reserved\n"; } { Colour colourGuard( Colour::FileName ); - std::cerr << _lineInfo << std::endl; + Catch::cerr() << _lineInfo << std::endl; } exit(1); } @@ -7013,7 +7026,7 @@ namespace Catch { size = sizeof(info); if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0) != 0 ) { - std::cerr << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl; + Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl; return false; } @@ -7054,7 +7067,7 @@ namespace Catch { namespace Catch { void writeToDebugConsole( std::string const& text ) { // !TBD: Need a version for Mac/ XCode and other IDEs - std::cout << text; + Catch::cout() << text; } } #endif // Platform @@ -7429,7 +7442,7 @@ namespace Catch { } catch( std::exception& ex ) { Colour colourGuard( Colour::Red ); - std::cerr << ex.what() << std::endl; + Catch::cerr() << ex.what() << std::endl; exit(1); } } @@ -7698,9 +7711,9 @@ namespace Catch { #define TWOBLUECUBES_CATCH_XMLWRITER_HPP_INCLUDED #include -#include #include #include +#include namespace Catch { @@ -7741,7 +7754,7 @@ namespace Catch { XmlWriter() : m_tagIsOpen( false ), m_needsNewline( false ), - m_os( &std::cout ) + m_os( &Catch::cout() ) {} XmlWriter( std::ostream& os ) From e606cebac50e3eb882570179ac29fe77c27e5d45 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 2 Oct 2014 19:13:21 +0100 Subject: [PATCH 036/102] Fixed #include --- include/internal/catch_xmlwriter.hpp | 3 ++- single_include/catch.hpp | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/internal/catch_xmlwriter.hpp b/include/internal/catch_xmlwriter.hpp index 79b7c5a0..d47c2b4d 100644 --- a/include/internal/catch_xmlwriter.hpp +++ b/include/internal/catch_xmlwriter.hpp @@ -8,10 +8,11 @@ #ifndef TWOBLUECUBES_CATCH_XMLWRITER_HPP_INCLUDED #define TWOBLUECUBES_CATCH_XMLWRITER_HPP_INCLUDED +#include "../internal/catch_stream.h" + #include #include #include -#include namespace Catch { diff --git a/single_include/catch.hpp b/single_include/catch.hpp index c5191bf5..6a80971b 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* * CATCH v1.1 build 6 (develop branch) - * Generated: 2014-10-02 19:07:23.164698 + * Generated: 2014-10-02 19:13:03.375275 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -7713,7 +7713,6 @@ namespace Catch { #include #include #include -#include namespace Catch { From 12fe67cc82e1a17512a877e5af7c819e3e27f052 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 3 Oct 2014 08:15:27 +0100 Subject: [PATCH 037/102] Updated NonCopyable (to include C++11 version) and use for Session and Section --- include/catch_runner.hpp | 2 +- include/internal/catch_common.h | 12 ++++++++++-- include/internal/catch_section.h | 11 +---------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/catch_runner.hpp b/include/catch_runner.hpp index ea6299d0..67f94e3e 100644 --- a/include/catch_runner.hpp +++ b/include/catch_runner.hpp @@ -97,7 +97,7 @@ namespace Catch { std::set m_testsAlreadyRun; }; - class Session { + class Session : NonCopyable { static bool alreadyInstantiated; public: diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h index 967b7fc2..2001c297 100644 --- a/include/internal/catch_common.h +++ b/include/internal/catch_common.h @@ -24,8 +24,16 @@ namespace Catch { class NonCopyable { - NonCopyable( NonCopyable const& ); - void operator = ( NonCopyable const& ); +#ifdef CATCH_CPP11_OR_GREATER + NonCopyable( NonCopyable const& ) = delete; + NonCopyable( NonCopyable && ) = delete; + NonCopyable& operator = ( NonCopyable const& ) = delete; + NonCopyable& operator = ( NonCopyable && ) = delete; +#else + NonCopyable( NonCopyable const& info ); + NonCopyable& operator = ( NonCopyable const& ); +#endif + protected: NonCopyable() {} virtual ~NonCopyable(); diff --git a/include/internal/catch_section.h b/include/internal/catch_section.h index f83d828b..d8b3ae42 100644 --- a/include/internal/catch_section.h +++ b/include/internal/catch_section.h @@ -16,7 +16,7 @@ namespace Catch { - class Section { + class Section : NonCopyable { public: Section( SectionInfo const& info ); ~Section(); @@ -25,15 +25,6 @@ namespace Catch { operator bool() const; private: -#ifdef CATCH_CPP11_OR_GREATER - Section( Section const& ) = delete; - Section( Section && ) = delete; - Section& operator = ( Section const& ) = delete; - Section& operator = ( Section && ) = delete; -#else - Section( Section const& info ); - Section& operator = ( Section const& ); -#endif SectionInfo m_info; std::string m_name; From a5dca3d370c8ab25563e5c938d8666cb2882a689 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 3 Oct 2014 08:17:40 +0100 Subject: [PATCH 038/102] removed some warnings --- projects/SelfTest/EnumToString.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/SelfTest/EnumToString.cpp b/projects/SelfTest/EnumToString.cpp index b35721dc..6917d8ae 100644 --- a/projects/SelfTest/EnumToString.cpp +++ b/projects/SelfTest/EnumToString.cpp @@ -49,13 +49,13 @@ TEST_CASE( "toString(enum class)", "[toString][enum][enumClass]" ) { enum class EnumClass2 : short { EnumClass2Value0, EnumClass2Value1 }; inline std::ostream& operator<<( std::ostream& os, EnumClass2 e2 ) { - switch( (int)e2 ) { - case (int)EnumClass2::EnumClass2Value0: + switch( static_cast( e2 ) ) { + case static_cast( EnumClass2::EnumClass2Value0 ): return os << "E2/V0"; - case (int)EnumClass2::EnumClass2Value1: + case static_cast( EnumClass2::EnumClass2Value1 ): return os << "E2/V1"; default: - return os << "Unknown enum value " << (int)e2; + return os << "Unknown enum value " << static_cast( e2 ); } } From b0e53a8ee006cee203a40bf3c1454e8806135d9c Mon Sep 17 00:00:00 2001 From: "Sean D. Cline" Date: Sat, 11 Oct 2014 17:20:55 -0400 Subject: [PATCH 039/102] Move the xml reporter away from the deprecated IReporter interface. --- include/internal/catch_impl.hpp | 2 - include/reporters/catch_reporter_xml.hpp | 160 +++++++++++++---------- 2 files changed, 94 insertions(+), 68 deletions(-) diff --git a/include/internal/catch_impl.hpp b/include/internal/catch_impl.hpp index cc03ae08..820b4975 100644 --- a/include/internal/catch_impl.hpp +++ b/include/internal/catch_impl.hpp @@ -88,8 +88,6 @@ namespace Catch { Matchers::Impl::StdString::EndsWith::~EndsWith() {} void Config::dummy() {} - - INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "xml", XmlReporter ) } #ifdef __clang__ diff --git a/include/reporters/catch_reporter_xml.hpp b/include/reporters/catch_reporter_xml.hpp index 4687471a..6b31107a 100644 --- a/include/reporters/catch_reporter_xml.hpp +++ b/include/reporters/catch_reporter_xml.hpp @@ -15,78 +15,83 @@ #include "../internal/catch_xmlwriter.hpp" namespace Catch { - class XmlReporter : public SharedImpl { + class XmlReporter : public StreamingReporterBase { public: - XmlReporter( ReporterConfig const& config ) : m_config( config ), m_sectionDepth( 0 ) {} + XmlReporter( ReporterConfig const& _config ) + : StreamingReporterBase( _config ), + m_sectionDepth( 0 ) + {} + virtual ~XmlReporter(); + static std::string getDescription() { return "Reports test results as an XML document"; } - virtual ~XmlReporter(); - private: // IReporter - - virtual bool shouldRedirectStdout() const { - return true; + public: // StreamingReporterBase + virtual ReporterPreferences getPreferences() const { + ReporterPreferences prefs; + prefs.shouldRedirectStdOut = true; + return prefs; } - virtual void StartTesting() { - m_xml.setStream( m_config.stream() ); + virtual void noMatchingTestCases( std::string const& s ) { + StreamingReporterBase::noMatchingTestCases( s ); + } + + virtual void testRunStarting( TestRunInfo const& testInfo ) { + StreamingReporterBase::testRunStarting( testInfo ); + m_xml.setStream( stream ); m_xml.startElement( "Catch" ); - if( !m_config.fullConfig()->name().empty() ) - m_xml.writeAttribute( "name", m_config.fullConfig()->name() ); + if( !m_config->name().empty() ) + m_xml.writeAttribute( "name", m_config->name() ); } - virtual void EndTesting( const Totals& totals ) { - m_xml.scopedElement( "OverallResults" ) - .writeAttribute( "successes", totals.assertions.passed ) - .writeAttribute( "failures", totals.assertions.failed ) - .writeAttribute( "expectedFailures", totals.assertions.failedButOk ); - m_xml.endElement(); - } - - virtual void StartGroup( const std::string& groupName ) { + virtual void testGroupStarting( GroupInfo const& groupInfo ) { + StreamingReporterBase::testGroupStarting( groupInfo ); m_xml.startElement( "Group" ) - .writeAttribute( "name", groupName ); + .writeAttribute( "name", groupInfo.name ); } - virtual void EndGroup( const std::string&, const Totals& totals ) { - m_xml.scopedElement( "OverallResults" ) - .writeAttribute( "successes", totals.assertions.passed ) - .writeAttribute( "failures", totals.assertions.failed ) - .writeAttribute( "expectedFailures", totals.assertions.failedButOk ); - m_xml.endElement(); + virtual void testCaseStarting( TestCaseInfo const& testInfo ) { + StreamingReporterBase::testCaseStarting(testInfo); + m_xml.startElement( "TestCase" ).writeAttribute( "name", trim( testInfo.name ) ); } - virtual void StartSection( const std::string& sectionName, const std::string& description ) { + virtual void sectionStarting( SectionInfo const& sectionInfo ) { + StreamingReporterBase::sectionStarting( sectionInfo ); if( m_sectionDepth++ > 0 ) { m_xml.startElement( "Section" ) - .writeAttribute( "name", trim( sectionName ) ) - .writeAttribute( "description", description ); - } - } - virtual void NoAssertionsInSection( const std::string& ) {} - virtual void NoAssertionsInTestCase( const std::string& ) {} - - virtual void EndSection( const std::string& /*sectionName*/, const Counts& assertions ) { - if( --m_sectionDepth > 0 ) { - m_xml.scopedElement( "OverallResults" ) - .writeAttribute( "successes", assertions.passed ) - .writeAttribute( "failures", assertions.failed ) - .writeAttribute( "expectedFailures", assertions.failedButOk ); - m_xml.endElement(); + .writeAttribute( "name", trim( sectionInfo.name ) ) + .writeAttribute( "description", sectionInfo.description ); } } - virtual void StartTestCase( const Catch::TestCaseInfo& testInfo ) { - m_xml.startElement( "TestCase" ).writeAttribute( "name", trim( testInfo.name ) ); - m_currentTestSuccess = true; - } + virtual void assertionStarting( AssertionInfo const& ) { } - virtual void Result( const Catch::AssertionResult& assertionResult ) { - if( !m_config.fullConfig()->includeSuccessfulResults() && assertionResult.getResultType() == ResultWas::Ok ) - return; + virtual bool assertionEnded( AssertionStats const& assertionStats ) { + const AssertionResult& assertionResult = assertionStats.assertionResult; + + // Print any info messages in tags. + if( assertionStats.assertionResult.getResultType() != ResultWas::Ok ) { + for( std::vector::const_iterator it = assertionStats.infoMessages.begin(), itEnd = assertionStats.infoMessages.end(); + it != itEnd; + ++it ) { + if( it->type == ResultWas::Info ) { + m_xml.scopedElement( "Info" ) + .writeText( it->message ); + } else if ( it->type == ResultWas::Warning ) { + m_xml.scopedElement( "Warning" ) + .writeText( it->message ); + } + } + } + // Drop out if result was successful but we're not printing them. + if( !m_config->includeSuccessfulResults() && isOk(assertionResult.getResultType()) ) + return true; + + // Print the expression if there is one. if( assertionResult.hasExpression() ) { m_xml.startElement( "Expression" ) .writeAttribute( "success", assertionResult.succeeded() ) @@ -97,23 +102,23 @@ namespace Catch { .writeText( assertionResult.getExpression() ); m_xml.scopedElement( "Expanded" ) .writeText( assertionResult.getExpandedExpression() ); - m_currentTestSuccess &= assertionResult.succeeded(); } + // And... Print a result applicable to each result type. switch( assertionResult.getResultType() ) { + default: + break; case ResultWas::ThrewException: m_xml.scopedElement( "Exception" ) .writeAttribute( "filename", assertionResult.getSourceInfo().file ) .writeAttribute( "line", assertionResult.getSourceInfo().line ) .writeText( assertionResult.getMessage() ); - m_currentTestSuccess = false; break; case ResultWas::FatalErrorCondition: m_xml.scopedElement( "Fatal Error Condition" ) .writeAttribute( "filename", assertionResult.getSourceInfo().file ) .writeAttribute( "line", assertionResult.getSourceInfo().line ) .writeText( assertionResult.getMessage() ); - m_currentTestSuccess = false; break; case ResultWas::Info: m_xml.scopedElement( "Info" ) @@ -126,36 +131,59 @@ namespace Catch { case ResultWas::ExplicitFailure: m_xml.scopedElement( "Failure" ) .writeText( assertionResult.getMessage() ); - m_currentTestSuccess = false; - break; - case ResultWas::Unknown: - case ResultWas::Ok: - case ResultWas::FailureBit: - case ResultWas::ExpressionFailed: - case ResultWas::Exception: - case ResultWas::DidntThrowException: break; } + if( assertionResult.hasExpression() ) m_xml.endElement(); + + return true; } - virtual void Aborted() { - // !TBD + virtual void sectionEnded( SectionStats const& sectionStats ) { + StreamingReporterBase::sectionEnded( sectionStats ); + if( --m_sectionDepth > 0 ) { + m_xml.scopedElement( "OverallResults" ) + .writeAttribute( "successes", sectionStats.assertions.passed ) + .writeAttribute( "failures", sectionStats.assertions.failed ) + .writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk ); + m_xml.endElement(); + } } - virtual void EndTestCase( const Catch::TestCaseInfo&, const Totals&, const std::string&, const std::string& ) { - m_xml.scopedElement( "OverallResult" ).writeAttribute( "success", m_currentTestSuccess ); + virtual void testCaseEnded( TestCaseStats const& testCaseStats ) { + StreamingReporterBase::testCaseEnded( testCaseStats ); + m_xml.scopedElement( "OverallResult" ) + .writeAttribute( "success", testCaseStats.totals.assertions.allPassed() ); + m_xml.endElement(); + } + + virtual void testGroupEnded( TestGroupStats const& testGroupStats ) { + StreamingReporterBase::testGroupEnded( testGroupStats ); + // TODO: Check testGroupStats.aborting and act accordingly. + m_xml.scopedElement( "OverallResults" ) + .writeAttribute( "successes", testGroupStats.totals.assertions.passed ) + .writeAttribute( "failures", testGroupStats.totals.assertions.failed ) + .writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk ); + m_xml.endElement(); + } + + virtual void testRunEnded( TestRunStats const& testRunStats ) { + StreamingReporterBase::testRunEnded( testRunStats ); + m_xml.scopedElement( "OverallResults" ) + .writeAttribute( "successes", testRunStats.totals.assertions.passed ) + .writeAttribute( "failures", testRunStats.totals.assertions.failed ) + .writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk ); m_xml.endElement(); } private: - ReporterConfig m_config; - bool m_currentTestSuccess; XmlWriter m_xml; int m_sectionDepth; }; + INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter ) + } // end namespace Catch #endif // TWOBLUECUBES_CATCH_REPORTER_XML_HPP_INCLUDED From ea81e98d6a01fc7858ac2339ddde90b7cb8162bd Mon Sep 17 00:00:00 2001 From: "Sean D. Cline" Date: Sat, 11 Oct 2014 19:57:45 -0400 Subject: [PATCH 040/102] XmlReporter enhancement: Add attributes for duration when requested by the command line. --- include/reporters/catch_reporter_xml.hpp | 25 ++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/include/reporters/catch_reporter_xml.hpp b/include/reporters/catch_reporter_xml.hpp index 6b31107a..530bb3c5 100644 --- a/include/reporters/catch_reporter_xml.hpp +++ b/include/reporters/catch_reporter_xml.hpp @@ -13,6 +13,7 @@ #include "../internal/catch_capture.hpp" #include "../internal/catch_reporter_registrars.hpp" #include "../internal/catch_xmlwriter.hpp" +#include "../internal/catch_timer.h" namespace Catch { class XmlReporter : public StreamingReporterBase { @@ -56,6 +57,9 @@ namespace Catch { virtual void testCaseStarting( TestCaseInfo const& testInfo ) { StreamingReporterBase::testCaseStarting(testInfo); m_xml.startElement( "TestCase" ).writeAttribute( "name", trim( testInfo.name ) ); + + if ( m_config->showDurations() == ShowDurations::Always ) + m_testCaseTimer.start(); } virtual void sectionStarting( SectionInfo const& sectionInfo ) { @@ -143,18 +147,26 @@ namespace Catch { virtual void sectionEnded( SectionStats const& sectionStats ) { StreamingReporterBase::sectionEnded( sectionStats ); if( --m_sectionDepth > 0 ) { - m_xml.scopedElement( "OverallResults" ) - .writeAttribute( "successes", sectionStats.assertions.passed ) - .writeAttribute( "failures", sectionStats.assertions.failed ) - .writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk ); + XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); + e.writeAttribute( "successes", sectionStats.assertions.passed ); + e.writeAttribute( "failures", sectionStats.assertions.failed ); + e.writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk ); + + if ( m_config->showDurations() == ShowDurations::Always ) + e.writeAttribute( "durationInSeconds", sectionStats.durationInSeconds ); + m_xml.endElement(); } } virtual void testCaseEnded( TestCaseStats const& testCaseStats ) { StreamingReporterBase::testCaseEnded( testCaseStats ); - m_xml.scopedElement( "OverallResult" ) - .writeAttribute( "success", testCaseStats.totals.assertions.allPassed() ); + XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); + e.writeAttribute( "success", testCaseStats.totals.assertions.allPassed() ); + + if ( m_config->showDurations() == ShowDurations::Always ) + e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() ); + m_xml.endElement(); } @@ -178,6 +190,7 @@ namespace Catch { } private: + Timer m_testCaseTimer; XmlWriter m_xml; int m_sectionDepth; }; From 6e996956103a390046525a88487cbfe739625c45 Mon Sep 17 00:00:00 2001 From: "Sean D. Cline" Date: Sat, 11 Oct 2014 20:01:14 -0400 Subject: [PATCH 041/102] XmlReporter enhancement: Add an attribute for the macro name of an expression. --- include/reporters/catch_reporter_xml.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/reporters/catch_reporter_xml.hpp b/include/reporters/catch_reporter_xml.hpp index 530bb3c5..1b7c0199 100644 --- a/include/reporters/catch_reporter_xml.hpp +++ b/include/reporters/catch_reporter_xml.hpp @@ -99,6 +99,7 @@ namespace Catch { if( assertionResult.hasExpression() ) { m_xml.startElement( "Expression" ) .writeAttribute( "success", assertionResult.succeeded() ) + .writeAttribute( "type", assertionResult.getTestMacroName() ) .writeAttribute( "filename", assertionResult.getSourceInfo().file ) .writeAttribute( "line", assertionResult.getSourceInfo().line ); From bde3567f3ec079b29a0c2ed24c4e385008e3b36f Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 21 Oct 2014 07:24:30 +0100 Subject: [PATCH 042/102] Cleaned up terminal colouring impl and added more config options --- include/internal/catch_console_colour.hpp | 5 - .../internal/catch_console_colour_impl.hpp | 96 +++++++++++-------- include/internal/catch_fatal_condition.hpp | 4 +- 3 files changed, 57 insertions(+), 48 deletions(-) diff --git a/include/internal/catch_console_colour.hpp b/include/internal/catch_console_colour.hpp index 4caed07c..f0a8a697 100644 --- a/include/internal/catch_console_colour.hpp +++ b/include/internal/catch_console_colour.hpp @@ -12,10 +12,6 @@ namespace Catch { - namespace Detail { - struct IColourImpl; - } - struct Colour { enum Code { None = 0, @@ -61,7 +57,6 @@ namespace Catch { static void use( Code _colourCode ); private: - static Detail::IColourImpl* impl(); bool m_moved; }; diff --git a/include/internal/catch_console_colour_impl.hpp b/include/internal/catch_console_colour_impl.hpp index 3920a98a..a62550bd 100644 --- a/include/internal/catch_console_colour_impl.hpp +++ b/include/internal/catch_console_colour_impl.hpp @@ -10,14 +10,36 @@ #include "catch_console_colour.hpp" -namespace Catch { namespace Detail { - struct IColourImpl { - virtual ~IColourImpl() {} - virtual void use( Colour::Code _colourCode ) = 0; - }; -}} +namespace Catch { + namespace { -#if defined ( CATCH_PLATFORM_WINDOWS ) ///////////////////////////////////////// + struct IColourImpl { + virtual ~IColourImpl() {} + virtual void use( Colour::Code _colourCode ) = 0; + }; + + struct NoColourImpl : IColourImpl { + void use( Colour::Code ) {} + + static IColourImpl* instance() { + static NoColourImpl s_instance; + return &s_instance; + } + }; + + } // anon namespace +} // namespace Catch + +#if !defined( CATCH_CONFIG_COLOUR_NONE ) && !defined( CATCH_CONFIG_COLOUR_WINDOWS ) && !defined( CATCH_CONFIG_COLOUR_ANSI ) +# ifdef CATCH_PLATFORM_WINDOWS +# define CATCH_CONFIG_COLOUR_WINDOWS +# else +# define CATCH_CONFIG_COLOUR_ANSI +# endif +#endif + + +#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) ///////////////////////////////////////// #ifndef NOMINMAX #define NOMINMAX @@ -32,7 +54,7 @@ namespace Catch { namespace Detail { namespace Catch { namespace { - class Win32ColourImpl : public Detail::IColourImpl { + class Win32ColourImpl : public IColourImpl { public: Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) ) { @@ -69,11 +91,7 @@ namespace { WORD originalAttributes; }; - inline bool shouldUseColourForPlatform() { - return true; - } - - static Detail::IColourImpl* platformColourInstance() { + IColourImpl* platformColourInstance() { static Win32ColourImpl s_instance; return &s_instance; } @@ -81,7 +99,7 @@ namespace { } // end anon namespace } // end namespace Catch -#else // Not Windows - assumed to be POSIX compatible ////////////////////////// +#elif defined( CATCH_CONFIG_COLOUR_ANSI ) ////////////////////////////////////// #include @@ -92,7 +110,7 @@ namespace { // Thanks to Adam Strzelecki for original contribution // (http://github.com/nanoant) // https://github.com/philsquared/Catch/pull/131 - class PosixColourImpl : public Detail::IColourImpl { + class PosixColourImpl : public IColourImpl { public: virtual void use( Colour::Code _colourCode ) { switch( _colourCode ) { @@ -113,53 +131,47 @@ namespace { case Colour::Bright: throw std::logic_error( "not a colour" ); } } + static IColourImpl* instance() { + static PosixColourImpl s_instance; + return &s_instance; + } + private: void setColour( const char* _escapeCode ) { Catch::cout() << '\033' << _escapeCode; } }; - inline bool shouldUseColourForPlatform() { - return isatty(STDOUT_FILENO); - } - - static Detail::IColourImpl* platformColourInstance() { - static PosixColourImpl s_instance; - return &s_instance; + IColourImpl* platformColourInstance() { + return isatty(STDOUT_FILENO) + ? PosixColourImpl::instance() + : NoColourImpl::instance(); } } // end anon namespace } // end namespace Catch -#endif // not Windows +#else // not Windows or ANSI /////////////////////////////////////////////// namespace Catch { - namespace { - struct NoColourImpl : Detail::IColourImpl { - void use( Colour::Code ) {} + static IColourImpl* platformColourInstance() { return NoColourImpl::instance(); } - static IColourImpl* instance() { - static NoColourImpl s_instance; - return &s_instance; - } - }; - static bool shouldUseColour() { - return shouldUseColourForPlatform() && !isDebuggerActive(); - } - } +} // end namespace Catch + +#endif // Windows/ ANSI/ None + +namespace Catch { Colour::Colour( Code _colourCode ) : m_moved( false ) { use( _colourCode ); } Colour::Colour( Colour const& _other ) : m_moved( false ) { const_cast( _other ).m_moved = true; } Colour::~Colour(){ if( !m_moved ) use( None ); } - void Colour::use( Code _colourCode ) { - impl()->use( _colourCode ); - } - Detail::IColourImpl* Colour::impl() { - return shouldUseColour() - ? platformColourInstance() - : NoColourImpl::instance(); + void Colour::use( Code _colourCode ) { + static IColourImpl* impl = isDebuggerActive() + ? NoColourImpl::instance() + : platformColourInstance(); + impl->use( _colourCode ); } } // end namespace Catch diff --git a/include/internal/catch_fatal_condition.hpp b/include/internal/catch_fatal_condition.hpp index 4433dfed..dd21d590 100644 --- a/include/internal/catch_fatal_condition.hpp +++ b/include/internal/catch_fatal_condition.hpp @@ -28,7 +28,9 @@ namespace Catch { namespace Catch { - struct FatalConditionHandler {}; + struct FatalConditionHandler { + void reset() {} + }; } // namespace Catch From e54ac70671f247a1a14adde729d42649b00c999e Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 21 Oct 2014 07:25:26 +0100 Subject: [PATCH 043/102] build 7 --- README.md | 2 +- include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 135 +++++++++++++++-------------- 3 files changed, 73 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index b122f69a..b596723a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![catch logo](catch-logo-small.png) -*v1.1 build 6 (develop branch)* +*v1.1 build 7 (develop branch)* Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index 1ca0c291..1d7a6434 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -13,7 +13,7 @@ namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 6, "develop" ); + Version libraryVersion( 1, 1, 7, "develop" ); } #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 6a80971b..c17d850e 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * CATCH v1.1 build 6 (develop branch) - * Generated: 2014-10-02 19:13:03.375275 + * CATCH v1.1 build 7 (develop branch) + * Generated: 2014-10-21 07:24:45.439607 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -180,8 +180,16 @@ namespace Catch { class NonCopyable { - NonCopyable( NonCopyable const& ); - void operator = ( NonCopyable const& ); +#ifdef CATCH_CPP11_OR_GREATER + NonCopyable( NonCopyable const& ) = delete; + NonCopyable( NonCopyable && ) = delete; + NonCopyable& operator = ( NonCopyable const& ) = delete; + NonCopyable& operator = ( NonCopyable && ) = delete; +#else + NonCopyable( NonCopyable const& info ); + NonCopyable& operator = ( NonCopyable const& ); +#endif + protected: NonCopyable() {} virtual ~NonCopyable(); @@ -1747,7 +1755,7 @@ namespace Catch { namespace Catch { - class Section { + class Section : NonCopyable { public: Section( SectionInfo const& info ); ~Section(); @@ -1756,15 +1764,6 @@ namespace Catch { operator bool() const; private: -#ifdef CATCH_CPP11_OR_GREATER - Section( Section const& ) = delete; - Section( Section && ) = delete; - Section& operator = ( Section const& ) = delete; - Section& operator = ( Section && ) = delete; -#else - Section( Section const& info ); - Section& operator = ( Section const& ); -#endif SectionInfo m_info; std::string m_name; @@ -4404,10 +4403,6 @@ namespace Catch { namespace Catch { - namespace Detail { - struct IColourImpl; - } - struct Colour { enum Code { None = 0, @@ -4453,7 +4448,6 @@ namespace Catch { static void use( Code _colourCode ); private: - static Detail::IColourImpl* impl(); bool m_moved; }; @@ -5027,7 +5021,9 @@ namespace Catch { namespace Catch { - struct FatalConditionHandler {}; + struct FatalConditionHandler { + void reset() {} + }; } // namespace Catch @@ -5522,7 +5518,7 @@ namespace Catch { std::set m_testsAlreadyRun; }; - class Session { + class Session : NonCopyable { static bool alreadyInstantiated; public: @@ -6169,14 +6165,35 @@ namespace Catch { // #included from: catch_console_colour_impl.hpp #define TWOBLUECUBES_CATCH_CONSOLE_COLOUR_IMPL_HPP_INCLUDED -namespace Catch { namespace Detail { - struct IColourImpl { - virtual ~IColourImpl() {} - virtual void use( Colour::Code _colourCode ) = 0; - }; -}} +namespace Catch { + namespace { -#if defined ( CATCH_PLATFORM_WINDOWS ) ///////////////////////////////////////// + struct IColourImpl { + virtual ~IColourImpl() {} + virtual void use( Colour::Code _colourCode ) = 0; + }; + + struct NoColourImpl : IColourImpl { + void use( Colour::Code ) {} + + static IColourImpl* instance() { + static NoColourImpl s_instance; + return &s_instance; + } + }; + + } // anon namespace +} // namespace Catch + +#if !defined( CATCH_CONFIG_COLOUR_NONE ) && !defined( CATCH_CONFIG_COLOUR_WINDOWS ) && !defined( CATCH_CONFIG_COLOUR_ANSI ) +# ifdef CATCH_PLATFORM_WINDOWS +# define CATCH_CONFIG_COLOUR_WINDOWS +# else +# define CATCH_CONFIG_COLOUR_ANSI +# endif +#endif + +#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) ///////////////////////////////////////// #ifndef NOMINMAX #define NOMINMAX @@ -6191,7 +6208,7 @@ namespace Catch { namespace Detail { namespace Catch { namespace { - class Win32ColourImpl : public Detail::IColourImpl { + class Win32ColourImpl : public IColourImpl { public: Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) ) { @@ -6228,11 +6245,7 @@ namespace { WORD originalAttributes; }; - inline bool shouldUseColourForPlatform() { - return true; - } - - static Detail::IColourImpl* platformColourInstance() { + IColourImpl* platformColourInstance() { static Win32ColourImpl s_instance; return &s_instance; } @@ -6240,7 +6253,7 @@ namespace { } // end anon namespace } // end namespace Catch -#else // Not Windows - assumed to be POSIX compatible ////////////////////////// +#elif defined( CATCH_CONFIG_COLOUR_ANSI ) ////////////////////////////////////// #include @@ -6251,7 +6264,7 @@ namespace { // Thanks to Adam Strzelecki for original contribution // (http://github.com/nanoant) // https://github.com/philsquared/Catch/pull/131 - class PosixColourImpl : public Detail::IColourImpl { + class PosixColourImpl : public IColourImpl { public: virtual void use( Colour::Code _colourCode ) { switch( _colourCode ) { @@ -6272,53 +6285,47 @@ namespace { case Colour::Bright: throw std::logic_error( "not a colour" ); } } + static IColourImpl* instance() { + static PosixColourImpl s_instance; + return &s_instance; + } + private: void setColour( const char* _escapeCode ) { Catch::cout() << '\033' << _escapeCode; } }; - inline bool shouldUseColourForPlatform() { - return isatty(STDOUT_FILENO); - } - - static Detail::IColourImpl* platformColourInstance() { - static PosixColourImpl s_instance; - return &s_instance; + IColourImpl* platformColourInstance() { + return isatty(STDOUT_FILENO) + ? PosixColourImpl::instance() + : NoColourImpl::instance(); } } // end anon namespace } // end namespace Catch -#endif // not Windows +#else // not Windows or ANSI /////////////////////////////////////////////// namespace Catch { - namespace { - struct NoColourImpl : Detail::IColourImpl { - void use( Colour::Code ) {} + static IColourImpl* platformColourInstance() { return NoColourImpl::instance(); } - static IColourImpl* instance() { - static NoColourImpl s_instance; - return &s_instance; - } - }; - static bool shouldUseColour() { - return shouldUseColourForPlatform() && !isDebuggerActive(); - } - } +} // end namespace Catch + +#endif // Windows/ ANSI/ None + +namespace Catch { Colour::Colour( Code _colourCode ) : m_moved( false ) { use( _colourCode ); } Colour::Colour( Colour const& _other ) : m_moved( false ) { const_cast( _other ).m_moved = true; } Colour::~Colour(){ if( !m_moved ) use( None ); } - void Colour::use( Code _colourCode ) { - impl()->use( _colourCode ); - } - Detail::IColourImpl* Colour::impl() { - return shouldUseColour() - ? platformColourInstance() - : NoColourImpl::instance(); + void Colour::use( Code _colourCode ) { + static IColourImpl* impl = isDebuggerActive() + ? NoColourImpl::instance() + : platformColourInstance(); + impl->use( _colourCode ); } } // end namespace Catch @@ -6662,7 +6669,7 @@ namespace Catch { namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 6, "develop" ); + Version libraryVersion( 1, 1, 7, "develop" ); } // #included from: catch_message.hpp From 32186db1b03b0992efd7228a121a16cf2119d8e4 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 21 Oct 2014 18:25:57 +0100 Subject: [PATCH 044/102] Added first cut of docs for configuring Catch - initially just covers new colour config - also updated all [Home] links in footers to go to local readme --- docs/Readme.md | 6 +----- docs/assertions.md | 2 +- docs/build-systems.md | 4 ++++ docs/command-line.md | 2 +- docs/configuration.md | 23 +++++++++++++++++++++++ docs/contributing.md | 2 +- docs/logging.md | 2 +- docs/own-main.md | 2 +- docs/slow-compiles.md | 2 +- docs/test-cases-and-sections.md | 2 +- docs/test-fixtures.md | 2 +- docs/tutorial.md | 2 +- docs/whats-changed.md | 2 +- docs/why-catch.md | 2 +- 14 files changed, 39 insertions(+), 16 deletions(-) create mode 100644 docs/configuration.md diff --git a/docs/Readme.md b/docs/Readme.md index 45350f9a..38b22a58 100644 --- a/docs/Readme.md +++ b/docs/Readme.md @@ -9,6 +9,7 @@ Before looking at this material be sure to read the [tutorial](tutorial.md) * [Command line](command-line.md) * [Build systems](build-systems.md) * [Supplying your own main()](own-main.md) +* [Configuration](configuration.md) * [Why are my tests slow to compile?](slow-compiles.md) Other @@ -16,8 +17,3 @@ Other * [Why Catch?](why-catch.md) * [What's changed](whats-changed.md) * [Contributing](contributing.md) - ---- - -[Home](../README.md) - diff --git a/docs/assertions.md b/docs/assertions.md index 47826b04..5e839989 100644 --- a/docs/assertions.md +++ b/docs/assertions.md @@ -61,4 +61,4 @@ To support Matchers a slightly different form is used. Matchers will be more ful --- -[Home](../README.md) +[Home](Readme.md) \ No newline at end of file diff --git a/docs/build-systems.md b/docs/build-systems.md index 1cb93c87..335b2062 100644 --- a/docs/build-systems.md +++ b/docs/build-systems.md @@ -35,3 +35,7 @@ add_subdirectory(${EXT_PROJECTS_DIR}/catch) include_directories(${CATCH_INCLUDE_DIR} ${COMMON_INCLUDES}) enable_testing(true) # Enables unit-testing. ``` + +--- + +[Home](Readme.md) \ No newline at end of file diff --git a/docs/command-line.md b/docs/command-line.md index f534d858..d390bf39 100644 --- a/docs/command-line.md +++ b/docs/command-line.md @@ -153,4 +153,4 @@ Prints the command line arguments to stdout --- -[Home](../README.md) +[Home](Readme.md) \ No newline at end of file diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 00000000..185eb440 --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,23 @@ +Catch is designed to "just work" as much as possible. For most people the only configuration needed is telling Catch which source file should host all the implementation code (```CATCH_CONFIG_MAIN```). + +Nonetheless there are still some occasions where finer control is needed. For these occasions Catch exposes a small set of macros for configuring how it is built. + +# Terminal colour + +Yes, I am English, so I will continue to spell "colour" with a 'u'. + +When sending output to the terminal, if it detects that it can, Catch will use colourised text. On Windows the Win32 API, ```SetConsoleTextAttribute```, is used. On POSIX systems ANSI colour escape codes are inserted into the stream. + +For finer control you can define one of the following identifiers (these are mutually exclusive - but that is not checked so may behave unexpectedly if you mix them): + + CATCH_CONFIG_COLOUR_NONE // completely disables all text colouring + CATCH_CONFIG_COLOUR_WINDOWS // forces the Win32 console API to be used + CATCH_CONFIG_COLOUR_ANSI // forces ANSI colour codes to be used + +Note that when ANSI colour codes are used "unistd.h" must be includable - along with a definition of ```isatty()``` + +Typically you should place the ```#define``` before #including "catch.hpp" in your main source file - but if you prefer you can define it for your whole project by whatever your IDE or build system provides for you to do so. + +--- + +[Home](Readme.md) \ No newline at end of file diff --git a/docs/contributing.md b/docs/contributing.md index 675f3190..5e228362 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -20,4 +20,4 @@ The other directories are ```scripts``` which contains a set of python scripts t --- -[Home](../README.md) \ No newline at end of file +[Home](Readme.md) \ No newline at end of file diff --git a/docs/logging.md b/docs/logging.md index 4be20c59..a659b3e8 100644 --- a/docs/logging.md +++ b/docs/logging.md @@ -49,4 +49,4 @@ These macros are now deprecated and are just aliases for INFO and CAPTURE (which --- -[Home](../README.md) \ No newline at end of file +[Home](Readme.md) \ No newline at end of file diff --git a/docs/own-main.md b/docs/own-main.md index 3feda563..f8c836e6 100644 --- a/docs/own-main.md +++ b/docs/own-main.md @@ -65,4 +65,4 @@ Catch embeds a powerful command line parser which you can also use to parse your --- -[Home](../README.md) \ No newline at end of file +[Home](Readme.md) \ No newline at end of file diff --git a/docs/slow-compiles.md b/docs/slow-compiles.md index 0673612c..5291aecc 100644 --- a/docs/slow-compiles.md +++ b/docs/slow-compiles.md @@ -19,4 +19,4 @@ As a result the main source file *does* compile the whole of Catch every time! S --- -[Home](../README.md) +[Home](Readme.md) \ No newline at end of file diff --git a/docs/test-cases-and-sections.md b/docs/test-cases-and-sections.md index 863d5faf..28426d78 100644 --- a/docs/test-cases-and-sections.md +++ b/docs/test-cases-and-sections.md @@ -57,4 +57,4 @@ Other than the additional prefixes and the formatting in the console reporter th --- -[Home](../README.md) \ No newline at end of file +[Home](Readme.md) \ No newline at end of file diff --git a/docs/test-fixtures.md b/docs/test-fixtures.md index 769f8a37..6bef762b 100644 --- a/docs/test-fixtures.md +++ b/docs/test-fixtures.md @@ -29,4 +29,4 @@ The two test cases here will create uniquely-named derived classes of UniqueTest --- -[Home](../README.md) \ No newline at end of file +[Home](Readme.md) \ No newline at end of file diff --git a/docs/tutorial.md b/docs/tutorial.md index a2555f74..1534132a 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -225,4 +225,4 @@ For more specific information see the [Reference pages](Readme.md) --- -[Home](../README.md) +[Home](Readme.md) \ No newline at end of file diff --git a/docs/whats-changed.md b/docs/whats-changed.md index 40b95a6d..10a1bbc5 100644 --- a/docs/whats-changed.md +++ b/docs/whats-changed.md @@ -21,4 +21,4 @@ If you find any issues please raise issue tickets on the [issue tracker on GitHu --- -[Home](../README.md) +[Home](Readme.md) \ No newline at end of file diff --git a/docs/why-catch.md b/docs/why-catch.md index d90ee012..93488d22 100644 --- a/docs/why-catch.md +++ b/docs/why-catch.md @@ -39,4 +39,4 @@ See the [tutorial](tutorial.md) to get more of a taste of using CATCH in practic --- -[Home](../README.md) \ No newline at end of file +[Home](Readme.md) \ No newline at end of file From b0545d1f12b5b316d823393060f68c06a320b9b1 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 9 Dec 2014 18:49:58 +0000 Subject: [PATCH 045/102] Some toString cleanups --- include/internal/catch_approx.hpp | 3 +-- include/internal/catch_exception_translator_registry.hpp | 2 +- include/internal/catch_tostring.h | 7 +++---- include/internal/catch_tostring.hpp | 4 ++-- include/reporters/catch_reporter_junit.hpp | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/internal/catch_approx.hpp b/include/internal/catch_approx.hpp index f5dba61a..8b075515 100644 --- a/include/internal/catch_approx.hpp +++ b/include/internal/catch_approx.hpp @@ -81,8 +81,7 @@ namespace Detail { }; } -template<> -inline std::string toString( Detail::Approx const& value ) { +inline std::string toString( Detail::Approx const& value ) { return value.toString(); } diff --git a/include/internal/catch_exception_translator_registry.hpp b/include/internal/catch_exception_translator_registry.hpp index a1cc7050..29ddf8e7 100644 --- a/include/internal/catch_exception_translator_registry.hpp +++ b/include/internal/catch_exception_translator_registry.hpp @@ -35,7 +35,7 @@ namespace Catch { throw; } @catch (NSException *exception) { - return toString( [exception description] ); + return Catch::toString( [exception description] ); } #else throw; diff --git a/include/internal/catch_tostring.h b/include/internal/catch_tostring.h index 674533ff..1c30b203 100644 --- a/include/internal/catch_tostring.h +++ b/include/internal/catch_tostring.h @@ -219,10 +219,9 @@ std::string toString( std::nullptr_t ); std::ostringstream oss; oss << "{ "; if( first != last ) { - oss << toString( *first ); - for( ++first ; first != last ; ++first ) { - oss << ", " << toString( *first ); - } + oss << Catch::toString( *first ); + for( ++first ; first != last ; ++first ) + oss << ", " << Catch::toString( *first ); } oss << " }"; return oss.str(); diff --git a/include/internal/catch_tostring.hpp b/include/internal/catch_tostring.hpp index 9b234b18..21ee45f7 100644 --- a/include/internal/catch_tostring.hpp +++ b/include/internal/catch_tostring.hpp @@ -75,7 +75,7 @@ std::string toString( std::wstring const& value ) { s.reserve( value.size() ); for(size_t i = 0; i < value.size(); ++i ) s += value[i] <= 0xff ? static_cast( value[i] ) : '?'; - return toString( s ); + return Catch::toString( s ); } std::string toString( const char* const value ) { @@ -112,7 +112,7 @@ std::string toString( unsigned long value ) { } std::string toString( unsigned int value ) { - return toString( static_cast( value ) ); + return Catch::toString( static_cast( value ) ); } template diff --git a/include/reporters/catch_reporter_junit.hpp b/include/reporters/catch_reporter_junit.hpp index 1108794b..f9524aaf 100644 --- a/include/reporters/catch_reporter_junit.hpp +++ b/include/reporters/catch_reporter_junit.hpp @@ -135,7 +135,7 @@ namespace Catch { xml.writeAttribute( "classname", className ); xml.writeAttribute( "name", name ); } - xml.writeAttribute( "time", toString( sectionNode.stats.durationInSeconds ) ); + xml.writeAttribute( "time", Catch::toString( sectionNode.stats.durationInSeconds ) ); writeAssertions( sectionNode ); From 27ce70c96be93c9b7b88b648958044410098db89 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 9 Dec 2014 18:54:35 +0000 Subject: [PATCH 046/102] Added documentation for toString --- docs/tostring.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 docs/tostring.md diff --git a/docs/tostring.md b/docs/tostring.md new file mode 100644 index 00000000..b9766494 --- /dev/null +++ b/docs/tostring.md @@ -0,0 +1,41 @@ +# String conversions + +Catch needs to be able to convert types you use in assertions and logging expressions into strings (for logging and reporting purposes). +Most built-in or std types are supported out of the box but there are two ways that you can tell Catch how to convert your own types (or other, third-party types) into strings. + +## operator << overload for std::ostream + +This is the standard way of providing string conversions in C++ - and the chances are you may already provide this for your own purposes. If you're not familiar with this idiom it involves writing a free function of the form: + +```std::ostream& operator << ( std::ostream& os, T const& value ) { + os << convertMyTypeToString( value ); + return os; +}``` + +(where ```T``` is your type and ```convertMyTypeToString``` is where you'll write whatever code is necessary to make your type printable - it doesn't have to be in another function). + +You should put this function in the same namespace as your type. + +Alternatively you may prefer to write it as a member function: + +```std::ostream& T::operator << ( std::ostream& os ) const { + os << convertMyTypeToString( *this ); + return os; +}``` + +## Catch::toString overload + +If you don't want to provide an ```operator <<``` overload, or you want to convert your type differently for testing purposes, you can provide an overload for ```Catch::toString()``` for your type. + +```namespace Catch { + std::string toString( T const& value ) { + return convertMyTypeToString( value ); + } +} +}``` + +Again ```T``` is your type and ```convertMyTypeToString``` is where you'll write whatever code is necessary to make your type printable. Note that the function must be in the Catch namespace, which itself must be in the global namespace. + +--- + +[Home](Readme.md) From 94ab8f64a29d1885083357d029698c33cf29d145 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 9 Dec 2014 18:59:06 +0000 Subject: [PATCH 047/102] Updated README with direct download link --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index b596723a..fb4b3f35 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/C Catch stands for C++ Automated Test Cases in Headers and is a multi-paradigm automated test framework for C++ and Objective-C (and, maybe, C). It is implemented entirely in a set of header files, but is packaged up as a single header for extra convenience. +The latest, single header, version can be downloaded directly from this link: + +Right click and select to download the file linked here + ## How to use it This documentation comprises these three parts: From e8f704c76868aa004426cc08a5b05b4aa02e55bf Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 9 Dec 2014 19:04:17 +0000 Subject: [PATCH 048/102] Absolute path to single direct download --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fb4b3f35..d8f0d1eb 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Catch stands for C++ Automated Test Cases in Headers and is a multi-paradigm aut The latest, single header, version can be downloaded directly from this link: -Right click and select to download the file linked here +Right click and select to download the file linked here ## How to use it This documentation comprises these three parts: From 93da743932828fd5f83affe9f93baa9e809b7884 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 9 Dec 2014 19:06:22 +0000 Subject: [PATCH 049/102] tweaked download link text --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index d8f0d1eb..7459251d 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,7 @@ Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/C Catch stands for C++ Automated Test Cases in Headers and is a multi-paradigm automated test framework for C++ and Objective-C (and, maybe, C). It is implemented entirely in a set of header files, but is packaged up as a single header for extra convenience. -The latest, single header, version can be downloaded directly from this link: - -Right click and select to download the file linked here +[The latest, single header, version can be downloaded directly using this link] ## How to use it This documentation comprises these three parts: From d8e3c1f6e391a5de08f5577622611d00799e0591 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 9 Dec 2014 19:07:48 +0000 Subject: [PATCH 050/102] Last tweak to download text - honest --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7459251d..fead10b5 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,12 @@ Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/C [Please see this page if you are updating from a version before 1.0](docs/whats-changed.md) +[The latest, single header, version can be downloaded directly using this link] + ## What's the Catch? Catch stands for C++ Automated Test Cases in Headers and is a multi-paradigm automated test framework for C++ and Objective-C (and, maybe, C). It is implemented entirely in a set of header files, but is packaged up as a single header for extra convenience. -[The latest, single header, version can be downloaded directly using this link] - ## How to use it This documentation comprises these three parts: From 15a8bdf45b3f3f21f86c318586e6dee8c0be65c0 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 9 Dec 2014 19:15:49 +0000 Subject: [PATCH 051/102] Added string conversions link --- docs/Readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Readme.md b/docs/Readme.md index 38b22a58..16a8a3e8 100644 --- a/docs/Readme.md +++ b/docs/Readme.md @@ -10,6 +10,7 @@ Before looking at this material be sure to read the [tutorial](tutorial.md) * [Build systems](build-systems.md) * [Supplying your own main()](own-main.md) * [Configuration](configuration.md) +* [String Conversions](toString.md) * [Why are my tests slow to compile?](slow-compiles.md) Other From c6d9bde04e054c2094a03d6dab914ed0f5a44307 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 9 Dec 2014 22:58:28 +0000 Subject: [PATCH 052/102] fixed case of tostring.md link --- docs/Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Readme.md b/docs/Readme.md index 16a8a3e8..74b876de 100644 --- a/docs/Readme.md +++ b/docs/Readme.md @@ -10,7 +10,7 @@ Before looking at this material be sure to read the [tutorial](tutorial.md) * [Build systems](build-systems.md) * [Supplying your own main()](own-main.md) * [Configuration](configuration.md) -* [String Conversions](toString.md) +* [String Conversions](tostring.md) * [Why are my tests slow to compile?](slow-compiles.md) Other From a99e75b928684e1442661e9a8a5ec458770042e2 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 11 Dec 2014 23:40:29 +0000 Subject: [PATCH 053/102] Made approvals more platform agnostic removes root from all paths - so only relative paths remain --- .../SelfTest/Baselines/xml.sw.approved.txt | 1460 ++++++++--------- scripts/approvalTests.py | 25 +- 2 files changed, 747 insertions(+), 738 deletions(-) diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 200c28f7..9a273fb6 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -1,7 +1,7 @@ - + Catch::toString(e0) == "0" @@ -9,7 +9,7 @@ "0" == "0" - + Catch::toString(e1) == "1" @@ -20,7 +20,7 @@ - + Catch::toString(e0) == "E2{0}" @@ -28,7 +28,7 @@ "E2{0}" == "E2{0}" - + Catch::toString(e1) == "E2{1}" @@ -39,7 +39,7 @@ - + Catch::toString(e0) == "0" @@ -47,7 +47,7 @@ "0" == "0" - + Catch::toString(e1) == "1" @@ -58,7 +58,7 @@ - + Catch::toString(e0) == "E2/V0" @@ -66,7 +66,7 @@ "E2/V0" == "E2/V0" - + Catch::toString(e1) == "E2/V1" @@ -74,7 +74,7 @@ "E2/V1" == "E2/V1" - + Catch::toString(e3) == "Unknown enum value 10" @@ -87,7 +87,7 @@ - + d == Approx( 1.23 ) @@ -95,7 +95,7 @@ 1.23 == Approx( 1.23 ) - + d != Approx( 1.22 ) @@ -103,7 +103,7 @@ 1.23 != Approx( 1.22 ) - + d != Approx( 1.24 ) @@ -111,7 +111,7 @@ 1.23 != Approx( 1.24 ) - + Approx( d ) == 1.23 @@ -119,7 +119,7 @@ Approx( 1.23 ) == 1.23 - + Approx( d ) != 1.22 @@ -127,7 +127,7 @@ Approx( 1.23 ) != 1.22 - + Approx( d ) != 1.24 @@ -138,7 +138,7 @@ - + d != Approx( 1.231 ) @@ -146,7 +146,7 @@ 1.23 != Approx( 1.231 ) - + d == Approx( 1.231 ).epsilon( 0.1 ) @@ -157,7 +157,7 @@ - + 1.23f == Approx( 1.23f ) @@ -165,7 +165,7 @@ 1.23f == Approx( 1.2300000191 ) - + 0.0f == Approx( 0.0f ) @@ -176,7 +176,7 @@ - + 1 == Approx( 1 ) @@ -184,7 +184,7 @@ 1 == Approx( 1.0 ) - + 0 == Approx( 0 ) @@ -195,7 +195,7 @@ - + 1.0f == Approx( 1 ) @@ -203,7 +203,7 @@ 1.0f == Approx( 1.0 ) - + 0 == Approx( dZero) @@ -211,7 +211,7 @@ 0 == Approx( 0.0 ) - + 0 == Approx( dSmall ).epsilon( 0.001 ) @@ -219,7 +219,7 @@ 0 == Approx( 0.00001 ) - + 1.234f == Approx( dMedium ) @@ -227,7 +227,7 @@ 1.234f == Approx( 1.234 ) - + dMedium == Approx( 1.234f ) @@ -238,7 +238,7 @@ - + d == approx( 1.23 ) @@ -246,7 +246,7 @@ 1.23 == Approx( 1.23 ) - + d == approx( 1.22 ) @@ -254,7 +254,7 @@ 1.23 == Approx( 1.22 ) - + d == approx( 1.24 ) @@ -262,7 +262,7 @@ 1.23 == Approx( 1.24 ) - + d != approx( 1.25 ) @@ -270,7 +270,7 @@ 1.23 != Approx( 1.25 ) - + approx( d ) == 1.23 @@ -278,7 +278,7 @@ Approx( 1.23 ) == 1.23 - + approx( d ) == 1.22 @@ -286,7 +286,7 @@ Approx( 1.23 ) == 1.22 - + approx( d ) == 1.24 @@ -294,7 +294,7 @@ Approx( 1.23 ) == 1.24 - + approx( d ) != 1.25 @@ -305,7 +305,7 @@ - + divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) @@ -313,7 +313,7 @@ 3.1428571429 == Approx( 3.141 ) - + divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) @@ -324,7 +324,7 @@ - + s == "hello" @@ -335,7 +335,7 @@ - + s == "world" @@ -346,7 +346,7 @@ - + m_a == 1 @@ -357,7 +357,7 @@ - + m_a == 2 @@ -368,7 +368,7 @@ - + data.int_seven == 7 @@ -376,7 +376,7 @@ 7 == 7 - + data.float_nine_point_one == Approx( 9.1f ) @@ -384,7 +384,7 @@ 9.1f == Approx( 9.1000003815 ) - + data.double_pi == Approx( 3.1415926535 ) @@ -392,7 +392,7 @@ 3.1415926535 == Approx( 3.1415926535 ) - + data.str_hello == "hello" @@ -400,7 +400,7 @@ "hello" == "hello" - + "hello" == data.str_hello @@ -408,7 +408,7 @@ "hello" == "hello" - + data.str_hello.size() == 5 @@ -416,7 +416,7 @@ 5 == 5 - + x == Approx( 1.3 ) @@ -427,7 +427,7 @@ - + data.int_seven == 6 @@ -435,7 +435,7 @@ 7 == 6 - + data.int_seven == 8 @@ -443,7 +443,7 @@ 7 == 8 - + data.int_seven == 0 @@ -451,7 +451,7 @@ 7 == 0 - + data.float_nine_point_one == Approx( 9.11f ) @@ -459,7 +459,7 @@ 9.1f == Approx( 9.1099996567 ) - + data.float_nine_point_one == Approx( 9.0f ) @@ -467,7 +467,7 @@ 9.1f == Approx( 9.0 ) - + data.float_nine_point_one == Approx( 1 ) @@ -475,7 +475,7 @@ 9.1f == Approx( 1.0 ) - + data.float_nine_point_one == Approx( 0 ) @@ -483,7 +483,7 @@ 9.1f == Approx( 0.0 ) - + data.double_pi == Approx( 3.1415 ) @@ -491,7 +491,7 @@ 3.1415926535 == Approx( 3.1415 ) - + data.str_hello == "goodbye" @@ -499,7 +499,7 @@ "hello" == "goodbye" - + data.str_hello == "hell" @@ -507,7 +507,7 @@ "hello" == "hell" - + data.str_hello == "hello1" @@ -515,7 +515,7 @@ "hello" == "hello1" - + data.str_hello.size() == 6 @@ -523,7 +523,7 @@ 5 == 6 - + x == Approx( 1.301 ) @@ -534,7 +534,7 @@ - + data.int_seven != 6 @@ -542,7 +542,7 @@ 7 != 6 - + data.int_seven != 8 @@ -550,7 +550,7 @@ 7 != 8 - + data.float_nine_point_one != Approx( 9.11f ) @@ -558,7 +558,7 @@ 9.1f != Approx( 9.1099996567 ) - + data.float_nine_point_one != Approx( 9.0f ) @@ -566,7 +566,7 @@ 9.1f != Approx( 9.0 ) - + data.float_nine_point_one != Approx( 1 ) @@ -574,7 +574,7 @@ 9.1f != Approx( 1.0 ) - + data.float_nine_point_one != Approx( 0 ) @@ -582,7 +582,7 @@ 9.1f != Approx( 0.0 ) - + data.double_pi != Approx( 3.1415 ) @@ -590,7 +590,7 @@ 3.1415926535 != Approx( 3.1415 ) - + data.str_hello != "goodbye" @@ -598,7 +598,7 @@ "hello" != "goodbye" - + data.str_hello != "hell" @@ -606,7 +606,7 @@ "hello" != "hell" - + data.str_hello != "hello1" @@ -614,7 +614,7 @@ "hello" != "hello1" - + data.str_hello.size() != 6 @@ -625,7 +625,7 @@ - + data.int_seven != 7 @@ -633,7 +633,7 @@ 7 != 7 - + data.float_nine_point_one != Approx( 9.1f ) @@ -641,7 +641,7 @@ 9.1f != Approx( 9.1000003815 ) - + data.double_pi != Approx( 3.1415926535 ) @@ -649,7 +649,7 @@ 3.1415926535 != Approx( 3.1415926535 ) - + data.str_hello != "hello" @@ -657,7 +657,7 @@ "hello" != "hello" - + data.str_hello.size() != 5 @@ -668,7 +668,7 @@ - + data.int_seven < 8 @@ -676,7 +676,7 @@ 7 < 8 - + data.int_seven > 6 @@ -684,7 +684,7 @@ 7 > 6 - + data.int_seven > 0 @@ -692,7 +692,7 @@ 7 > 0 - + data.int_seven > -1 @@ -700,7 +700,7 @@ 7 > -1 - + data.int_seven >= 7 @@ -708,7 +708,7 @@ 7 >= 7 - + data.int_seven >= 6 @@ -716,7 +716,7 @@ 7 >= 6 - + data.int_seven <= 7 @@ -724,7 +724,7 @@ 7 <= 7 - + data.int_seven <= 8 @@ -732,7 +732,7 @@ 7 <= 8 - + data.float_nine_point_one > 9 @@ -740,7 +740,7 @@ 9.1f > 9 - + data.float_nine_point_one < 10 @@ -748,7 +748,7 @@ 9.1f < 10 - + data.float_nine_point_one < 9.2 @@ -756,7 +756,7 @@ 9.1f < 9.2 - + data.str_hello <= "hello" @@ -764,7 +764,7 @@ "hello" <= "hello" - + data.str_hello >= "hello" @@ -772,7 +772,7 @@ "hello" >= "hello" - + data.str_hello < "hellp" @@ -780,7 +780,7 @@ "hello" < "hellp" - + data.str_hello < "zebra" @@ -788,7 +788,7 @@ "hello" < "zebra" - + data.str_hello > "hellm" @@ -796,7 +796,7 @@ "hello" > "hellm" - + data.str_hello > "a" @@ -807,7 +807,7 @@ - + data.int_seven > 7 @@ -815,7 +815,7 @@ 7 > 7 - + data.int_seven < 7 @@ -823,7 +823,7 @@ 7 < 7 - + data.int_seven > 8 @@ -831,7 +831,7 @@ 7 > 8 - + data.int_seven < 6 @@ -839,7 +839,7 @@ 7 < 6 - + data.int_seven < 0 @@ -847,7 +847,7 @@ 7 < 0 - + data.int_seven < -1 @@ -855,7 +855,7 @@ 7 < -1 - + data.int_seven >= 8 @@ -863,7 +863,7 @@ 7 >= 8 - + data.int_seven <= 6 @@ -871,7 +871,7 @@ 7 <= 6 - + data.float_nine_point_one < 9 @@ -879,7 +879,7 @@ 9.1f < 9 - + data.float_nine_point_one > 10 @@ -887,7 +887,7 @@ 9.1f > 10 - + data.float_nine_point_one > 9.2 @@ -895,7 +895,7 @@ 9.1f > 9.2 - + data.str_hello > "hello" @@ -903,7 +903,7 @@ "hello" > "hello" - + data.str_hello < "hello" @@ -911,7 +911,7 @@ "hello" < "hello" - + data.str_hello > "hellp" @@ -919,7 +919,7 @@ "hello" > "hellp" - + data.str_hello > "z" @@ -927,7 +927,7 @@ "hello" > "z" - + data.str_hello < "hellm" @@ -935,7 +935,7 @@ "hello" < "hellm" - + data.str_hello < "a" @@ -943,7 +943,7 @@ "hello" < "a" - + data.str_hello >= "z" @@ -951,7 +951,7 @@ "hello" >= "z" - + data.str_hello <= "a" @@ -962,7 +962,7 @@ - + i == 1 @@ -970,7 +970,7 @@ 1 == 1 - + ui == 2 @@ -978,7 +978,7 @@ 2 == 2 - + l == 3 @@ -986,7 +986,7 @@ 3 == 3 - + ul == 4 @@ -994,7 +994,7 @@ 4 == 4 - + c == 5 @@ -1002,7 +1002,7 @@ 5 == 5 - + uc == 6 @@ -1010,7 +1010,7 @@ 6 == 6 - + 1 == i @@ -1018,7 +1018,7 @@ 1 == 1 - + 2 == ui @@ -1026,7 +1026,7 @@ 2 == 2 - + 3 == l @@ -1034,7 +1034,7 @@ 3 == 3 - + 4 == ul @@ -1042,7 +1042,7 @@ 4 == 4 - + 5 == c @@ -1050,7 +1050,7 @@ 5 == 5 - + 6 == uc @@ -1058,7 +1058,7 @@ 6 == 6 - + (std::numeric_limits<unsigned long>::max)() > ul @@ -1069,7 +1069,7 @@ - + long_var == unsigned_char_var @@ -1077,7 +1077,7 @@ 1 == 1 - + long_var == unsigned_short_var @@ -1085,7 +1085,7 @@ 1 == 1 - + long_var == unsigned_int_var @@ -1093,7 +1093,7 @@ 1 == 1 - + long_var == unsigned_long_var @@ -1104,7 +1104,7 @@ - + unsigned_char_var == 1 @@ -1112,7 +1112,7 @@ 1 == 1 - + unsigned_short_var == 1 @@ -1120,7 +1120,7 @@ 1 == 1 - + unsigned_int_var == 1 @@ -1128,7 +1128,7 @@ 1 == 1 - + unsigned_long_var == 1 @@ -1139,7 +1139,7 @@ - + ( -1 > 2u ) @@ -1147,7 +1147,7 @@ true - + -1 > 2u @@ -1155,7 +1155,7 @@ -1 > 2 - + ( 2u < -1 ) @@ -1163,7 +1163,7 @@ true - + 2u < -1 @@ -1171,7 +1171,7 @@ 2 < -1 - + ( minInt > 2u ) @@ -1179,7 +1179,7 @@ true - + minInt > 2u @@ -1190,7 +1190,7 @@ - + 54 == 6*9 @@ -1201,7 +1201,7 @@ - + p == __null @@ -1209,7 +1209,7 @@ __null == 0 - + p == pNULL @@ -1217,7 +1217,7 @@ __null == __null - + p != __null @@ -1225,7 +1225,7 @@ 0x != 0 - + cp != __null @@ -1233,7 +1233,7 @@ 0x != 0 - + cpc != __null @@ -1241,7 +1241,7 @@ 0x != 0 - + returnsNull() == __null @@ -1249,7 +1249,7 @@ {null string} == 0 - + returnsConstNull() == __null @@ -1257,7 +1257,7 @@ {null string} == 0 - + __null != p @@ -1268,7 +1268,7 @@ - + false == false @@ -1276,7 +1276,7 @@ false == false - + true == true @@ -1284,7 +1284,7 @@ true == true - + !false @@ -1292,7 +1292,7 @@ true - + !false @@ -1300,7 +1300,7 @@ !false - + !falseValue @@ -1308,7 +1308,7 @@ true - + !falseValue @@ -1316,7 +1316,7 @@ !false - + !(1 == 2) @@ -1324,7 +1324,7 @@ true - + !1 == 2 @@ -1335,7 +1335,7 @@ - + false != false @@ -1343,7 +1343,7 @@ false != false - + true != true @@ -1351,7 +1351,7 @@ true != true - + !true @@ -1359,7 +1359,7 @@ false - + !true @@ -1367,7 +1367,7 @@ !true - + !trueValue @@ -1375,7 +1375,7 @@ false - + !trueValue @@ -1383,7 +1383,7 @@ !true - + !(1 == 1) @@ -1391,7 +1391,7 @@ false - + !1 == 1 @@ -1402,7 +1402,7 @@ - + thisThrows() @@ -1410,7 +1410,7 @@ thisThrows() - + thisDoesntThrow() @@ -1418,7 +1418,7 @@ thisDoesntThrow() - + thisThrows() @@ -1429,18 +1429,18 @@ - + thisThrows() thisThrows() - + expected exception - + thisDoesntThrow() @@ -1448,27 +1448,27 @@ thisDoesntThrow() - + thisThrows() thisThrows() - + expected exception - + unexpected exception - + 1 == 1 @@ -1476,14 +1476,14 @@ 1 == 1 - + {Unknown expression after the reported line} {Unknown expression after the reported line} - + unexpected exception @@ -1491,7 +1491,7 @@
- + unexpected exception @@ -1499,42 +1499,42 @@ - + thisThrows() == 0 thisThrows() == 0 - + expected exception - + thisThrows() == 0 thisThrows() == 0 - + expected exception - + thisThrows() == 0 thisThrows() == 0 - + expected exception @@ -1544,47 +1544,47 @@ - + custom exception - + throwCustom() throwCustom() - + custom exception - not std - + throwCustom() throwCustom() - + custom exception - not std - + 3.14 - + thisFunctionNotImplemented( 7 ) @@ -1595,7 +1595,7 @@ - + multiply( i, 2 ) == i*2 @@ -1603,7 +1603,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -1611,7 +1611,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1619,7 +1619,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -1627,7 +1627,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1635,7 +1635,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -1643,7 +1643,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1651,7 +1651,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -1659,7 +1659,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1667,7 +1667,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -1675,7 +1675,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1683,7 +1683,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -1691,7 +1691,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1699,7 +1699,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -1707,7 +1707,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1715,7 +1715,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -1723,7 +1723,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1731,7 +1731,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -1739,7 +1739,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1747,7 +1747,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -1755,7 +1755,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1763,7 +1763,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -1771,7 +1771,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1779,7 +1779,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -1787,7 +1787,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1795,7 +1795,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -1803,7 +1803,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1811,7 +1811,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -1819,7 +1819,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1827,7 +1827,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -1835,7 +1835,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1843,7 +1843,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -1851,7 +1851,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1859,7 +1859,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -1867,7 +1867,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1875,7 +1875,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -1883,7 +1883,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1891,7 +1891,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -1899,7 +1899,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1907,7 +1907,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -1915,7 +1915,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1923,7 +1923,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -1931,7 +1931,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1939,7 +1939,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -1947,7 +1947,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1955,7 +1955,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -1963,7 +1963,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1971,7 +1971,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -1979,7 +1979,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1987,7 +1987,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -1995,7 +1995,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -2003,7 +2003,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2011,7 +2011,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -2019,7 +2019,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2027,7 +2027,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -2035,7 +2035,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -2043,7 +2043,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2051,7 +2051,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -2059,7 +2059,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2067,7 +2067,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -2075,7 +2075,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2083,7 +2083,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2091,7 +2091,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2099,7 +2099,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2107,7 +2107,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2115,7 +2115,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2123,7 +2123,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2131,7 +2131,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2139,7 +2139,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2147,7 +2147,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2155,7 +2155,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2163,7 +2163,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2171,7 +2171,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2179,7 +2179,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -2187,7 +2187,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2195,7 +2195,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -2203,7 +2203,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2211,7 +2211,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -2219,7 +2219,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2227,7 +2227,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2235,7 +2235,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2243,7 +2243,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2251,7 +2251,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2259,7 +2259,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2267,7 +2267,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2275,7 +2275,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2283,7 +2283,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2291,7 +2291,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2299,7 +2299,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2307,7 +2307,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2315,7 +2315,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2323,7 +2323,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -2331,7 +2331,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2339,7 +2339,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -2347,7 +2347,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2355,7 +2355,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -2363,7 +2363,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2371,7 +2371,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2379,7 +2379,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2387,7 +2387,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2395,7 +2395,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2403,7 +2403,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2411,7 +2411,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2419,7 +2419,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2427,7 +2427,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2435,7 +2435,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2443,7 +2443,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2451,7 +2451,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2459,7 +2459,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2467,7 +2467,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -2475,7 +2475,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2483,7 +2483,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -2491,7 +2491,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2499,7 +2499,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -2507,7 +2507,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2515,7 +2515,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2523,7 +2523,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2531,7 +2531,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2539,7 +2539,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2547,7 +2547,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2555,7 +2555,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2563,7 +2563,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2571,7 +2571,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2579,7 +2579,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2587,7 +2587,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2595,7 +2595,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2603,7 +2603,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2611,7 +2611,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -2619,7 +2619,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2627,7 +2627,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -2635,7 +2635,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2643,7 +2643,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -2651,7 +2651,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2659,7 +2659,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2667,7 +2667,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2675,7 +2675,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2683,7 +2683,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2691,7 +2691,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2699,7 +2699,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2707,7 +2707,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2715,7 +2715,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2723,7 +2723,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2731,7 +2731,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2739,7 +2739,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2750,7 +2750,7 @@ - + i->first == i->second-1 @@ -2758,7 +2758,7 @@ 0 == 0 - + i->first == i->second-1 @@ -2787,7 +2787,7 @@ so should this - + a == 1 @@ -2798,7 +2798,7 @@ - + a == 2 @@ -2809,7 +2809,7 @@ this message should be logged - + a == 1 @@ -2820,7 +2820,7 @@ and this, but later - + a == 0 @@ -2828,7 +2828,7 @@ 2 == 0 - + a == 2 @@ -2876,7 +2876,7 @@ - + i < 10 @@ -2884,7 +2884,7 @@ 0 < 10 - + i < 10 @@ -2892,7 +2892,7 @@ 1 < 10 - + i < 10 @@ -2900,7 +2900,7 @@ 2 < 10 - + i < 10 @@ -2908,7 +2908,7 @@ 3 < 10 - + i < 10 @@ -2916,7 +2916,7 @@ 4 < 10 - + i < 10 @@ -2924,7 +2924,7 @@ 5 < 10 - + i < 10 @@ -2932,7 +2932,7 @@ 6 < 10 - + i < 10 @@ -2940,7 +2940,7 @@ 7 < 10 - + i < 10 @@ -2948,7 +2948,7 @@ 8 < 10 - + i < 10 @@ -2962,7 +2962,7 @@ i := 10 - + i < 10 @@ -2973,7 +2973,7 @@ - + 1 == 2 @@ -2999,7 +2999,7 @@ i := 7 - + false @@ -3020,7 +3020,7 @@
- + a != b @@ -3028,7 +3028,7 @@ 1 != 2 - + b != a @@ -3039,7 +3039,7 @@
- + a != b @@ -3053,7 +3053,7 @@
- + a != b @@ -3061,7 +3061,7 @@ 1 != 2 - + b != a @@ -3070,7 +3070,7 @@
- + a != b @@ -3087,7 +3087,7 @@
- + a == b @@ -3121,7 +3121,7 @@
- + b > a @@ -3137,7 +3137,7 @@ Testing if fib[0] (1) is even - + ( fib[i] % 2 ) == 0 @@ -3148,7 +3148,7 @@ Testing if fib[1] (1) is even - + ( fib[i] % 2 ) == 0 @@ -3156,7 +3156,7 @@ 1 == 0 - + ( fib[i] % 2 ) == 0 @@ -3167,7 +3167,7 @@ Testing if fib[3] (3) is even - + ( fib[i] % 2 ) == 0 @@ -3178,7 +3178,7 @@ Testing if fib[4] (5) is even - + ( fib[i] % 2 ) == 0 @@ -3186,7 +3186,7 @@ 1 == 0 - + ( fib[i] % 2 ) == 0 @@ -3197,7 +3197,7 @@ Testing if fib[6] (13) is even - + ( fib[i] % 2 ) == 0 @@ -3208,7 +3208,7 @@ Testing if fib[7] (21) is even - + ( fib[i] % 2 ) == 0 @@ -3222,7 +3222,7 @@ - + makeString( false ) != static_cast<char*>(__null) @@ -3230,7 +3230,7 @@ "valid string" != {null string} - + makeString( true ) == static_cast<char*>(__null) @@ -3241,7 +3241,7 @@ - + flag @@ -3249,7 +3249,7 @@ true - + testCheckedIf( true ) @@ -3260,7 +3260,7 @@ - + flag @@ -3268,7 +3268,7 @@ false - + testCheckedIf( false ) @@ -3279,7 +3279,7 @@ - + flag @@ -3287,7 +3287,7 @@ true - + testCheckedElse( true ) @@ -3298,7 +3298,7 @@ - + flag @@ -3306,7 +3306,7 @@ false - + testCheckedElse( false ) @@ -3329,7 +3329,7 @@ 3 - + false @@ -3340,7 +3340,7 @@ - + x == 0 @@ -3351,7 +3351,7 @@ - + testStringForMatching() Contains( "string" ) @@ -3359,7 +3359,7 @@ "this string contains 'abc' as a substring" contains: "string" - + testStringForMatching() Contains( "abc" ) @@ -3367,7 +3367,7 @@ "this string contains 'abc' as a substring" contains: "abc" - + testStringForMatching() StartsWith( "this" ) @@ -3375,7 +3375,7 @@ "this string contains 'abc' as a substring" starts with: "this" - + testStringForMatching() EndsWith( "substring" ) @@ -3386,7 +3386,7 @@ - + testStringForMatching() Contains( "not there" ) @@ -3397,7 +3397,7 @@ - + testStringForMatching() StartsWith( "string" ) @@ -3408,7 +3408,7 @@ - + testStringForMatching() EndsWith( "this" ) @@ -3419,7 +3419,7 @@ - + testStringForMatching() Equals( "something else" ) @@ -3430,7 +3430,7 @@ - + "" Equals(__null) @@ -3441,7 +3441,7 @@ - + testStringForMatching() AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) ) @@ -3452,7 +3452,7 @@ - + testStringForMatching() AnyOf( Catch::Contains( "string" ), Catch::Contains( "not there" ) ) @@ -3460,7 +3460,7 @@ "this string contains 'abc' as a substring" ( contains: "string" or contains: "not there" ) - + testStringForMatching() AnyOf( Catch::Contains( "not there" ), Catch::Contains( "string" ) ) @@ -3471,7 +3471,7 @@ - + testStringForMatching() Equals( "this string contains 'abc' as a substring" ) @@ -3482,7 +3482,7 @@ - + Factorial(0) == 1 @@ -3490,7 +3490,7 @@ 1 == 1 - + Factorial(1) == 1 @@ -3498,7 +3498,7 @@ 1 == 1 - + Factorial(2) == 2 @@ -3506,7 +3506,7 @@ 2 == 2 - + Factorial(3) == 6 @@ -3514,7 +3514,7 @@ 6 == 6 - + Factorial(10) == 3628800 @@ -3540,7 +3540,7 @@ - + v.size() == 5 @@ -3548,7 +3548,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3557,7 +3557,7 @@
- + v.size() == 10 @@ -3565,7 +3565,7 @@ 10 == 10 - + v.capacity() >= 10 @@ -3575,7 +3575,7 @@
- + v.size() == 5 @@ -3583,7 +3583,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3592,7 +3592,7 @@
- + v.size() == 0 @@ -3600,7 +3600,7 @@ 0 == 0 - + v.capacity() >= 5 @@ -3609,7 +3609,7 @@
- + v.capacity() == 0 @@ -3621,7 +3621,7 @@
- + v.size() == 5 @@ -3629,7 +3629,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3638,7 +3638,7 @@
- + v.size() == 5 @@ -3646,7 +3646,7 @@ 5 == 5 - + v.capacity() >= 10 @@ -3656,7 +3656,7 @@
- + v.size() == 5 @@ -3664,7 +3664,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3673,7 +3673,7 @@
- + v.size() == 5 @@ -3681,7 +3681,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3709,7 +3709,7 @@ - + s1 == s2 @@ -3727,7 +3727,7 @@ - + result == "\"wide load\"" @@ -3738,7 +3738,7 @@ - + result == "\"wide load\"" @@ -3749,7 +3749,7 @@ - + result == "\"wide load\"" @@ -3760,7 +3760,7 @@ - + result == "\"wide load\"" @@ -3772,7 +3772,7 @@
- + parseIntoConfig( argv, config ) @@ -3780,7 +3780,7 @@ parseIntoConfig( argv, config ) - + config.shouldDebugBreak == false @@ -3788,7 +3788,7 @@ false == false - + config.abortAfter == -1 @@ -3796,7 +3796,7 @@ -1 == -1 - + config.noThrow == false @@ -3804,7 +3804,7 @@ false == false - + config.reporterName.empty() @@ -3816,7 +3816,7 @@
- + parseIntoConfig( argv, config ) @@ -3824,7 +3824,7 @@ parseIntoConfig( argv, config ) - + cfg.testSpec().matches( fakeTestCase( "notIncluded" ) ) == false @@ -3832,7 +3832,7 @@ false == false - + cfg.testSpec().matches( fakeTestCase( "test1" ) ) @@ -3846,7 +3846,7 @@
- + parseIntoConfig( argv, config ) @@ -3854,7 +3854,7 @@ parseIntoConfig( argv, config ) - + cfg.testSpec().matches( fakeTestCase( "test1" ) ) == false @@ -3862,7 +3862,7 @@ false == false - + cfg.testSpec().matches( fakeTestCase( "alwaysIncluded" ) ) @@ -3876,7 +3876,7 @@
- + parseIntoConfig( argv, config ) @@ -3884,7 +3884,7 @@ parseIntoConfig( argv, config ) - + cfg.testSpec().matches( fakeTestCase( "test1" ) ) == false @@ -3892,7 +3892,7 @@ false == false - + cfg.testSpec().matches( fakeTestCase( "alwaysIncluded" ) ) @@ -3906,7 +3906,7 @@
- + parseIntoConfig( argv, config ) @@ -3914,7 +3914,7 @@ parseIntoConfig( argv, config ) - + config.reporterName == "console" @@ -3928,7 +3928,7 @@
- + parseIntoConfig( argv, config ) @@ -3936,7 +3936,7 @@ parseIntoConfig( argv, config ) - + config.reporterName == "xml" @@ -3950,7 +3950,7 @@
- + parseIntoConfig( argv, config ) @@ -3958,7 +3958,7 @@ parseIntoConfig( argv, config ) - + config.reporterName == "junit" @@ -3972,7 +3972,7 @@
- + parseIntoConfig( argv, config ) @@ -3980,7 +3980,7 @@ parseIntoConfig( argv, config ) - + config.shouldDebugBreak == true @@ -3994,7 +3994,7 @@
- + parseIntoConfig( argv, config ) @@ -4002,7 +4002,7 @@ parseIntoConfig( argv, config ) - + config.shouldDebugBreak @@ -4016,7 +4016,7 @@
- + parseIntoConfig( argv, config ) @@ -4024,7 +4024,7 @@ parseIntoConfig( argv, config ) - + config.abortAfter == 1 @@ -4038,7 +4038,7 @@
- + parseIntoConfig( argv, config ) @@ -4046,7 +4046,7 @@ parseIntoConfig( argv, config ) - + config.abortAfter == 2 @@ -4060,7 +4060,7 @@
- + parseIntoConfigAndReturnError( argv, config ) Contains( "greater than zero" ) @@ -4075,7 +4075,7 @@
- + parseIntoConfigAndReturnError( argv, config ) Contains( "-x" ) @@ -4090,7 +4090,7 @@
- + parseIntoConfig( argv, config ) @@ -4098,7 +4098,7 @@ parseIntoConfig( argv, config ) - + config.noThrow == true @@ -4112,7 +4112,7 @@
- + parseIntoConfig( argv, config ) @@ -4120,7 +4120,7 @@ parseIntoConfig( argv, config ) - + config.noThrow == true @@ -4134,7 +4134,7 @@
- + parseIntoConfig( argv, config ) @@ -4142,7 +4142,7 @@ parseIntoConfig( argv, config ) - + config.outputFilename == "filename.ext" @@ -4156,7 +4156,7 @@
- + parseIntoConfig( argv, config ) @@ -4164,7 +4164,7 @@ parseIntoConfig( argv, config ) - + config.outputFilename == "filename.ext" @@ -4178,7 +4178,7 @@
- + parseIntoConfig( argv, config ) @@ -4186,7 +4186,7 @@ parseIntoConfig( argv, config ) - + config.abortAfter == 1 @@ -4194,7 +4194,7 @@ 1 == 1 - + config.shouldDebugBreak @@ -4202,7 +4202,7 @@ true - + config.noThrow == true @@ -4219,7 +4219,7 @@
- + Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString @@ -4229,7 +4229,7 @@ "one two three four" - + Text( testString, TextAttributes().setWidth( 18 ) ).toString() == testString @@ -4245,7 +4245,7 @@
- + Text( testString, TextAttributes().setWidth( 17 ) ).toString() == "one two three\nfour" @@ -4257,7 +4257,7 @@ four" four" - + Text( testString, TextAttributes().setWidth( 16 ) ).toString() == "one two three\nfour" @@ -4269,7 +4269,7 @@ four" four" - + Text( testString, TextAttributes().setWidth( 14 ) ).toString() == "one two three\nfour" @@ -4281,7 +4281,7 @@ four" four" - + Text( testString, TextAttributes().setWidth( 13 ) ).toString() == "one two three\nfour" @@ -4293,7 +4293,7 @@ four" four" - + Text( testString, TextAttributes().setWidth( 12 ) ).toString() == "one two\nthree four" @@ -4311,7 +4311,7 @@ three four"
- + Text( testString, TextAttributes().setWidth( 9 ) ).toString() == "one two\nthree\nfour" @@ -4325,7 +4325,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 8 ) ).toString() == "one two\nthree\nfour" @@ -4339,7 +4339,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 7 ) ).toString() == "one two\nthree\nfour" @@ -4359,7 +4359,7 @@ four"
- + Text( testString, TextAttributes().setWidth( 6 ) ).toString() == "one\ntwo\nthree\nfour" @@ -4375,7 +4375,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 5 ) ).toString() == "one\ntwo\nthree\nfour" @@ -4397,7 +4397,7 @@ four"
- + Text( "abcdef", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndef" @@ -4409,7 +4409,7 @@ def" def" - + Text( "abcdefg", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndefg" @@ -4421,7 +4421,7 @@ defg" defg" - + Text( "abcdefgh", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndef-\ngh" @@ -4435,7 +4435,7 @@ def- gh" - + Text( testString, TextAttributes().setWidth( 4 ) ).toString() == "one\ntwo\nthr-\nee\nfour" @@ -4453,7 +4453,7 @@ ee four" - + Text( testString, TextAttributes().setWidth( 3 ) ).toString() == "one\ntwo\nth-\nree\nfo-\nur" @@ -4479,7 +4479,7 @@ ur"
- + text.size() == 4 @@ -4487,7 +4487,7 @@ ur" 4 == 4 - + text[0] == "one" @@ -4495,7 +4495,7 @@ ur" "one" == "one" - + text[1] == "two" @@ -4503,7 +4503,7 @@ ur" "two" == "two" - + text[2] == "three" @@ -4511,7 +4511,7 @@ ur" "three" == "three" - + text[3] == "four" @@ -4525,7 +4525,7 @@ ur"
- + text.toString() == " one two\n three\n four" @@ -4545,7 +4545,7 @@ ur"
- + Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString @@ -4557,7 +4557,7 @@ three four" three four" - + Text( testString, TextAttributes().setWidth( 18 ) ).toString() == testString @@ -4569,7 +4569,7 @@ three four" three four" - + Text( testString, TextAttributes().setWidth( 10 ) ).toString() == testString @@ -4587,7 +4587,7 @@ three four"
- + Text( "abcdef\n", TextAttributes().setWidth( 10 ) ).toString() == "abcdef\n" @@ -4599,7 +4599,7 @@ three four" " - + Text( "abcdef", TextAttributes().setWidth( 6 ) ).toString() == "abcdef" @@ -4607,7 +4607,7 @@ three four" "abcdef" == "abcdef" - + Text( "abcdef\n", TextAttributes().setWidth( 6 ) ).toString() == "abcdef\n" @@ -4625,7 +4625,7 @@ three four"
- + Text( testString, TextAttributes().setWidth( 9 ) ).toString() == "one two\nthree\nfour" @@ -4639,7 +4639,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 8 ) ).toString() == "one two\nthree\nfour" @@ -4653,7 +4653,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 7 ) ).toString() == "one two\nthree\nfour" @@ -4673,7 +4673,7 @@ four"
- + Text( testString, TextAttributes().setWidth( 6 ) ).toString() == "one\ntwo\nthree\nfour" @@ -4694,7 +4694,7 @@ four"
- + Text( testString, TextAttributes().setWidth( 15 ) ).toString() == "one two three\n four\n five\n six" @@ -4718,7 +4718,7 @@ four" - + Text( "hi there" ).toString() == "hi there" @@ -4726,7 +4726,7 @@ four" "hi there" == "hi there" - + Text( "hi there", narrow ).toString() == "hi\nthere" @@ -4741,7 +4741,7 @@ there" - + t.toString() EndsWith( "... message truncated due to excessive size" ) @@ -5752,7 +5752,7 @@ there" - + (std::pair<int, int>( 1, 2 )) == aNicePair @@ -5775,7 +5775,7 @@ there" - + &o1 == &o2 @@ -5783,7 +5783,7 @@ there" 0x == 0x - + o1 == o2 @@ -5794,7 +5794,7 @@ there" - + std::string( "first" ) == "second" @@ -5805,7 +5805,7 @@ there" - + i++ == 7 @@ -5813,7 +5813,7 @@ there" 7 == 7 - + i++ == 8 @@ -5824,7 +5824,7 @@ there" - + 0x == o @@ -5835,7 +5835,7 @@ there" - + t == 1u @@ -5846,7 +5846,7 @@ there" - + 0x == bit30and31 @@ -5857,7 +5857,7 @@ there" - + obj.prop != __null @@ -5869,7 +5869,7 @@ there"
- + is_true<true>::value == true @@ -5877,7 +5877,7 @@ there" true == true - + true == is_true<true>::value @@ -5888,7 +5888,7 @@ there"
- + is_true<false>::value == false @@ -5896,7 +5896,7 @@ there" false == false - + false == is_true<false>::value @@ -5907,7 +5907,7 @@ there"
- + !is_true<false>::value @@ -5918,7 +5918,7 @@ there"
- + !!is_true<true>::value @@ -5929,7 +5929,7 @@ there"
- + is_true<true>::value @@ -5937,7 +5937,7 @@ there" true - + !is_true<false>::value @@ -5950,7 +5950,7 @@ there" - + True @@ -5958,7 +5958,7 @@ there" true - + !False @@ -5966,7 +5966,7 @@ there" true - + !False @@ -5977,7 +5977,7 @@ there" - + Catch::alwaysTrue() @@ -5986,7 +5986,7 @@ there"
- + Catch::alwaysTrue() @@ -5995,7 +5995,7 @@ there"
- + Catch::alwaysTrue() @@ -6007,7 +6007,7 @@ there"
- + Catch::alwaysTrue() @@ -6016,7 +6016,7 @@ there"
- + Catch::alwaysTrue() @@ -6025,7 +6025,7 @@ there"
- + Catch::alwaysTrue() @@ -6040,7 +6040,7 @@ there" - + s == "7" @@ -6051,7 +6051,7 @@ there" - + a @@ -6059,7 +6059,7 @@ there" true - + a == &foo @@ -6070,7 +6070,7 @@ there" - + m == &S::f @@ -6083,7 +6083,7 @@ there" - + p == 0 @@ -6094,7 +6094,7 @@ there" - + ptr.get() == nullptr @@ -6117,7 +6117,7 @@ there" - + Catch::toString( item ) == "toString( has_toString )" @@ -6130,7 +6130,7 @@ there" - + Catch::toString( item ) == "StringMaker<has_maker>" @@ -6143,7 +6143,7 @@ there" - + Catch::toString( item ) == "toString( has_maker_and_toString )" @@ -6156,7 +6156,7 @@ there" - + Catch::toString( v ) == "{ {?} }" @@ -6167,7 +6167,7 @@ there" - + Catch::toString( v ) == "{ StringMaker<has_maker> }" @@ -6180,7 +6180,7 @@ there" - + Catch::toString( v ) == "{ StringMaker<has_maker_and_toString> }" @@ -6193,7 +6193,7 @@ there" - + Catch::toString( value ) == "{ 34, \"xyzzy\" }" @@ -6204,7 +6204,7 @@ there" - + Catch::toString(value) == "{ 34, \"xyzzy\" }" @@ -6215,7 +6215,7 @@ there" - + Catch::toString( pr ) == "{ { \"green\", 55 } }" @@ -6228,7 +6228,7 @@ there" - + Catch::toString( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" @@ -6241,7 +6241,7 @@ there" - + Catch::toString(vv) == "{ }" @@ -6249,7 +6249,7 @@ there" "{ }" == "{ }" - + Catch::toString(vv) == "{ 42 }" @@ -6257,7 +6257,7 @@ there" "{ 42 }" == "{ 42 }" - + Catch::toString(vv) == "{ 42, 512 }" @@ -6268,7 +6268,7 @@ there" - + Catch::toString(vv) == "{ }" @@ -6276,7 +6276,7 @@ there" "{ }" == "{ }" - + Catch::toString(vv) == "{ \"hello\" }" @@ -6284,7 +6284,7 @@ there" "{ "hello" }" == "{ "hello" }" - + Catch::toString(vv) == "{ \"hello\", \"world\" }" @@ -6297,7 +6297,7 @@ there" - + Catch::toString(vv) == "{ }" @@ -6305,7 +6305,7 @@ there" "{ }" == "{ }" - + Catch::toString(vv) == "{ 42 }" @@ -6313,7 +6313,7 @@ there" "{ 42 }" == "{ 42 }" - + Catch::toString(vv) == "{ 42, 512 }" @@ -6324,7 +6324,7 @@ there" - + Catch::toString(v) == "{ }" @@ -6332,7 +6332,7 @@ there" "{ }" == "{ }" - + Catch::toString(v) == "{ { \"hello\" }, { \"world\" } }" @@ -6346,7 +6346,7 @@ there"
- + spec.hasFilters() == false @@ -6354,7 +6354,7 @@ there" false == false - + spec.matches( tcA ) == false @@ -6362,7 +6362,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6373,7 +6373,7 @@ there"
- + spec.hasFilters() == false @@ -6381,7 +6381,7 @@ there" false == false - + spec.matches(tcA ) == false @@ -6389,7 +6389,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6400,7 +6400,7 @@ there"
- + spec.hasFilters() == false @@ -6408,7 +6408,7 @@ there" false == false - + spec.matches( tcA ) == false @@ -6416,7 +6416,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6427,7 +6427,7 @@ there"
- + spec.hasFilters() == true @@ -6435,7 +6435,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6443,7 +6443,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6454,7 +6454,7 @@ there"
- + spec.hasFilters() == true @@ -6462,7 +6462,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6470,7 +6470,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6481,7 +6481,7 @@ there"
- + spec.hasFilters() == true @@ -6489,7 +6489,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6497,7 +6497,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6505,7 +6505,7 @@ there" true == true - + spec.matches( tcC ) == false @@ -6516,7 +6516,7 @@ there"
- + spec.hasFilters() == true @@ -6524,7 +6524,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6532,7 +6532,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6540,7 +6540,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6548,7 +6548,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -6556,7 +6556,7 @@ there" false == false - + parseTestSpec( "*a" ).matches( tcA ) == true @@ -6567,7 +6567,7 @@ there"
- + spec.hasFilters() == true @@ -6575,7 +6575,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6583,7 +6583,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6591,7 +6591,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6599,7 +6599,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -6607,7 +6607,7 @@ there" false == false - + parseTestSpec( "a*" ).matches( tcA ) == true @@ -6618,7 +6618,7 @@ there"
- + spec.hasFilters() == true @@ -6626,7 +6626,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6634,7 +6634,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6642,7 +6642,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6650,7 +6650,7 @@ there" true == true - + spec.matches( tcD ) == true @@ -6658,7 +6658,7 @@ there" true == true - + parseTestSpec( "*a*" ).matches( tcA ) == true @@ -6669,7 +6669,7 @@ there"
- + spec.hasFilters() == true @@ -6677,7 +6677,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6685,7 +6685,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -6696,7 +6696,7 @@ there"
- + spec.hasFilters() == true @@ -6704,7 +6704,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6712,7 +6712,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -6723,7 +6723,7 @@ there"
- + spec.hasFilters() == true @@ -6731,7 +6731,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6739,7 +6739,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -6750,7 +6750,7 @@ there"
- + spec.hasFilters() == true @@ -6758,7 +6758,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6766,7 +6766,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6774,7 +6774,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6782,7 +6782,7 @@ there" true == true - + spec.matches( tcD ) == true @@ -6793,7 +6793,7 @@ there"
- + spec.hasFilters() == true @@ -6801,7 +6801,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6809,7 +6809,7 @@ there" true == true - + spec.matches( tcB ) == true @@ -6817,7 +6817,7 @@ there" true == true - + spec.matches( tcC ) == true @@ -6825,7 +6825,7 @@ there" true == true - + spec.matches( tcD ) == true @@ -6836,7 +6836,7 @@ there"
- + spec.hasFilters() == true @@ -6844,7 +6844,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6852,7 +6852,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6860,7 +6860,7 @@ there" true == true - + spec.matches( tcC ) == false @@ -6871,7 +6871,7 @@ there"
- + spec.hasFilters() == true @@ -6879,7 +6879,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6887,7 +6887,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6895,7 +6895,7 @@ there" true == true - + spec.matches( tcC ) == true @@ -6906,7 +6906,7 @@ there"
- + spec.hasFilters() == true @@ -6914,7 +6914,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6922,7 +6922,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6930,7 +6930,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6941,7 +6941,7 @@ there"
- + spec.hasFilters() == true @@ -6949,7 +6949,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6957,7 +6957,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6965,7 +6965,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6976,7 +6976,7 @@ there"
- + spec.hasFilters() == true @@ -6984,7 +6984,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6992,7 +6992,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7000,7 +7000,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -7008,7 +7008,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -7019,7 +7019,7 @@ there"
- + spec.hasFilters() == true @@ -7027,7 +7027,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -7035,7 +7035,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -7043,7 +7043,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -7054,7 +7054,7 @@ there"
- + spec.hasFilters() == true @@ -7062,7 +7062,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7070,7 +7070,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -7078,7 +7078,7 @@ there" true == true - + spec.matches( tcC ) == false @@ -7089,7 +7089,7 @@ there"
- + spec.hasFilters() == true @@ -7097,7 +7097,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7105,7 +7105,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7113,7 +7113,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -7121,7 +7121,7 @@ there" false == false - + spec.matches( tcD ) == true @@ -7132,7 +7132,7 @@ there"
- + spec.hasFilters() == true @@ -7140,7 +7140,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7148,7 +7148,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7156,7 +7156,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -7164,7 +7164,7 @@ there" false == false - + spec.matches( tcD ) == true @@ -7175,7 +7175,7 @@ there"
- + spec.hasFilters() == true @@ -7183,7 +7183,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -7191,7 +7191,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -7199,7 +7199,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -7207,7 +7207,7 @@ there" true == true - + spec.matches( tcD ) == true @@ -7218,7 +7218,7 @@ there"
- + spec.hasFilters() == true @@ -7226,7 +7226,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -7234,7 +7234,7 @@ there" true == true - + spec.matches( tcB ) == true @@ -7242,7 +7242,7 @@ there" true == true - + spec.matches( tcC ) == false @@ -7250,7 +7250,7 @@ there" false == false - + spec.matches( tcD ) == false @@ -7261,7 +7261,7 @@ there"
- + spec.hasFilters() == true @@ -7269,7 +7269,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -7277,7 +7277,7 @@ there" true == true - + spec.matches( tcB ) == true @@ -7285,7 +7285,7 @@ there" true == true - + spec.matches( tcC ) == true @@ -7293,7 +7293,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -7304,7 +7304,7 @@ there"
- + spec.hasFilters() == true @@ -7312,7 +7312,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -7320,7 +7320,7 @@ there" true == true - + spec.matches( tcB ) == true @@ -7328,7 +7328,7 @@ there" true == true - + spec.matches( tcC ) == true @@ -7336,7 +7336,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -7347,7 +7347,7 @@ there"
- + spec.hasFilters() == true @@ -7355,7 +7355,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7363,7 +7363,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7371,7 +7371,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -7379,7 +7379,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -7390,7 +7390,7 @@ there"
- + spec.hasFilters() == false @@ -7398,7 +7398,7 @@ there" false == false - + spec.matches( tcA ) == false @@ -7406,7 +7406,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7414,7 +7414,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -7422,7 +7422,7 @@ there" false == false - + spec.matches( tcD ) == false @@ -7433,7 +7433,7 @@ there"
- + spec.hasFilters() == false @@ -7441,7 +7441,7 @@ there" false == false - + spec.matches( tcA ) == false @@ -7449,7 +7449,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7457,7 +7457,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -7465,7 +7465,7 @@ there" false == false - + spec.matches( tcD ) == false @@ -7476,7 +7476,7 @@ there"
- + spec.hasFilters() == true @@ -7484,7 +7484,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7492,7 +7492,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7500,7 +7500,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -7508,7 +7508,7 @@ there" false == false - + spec.matches( tcD ) == true @@ -7522,7 +7522,7 @@ there"
- + what Contains( "[@zzz]" ) @@ -7532,7 +7532,7 @@ there" Redefined at file:10" contains: "[@zzz]" - + what Contains( "file" ) @@ -7542,7 +7542,7 @@ there" Redefined at file:10" contains: "file" - + what Contains( "2" ) @@ -7552,7 +7552,7 @@ there" Redefined at file:10" contains: "2" - + what Contains( "10" ) @@ -7565,7 +7565,7 @@ there"
- + registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) @@ -7573,7 +7573,7 @@ there" registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) - + registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) @@ -7581,7 +7581,7 @@ there" registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) - + registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) @@ -7589,7 +7589,7 @@ there" registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) - + registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) @@ -7617,7 +7617,7 @@ there"
- + itDoesThis() @@ -7626,7 +7626,7 @@ there"
- + itDoesThat() @@ -7646,7 +7646,7 @@ there"
- + v.size() == 0 @@ -7656,7 +7656,7 @@ there"
- + v.size() == 10 @@ -7664,7 +7664,7 @@ there" 10 == 10 - + v.capacity() >= 10 @@ -7674,7 +7674,7 @@ there"
- + v.size() == 5 @@ -7682,7 +7682,7 @@ there" 5 == 5 - + v.capacity() >= 10 @@ -7701,7 +7701,7 @@ there"
- + v.size() == 0 @@ -7711,7 +7711,7 @@ there"
- + v.capacity() >= 10 @@ -7719,7 +7719,7 @@ there" 10 >= 10 - + v.size() == 0 @@ -7749,7 +7749,7 @@ there"
- + before == 0 @@ -7759,7 +7759,7 @@ there"
- + after > before @@ -7776,7 +7776,7 @@ there" - + !testCaseTracker.isCompleted() @@ -7785,7 +7785,7 @@ there"
- + !testCaseTracker.isCompleted() @@ -7793,7 +7793,7 @@ there" !false - + testCaseTracker.isCompleted() @@ -7803,7 +7803,7 @@ there"
- + !testCaseTracker.isCompleted() @@ -7812,7 +7812,7 @@ there"
- + testCaseTracker.enterSection( section1Name ) @@ -7820,7 +7820,7 @@ there" true - + !testCaseTracker.isCompleted() @@ -7828,7 +7828,7 @@ there" !false - + testCaseTracker.isCompleted() @@ -7836,7 +7836,7 @@ there" true - + !testCaseTracker.enterSection( section1Name ) @@ -7846,7 +7846,7 @@ there"
- + !testCaseTracker.isCompleted() @@ -7855,7 +7855,7 @@ there"
- + testCaseTracker.enterSection( section1Name ) @@ -7863,7 +7863,7 @@ there" true - + !testCaseTracker.enterSection( section2Name ) @@ -7871,7 +7871,7 @@ there" !false - + !testCaseTracker.isCompleted() @@ -7879,7 +7879,7 @@ there" !false - + !testCaseTracker.enterSection( section1Name ) @@ -7887,7 +7887,7 @@ there" !false - + testCaseTracker.enterSection( section2Name ) @@ -7895,7 +7895,7 @@ there" true - + testCaseTracker.isCompleted() @@ -7905,7 +7905,7 @@ there"
- + !testCaseTracker.isCompleted() @@ -7914,7 +7914,7 @@ there"
- + testCaseTracker.enterSection( section1Name ) @@ -7922,7 +7922,7 @@ there" true - + testCaseTracker.enterSection( section2Name ) @@ -7930,7 +7930,7 @@ there" true - + !testCaseTracker.isCompleted() @@ -7938,7 +7938,7 @@ there" !false - + testCaseTracker.isCompleted() diff --git a/scripts/approvalTests.py b/scripts/approvalTests.py index 329c99b5..f2ffea5c 100644 --- a/scripts/approvalTests.py +++ b/scripts/approvalTests.py @@ -9,8 +9,9 @@ from scriptCommon import catchPath rootPath = os.path.join( catchPath, 'projects/SelfTest/Baselines' ) -filenameParser = re.compile( r'.*/(.*\..pp:)(.*)' ) +filenameParser = re.compile( r'(.*)/(.*\..pp:)(.*)' ) filelineParser = re.compile( r'(.*\..pp:)([0-9]*)(.*)' ) +pathParser = re.compile( r'(.*?)/(.*\..pp)(.*)' ) lineNumberParser = re.compile( r'(.*)line="[0-9]*"(.*)' ) hexParser = re.compile( r'(.*)\b(0[xX][0-9a-fA-F]+)\b(.*)' ) durationsParser = re.compile( r'(.*)time="[0-9]*\.[0-9]*"(.*)' ) @@ -26,14 +27,20 @@ overallResult = 0 def filterLine( line ): m = filenameParser.match( line ) if m: - line = m.group(1) + m.group(2) - m = filelineParser.match( line ) - if m: - line = m.group(1) + "" + m.group(3) + line = m.group(2) + m.group(3) + m2 = filelineParser.match( line ) + if m2: + line = m2.group(1) + "" + m2.group(3) else: - m = lineNumberParser.match( line ) - if m: - line = m.group(1) + m.group(2) + m2 = lineNumberParser.match( line ) + if m2: + line = m2.group(1) + m2.group(2) + m = pathParser.match( line ) + if m: + path = "/" + m.group(2) + if path.startswith( catchPath ): + path = path[1+len(catchPath):] + line = m.group(1) + path + m.group(3) m = versionParser.match( line ) if m: line = m.group(1) + "" + m.group(2) @@ -52,6 +59,8 @@ def filterLine( line ): def approve( baseName, args ): global overallResult args[0:0] = [cmdPath] + if not os.path.exists( cmdPath ): + raise Exception( "Executable doesn't exist at " + cmdPath ) baselinesPath = os.path.join( rootPath, '{0}.approved.txt'.format( baseName ) ) rawResultsPath = os.path.join( rootPath, '_{0}.tmp'.format( baseName ) ) filteredResultsPath = os.path.join( rootPath, '{0}.unapproved.txt'.format( baseName ) ) From bd9fbe25f64ce4a45a09e37142e6e2f55af206fb Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 11 Dec 2014 23:48:11 +0000 Subject: [PATCH 054/102] Fixed toString for Approx restored to a specialisation instead of an overload --- include/internal/catch_approx.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/internal/catch_approx.hpp b/include/internal/catch_approx.hpp index 8b075515..f5dba61a 100644 --- a/include/internal/catch_approx.hpp +++ b/include/internal/catch_approx.hpp @@ -81,7 +81,8 @@ namespace Detail { }; } -inline std::string toString( Detail::Approx const& value ) { +template<> +inline std::string toString( Detail::Approx const& value ) { return value.toString(); } From ff9e51df7f98f743a8505b1991304cfae07184c3 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 12 Dec 2014 08:10:45 +0000 Subject: [PATCH 055/102] toString( int ) uses hex for large values now matches behaviour of unsigned int --- include/internal/catch_tostring.hpp | 5 ++++- projects/SelfTest/Baselines/console.sw.approved.txt | 2 +- projects/SelfTest/Baselines/xml.sw.approved.txt | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/internal/catch_tostring.hpp b/include/internal/catch_tostring.hpp index 21ee45f7..c4b3f152 100644 --- a/include/internal/catch_tostring.hpp +++ b/include/internal/catch_tostring.hpp @@ -98,7 +98,10 @@ std::string toString( wchar_t* const value ) std::string toString( int value ) { std::ostringstream oss; - oss << value; + if( value > 8192 ) + oss << "0x" << std::hex << value; + else + oss << value; return oss.str(); } diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 54b7c915..7f6be8ec 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -3398,7 +3398,7 @@ MiscTests.cpp:: PASSED: REQUIRE( Factorial(10) == 3628800 ) with expansion: - 0x == 3628800 + 0x == 0x ------------------------------------------------------------------------------- An empty test with no assertions diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 9a273fb6..612ed0bf 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -3519,7 +3519,7 @@ Factorial(10) == 3628800 - 0x == 3628800 + 0x == 0x From 13f98431ada17fa2af0f8219bce02549d82258b9 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 12 Dec 2014 08:11:18 +0000 Subject: [PATCH 056/102] build 8 --- README.md | 2 +- include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 26 ++++++++++++++------------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index fead10b5..d31f2645 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![catch logo](catch-logo-small.png) -*v1.1 build 7 (develop branch)* +*v1.1 build 8 (develop branch)* Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index 1d7a6434..19c26294 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -13,7 +13,7 @@ namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 7, "develop" ); + Version libraryVersion( 1, 1, 8, "develop" ); } #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED diff --git a/single_include/catch.hpp b/single_include/catch.hpp index c17d850e..05694b45 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * CATCH v1.1 build 7 (develop branch) - * Generated: 2014-10-21 07:24:45.439607 + * CATCH v1.1 build 8 (develop branch) + * Generated: 2014-12-12 08:10:57.025852 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -1246,10 +1246,9 @@ std::string toString( std::nullptr_t ); std::ostringstream oss; oss << "{ "; if( first != last ) { - oss << toString( *first ); - for( ++first ; first != last ; ++first ) { - oss << ", " << toString( *first ); - } + oss << Catch::toString( *first ); + for( ++first ; first != last ; ++first ) + oss << ", " << Catch::toString( *first ); } oss << " }"; return oss.str(); @@ -5844,7 +5843,7 @@ namespace Catch { throw; } @catch (NSException *exception) { - return toString( [exception description] ); + return Catch::toString( [exception description] ); } #else throw; @@ -6669,7 +6668,7 @@ namespace Catch { namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 7, "develop" ); + Version libraryVersion( 1, 1, 8, "develop" ); } // #included from: catch_message.hpp @@ -7146,7 +7145,7 @@ std::string toString( std::wstring const& value ) { s.reserve( value.size() ); for(size_t i = 0; i < value.size(); ++i ) s += value[i] <= 0xff ? static_cast( value[i] ) : '?'; - return toString( s ); + return Catch::toString( s ); } std::string toString( const char* const value ) { @@ -7169,7 +7168,10 @@ std::string toString( wchar_t* const value ) std::string toString( int value ) { std::ostringstream oss; - oss << value; + if( value > 8192 ) + oss << "0x" << std::hex << value; + else + oss << value; return oss.str(); } @@ -7183,7 +7185,7 @@ std::string toString( unsigned long value ) { } std::string toString( unsigned int value ) { - return toString( static_cast( value ) ); + return Catch::toString( static_cast( value ) ); } template @@ -8197,7 +8199,7 @@ namespace Catch { xml.writeAttribute( "classname", className ); xml.writeAttribute( "name", name ); } - xml.writeAttribute( "time", toString( sectionNode.stats.durationInSeconds ) ); + xml.writeAttribute( "time", Catch::toString( sectionNode.stats.durationInSeconds ) ); writeAssertions( sectionNode ); From 82754c1766650d762d5c785e89272b6bc7d5362a Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 12 Dec 2014 08:29:21 +0000 Subject: [PATCH 057/102] tweaked formatting --- docs/tostring.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/tostring.md b/docs/tostring.md index b9766494..ab2a1377 100644 --- a/docs/tostring.md +++ b/docs/tostring.md @@ -7,10 +7,12 @@ Most built-in or std types are supported out of the box but there are two ways t This is the standard way of providing string conversions in C++ - and the chances are you may already provide this for your own purposes. If you're not familiar with this idiom it involves writing a free function of the form: -```std::ostream& operator << ( std::ostream& os, T const& value ) { +``` +std::ostream& operator << ( std::ostream& os, T const& value ) { os << convertMyTypeToString( value ); return os; -}``` +} +``` (where ```T``` is your type and ```convertMyTypeToString``` is where you'll write whatever code is necessary to make your type printable - it doesn't have to be in another function). @@ -18,21 +20,25 @@ You should put this function in the same namespace as your type. Alternatively you may prefer to write it as a member function: -```std::ostream& T::operator << ( std::ostream& os ) const { +``` +std::ostream& T::operator << ( std::ostream& os ) const { os << convertMyTypeToString( *this ); return os; -}``` +} +``` ## Catch::toString overload If you don't want to provide an ```operator <<``` overload, or you want to convert your type differently for testing purposes, you can provide an overload for ```Catch::toString()``` for your type. -```namespace Catch { +``` +namespace Catch { std::string toString( T const& value ) { return convertMyTypeToString( value ); } } -}``` +} +``` Again ```T``` is your type and ```convertMyTypeToString``` is where you'll write whatever code is necessary to make your type printable. Note that the function must be in the Catch namespace, which itself must be in the global namespace. From 30888f59bf4c943c45414456a28001504824bfb9 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 12 Dec 2014 08:33:10 +0000 Subject: [PATCH 058/102] removed spurious } --- docs/tostring.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/tostring.md b/docs/tostring.md index ab2a1377..f354d239 100644 --- a/docs/tostring.md +++ b/docs/tostring.md @@ -37,7 +37,6 @@ namespace Catch { return convertMyTypeToString( value ); } } -} ``` Again ```T``` is your type and ```convertMyTypeToString``` is where you'll write whatever code is necessary to make your type printable. Note that the function must be in the Catch namespace, which itself must be in the global namespace. From 6725e09003c0544389c12af5cba49df81554f468 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 15 Dec 2014 07:07:59 +0000 Subject: [PATCH 059/102] any tag prefixed with . hides the test --- include/internal/catch_test_case_info.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/internal/catch_test_case_info.hpp b/include/internal/catch_test_case_info.hpp index b06c86fb..251b44c8 100644 --- a/include/internal/catch_test_case_info.hpp +++ b/include/internal/catch_test_case_info.hpp @@ -16,7 +16,7 @@ namespace Catch { inline TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) { - if( tag == "." || + if( startsWith( tag, "." ) || tag == "hide" || tag == "!hide" ) return TestCaseInfo::IsHidden; From 0dd214f6dbed7da03ff8d80071af3a39d1031754 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 15 Dec 2014 07:25:34 +0000 Subject: [PATCH 060/102] tags with . prefix are all hidden --- include/internal/catch_test_case_info.hpp | 15 ++++++++------- projects/SelfTest/TestMain.cpp | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/internal/catch_test_case_info.hpp b/include/internal/catch_test_case_info.hpp index 251b44c8..67f32b6e 100644 --- a/include/internal/catch_test_case_info.hpp +++ b/include/internal/catch_test_case_info.hpp @@ -30,7 +30,7 @@ namespace Catch { return TestCaseInfo::None; } inline bool isReservedTag( std::string const& tag ) { - return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !isalnum( tag[0] ); + return TestCaseInfo::None && tag.size() > 0 && !isalnum( tag[0] ); } inline void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) { if( isReservedTag( tag ) ) { @@ -70,14 +70,15 @@ namespace Catch { } else { if( c == ']' ) { - enforceNotReservedTag( tag, _lineInfo ); - - inTag = false; - if( tag == "hide" || tag == "." ) + TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag ); + if( prop == TestCaseInfo::IsHidden ) isHidden = true; - else - tags.insert( tag ); + else if( prop == TestCaseInfo::None ) + enforceNotReservedTag( tag, _lineInfo ); + + tags.insert( tag ); tag.clear(); + inTag = false; } else tag += c; diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index a377e597..b6fc8690 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -348,7 +348,7 @@ private: }; // !TBD: This will be folded into Text class -TEST_CASE( "Strings can be rendered with colour", "[colour][.]" ) { +TEST_CASE( "Strings can be rendered with colour", "[.colour]" ) { { ColourString cs( "hello" ); From 7e1f21b3340961aeafffa4a8b05ef2b4fe31cf09 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 15 Dec 2014 07:25:54 +0000 Subject: [PATCH 061/102] tweaks to tutorial --- docs/tutorial.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 1534132a..624fb958 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -86,10 +86,10 @@ Of course there are still more issues to do deal with. For example we'll hit pro Although this was a simple test it's been enough to demonstrate a few things about how Catch is used. Let's take moment to consider those before we move on. -1. All we did was ```#define``` one identifier and ```#include``` one header and we got everything - even an implementation of ```main()``` that will [respond to command line arguments](command-line.md). You can only use that ```#define``` in one implementation file, for (hopefully) obvious reasons. Once you have more than one file with unit tests in you'll just ```#include "catch.hpp"``` and go. Usually it's a good idea to have a dedicated implementation file that just has ```#define CATCH_CONFIG_MAIN``` and ```#include "catch.hpp"```. You can also provide your own implementation of main and drive Catch yourself (see [Supplying-your-own-main()](own-main.md). -2. We introduce test cases with the TEST_CASE macro. This macro takes one or two arguments - a free form test name and, optionally, one or more tags (for more see Test cases and Sections, below. The test name must be unique. You can run sets of tests by specifying a wildcarded test name or a tag expression. See the [command line docs](command-line.md) for more information on running tests. +1. All we did was ```#define``` one identifier and ```#include``` one header and we got everything - even an implementation of ```main()``` that will [respond to command line arguments](command-line.md). You can only use that ```#define``` in one implementation file, for (hopefully) obvious reasons. Once you have more than one file with unit tests in you'll just ```#include "catch.hpp"``` and go. Usually it's a good idea to have a dedicated implementation file that just has ```#define CATCH_CONFIG_MAIN``` and ```#include "catch.hpp"```. You can also provide your own implementation of main and drive Catch yourself (see [Supplying-your-own-main()](own-main.md)). +2. We introduce test cases with the ```TEST_CASE``` macro. This macro takes one or two arguments - a free form test name and, optionally, one or more tags (for more see Test cases and Sections, below. The test name must be unique. You can run sets of tests by specifying a wildcarded test name or a tag expression. See the [command line docs](command-line.md) for more information on running tests. 3. The name and tags arguments are just strings. We haven't had to declare a function or method - or explicitly register the test case anywhere. Behind the scenes a function with a generated name is defined for you, and automatically registered using static registry classes. By abstracting the function name away we can name our tests without the constraints of identifier names. -4. We write our individual test assertions using the REQUIRE macro. Rather than a separate macro for each type of condition we express the condition naturally using C/C++ syntax. Behind the scenes a simple set of expression templates captures the left-hand-side and right-hand-side of the expression so we can display the values in our test report. As we'll see later there _are_ other assertion macros - but because of this technique the number of them is drastically reduced. +4. We write our individual test assertions using the ```REQUIRE``` macro. Rather than a separate macro for each type of condition we express the condition naturally using C/C++ syntax. Behind the scenes a simple set of expression templates captures the left-hand-side and right-hand-side of the expression so we can display the values in our test report. As we'll see later there _are_ other assertion macros - but because of this technique the number of them is drastically reduced. ## Test cases and sections @@ -157,7 +157,7 @@ The power of sections really shows, however, when we need to execute a sequence } ``` -Sections can be nested to an arbitrary depth (limited only by your stack size). Each leaf section (i.e. a section that contains no nested sections) will be executed exactly once, on a separate path of execution from any other leaf section (so no leaf section can interfere with another). Obviously a failure in a parent section will prevent nested sections from running - but that's the idea. +Sections can be nested to an arbitrary depth (limited only by your stack size). Each leaf section (i.e. a section that contains no nested sections) will be executed exactly once, on a separate path of execution from any other leaf section (so no leaf section can interfere with another). A failure in a parent section will prevent nested sections from running - but then that's the idea. ## BDD-Style @@ -220,8 +220,10 @@ Scenario: vectors can be sized and resized ``` ## Next steps -For more specific information see the [Reference pages](Readme.md) +This has been a brief introduction to get you up and running with Catch, and to point out some of the key differences between Catch and other frameworks you may already be familiar with. This will get you going quite far already and you are now in a position to dive in and write some tests. + +Of course there is more to learn - most of which you should be able to page-fault in as you go. Please see the every-growing [Reference section](Readme.md) for what's available. --- From 91c17f34ebf01fa6320bfdb77d1eda693fd5de60 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 15 Dec 2014 07:26:31 +0000 Subject: [PATCH 062/102] build 9 --- README.md | 2 +- include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 23 ++++++++++++----------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d31f2645..84d1ff59 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![catch logo](catch-logo-small.png) -*v1.1 build 8 (develop branch)* +*v1.1 build 9 (develop branch)* Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index 19c26294..e0794fad 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -13,7 +13,7 @@ namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 8, "develop" ); + Version libraryVersion( 1, 1, 9, "develop" ); } #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 05694b45..0f840bc9 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * CATCH v1.1 build 8 (develop branch) - * Generated: 2014-12-12 08:10:57.025852 + * CATCH v1.1 build 9 (develop branch) + * Generated: 2014-12-15 07:26:07.689692 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -6489,7 +6489,7 @@ namespace Catch { namespace Catch { inline TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) { - if( tag == "." || + if( startsWith( tag, "." ) || tag == "hide" || tag == "!hide" ) return TestCaseInfo::IsHidden; @@ -6503,7 +6503,7 @@ namespace Catch { return TestCaseInfo::None; } inline bool isReservedTag( std::string const& tag ) { - return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !isalnum( tag[0] ); + return TestCaseInfo::None && tag.size() > 0 && !isalnum( tag[0] ); } inline void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) { if( isReservedTag( tag ) ) { @@ -6543,14 +6543,15 @@ namespace Catch { } else { if( c == ']' ) { - enforceNotReservedTag( tag, _lineInfo ); - - inTag = false; - if( tag == "hide" || tag == "." ) + TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag ); + if( prop == TestCaseInfo::IsHidden ) isHidden = true; - else - tags.insert( tag ); + else if( prop == TestCaseInfo::None ) + enforceNotReservedTag( tag, _lineInfo ); + + tags.insert( tag ); tag.clear(); + inTag = false; } else tag += c; @@ -6668,7 +6669,7 @@ namespace Catch { namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 8, "develop" ); + Version libraryVersion( 1, 1, 9, "develop" ); } // #included from: catch_message.hpp From 5259b78feaea5671109a4b475d7af8e496a77a5f Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 16 Dec 2014 18:11:13 +0000 Subject: [PATCH 063/102] Updated command line docs Added docs for: -f, --input-file --list-test-names-only --order --rng-seed --- docs/command-line.md | 53 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/docs/command-line.md b/docs/command-line.md index d390bf39..f9bf27eb 100644 --- a/docs/command-line.md +++ b/docs/command-line.md @@ -1,5 +1,5 @@ Catch works quite nicely without any command line options at all - but for those times when you want greater control the following options are available. -Note that options are described according to the following pattern: +Click one of the followings links to take you straight to that option - or scroll on to browse the available options. ` ...`
` -r, --reporter`
@@ -7,13 +7,26 @@ Note that options are described according to the following pattern: ` -s, --success`
` -a, --abort`
` -l, --list`
+ ` -t, --list-tags`
` -o, --out`
` -n, --name`
` -e, --nothrow`
` -w, --warn`
` -d, --durations`
+ ` -f, --input-file`
+ +
+ + ` --list-test-names-only`
+ ` --list-reporters`
+ ` --order`
+ ` --rng-seed`
+ +
+ ` -h, -?, --help`
+ ## Specifying which tests to run @@ -21,7 +34,8 @@ Note that options are described according to the following pattern: Test cases, wildcarded test cases, tags and tag expressions are all passed directly as arguments. Tags are distinguished by being enclosed in square brackets. -If no test specs are supplied then all test cases, except "hidden" tests (tagged ```[hide]```, ```[.]``` or, in the legacy case, prefixed by `'./'`) are run. +If no test specs are supplied then all test cases, except "hidden" tests, are run. +A test is hidden by giving it any tag starting with (or just) a period (```.```) - or, in the deprecated case, tagged ```[hide]``` or given name starting with `'./'`. To specify hidden tests from the command line ```[.]``` or ```[hide]``` can be used *regardless of how they were declared*. Specs must be enclosed in quotes if they contain spaces. If they do not contain spaces the quotes are optional. @@ -79,7 +93,7 @@ In addition to the command line option, ensure you have built your code with the
-s, --success
Usually you only want to see reporting for failed tests. Sometimes it's useful to see *all* the output (especially when you don't trust that that test you just added worked first time!). -To see successul, as well as failing, test results just pass this option. Note that each reporter may treat this option differently. The Junit reporter, for example, logs all results regardless. +To see successful, as well as failing, test results just pass this option. Note that each reporter may treat this option differently. The Junit reporter, for example, logs all results regardless. ## Aborting after a certain number of failures @@ -145,6 +159,39 @@ The ony available warning, presently, is ```NoAssertions```. This warning fails When set to ```yes``` Catch will report the duration of each test case, in milliseconds. Note that it does this regardless of whether a test case passes or fails. Note, also, the certain reporters (e.g. Junit) always report test case durations regardless of this option being set or not. + +## Just test names +
--list-test-names-only
+ +This option lists all available tests in a non-indented form, one on each line. This makes it ideal for saving to a file and feeding back into the ```-f``` or ```--input-file``` option. + + + +## Specify the order test cases are run +
--order <decl|lex|rand>
+ +Test cases are ordered one of three ways: + + +```decl``` +Declaration order. The order the tests were originally declared in. Note that ordering between files is not guaranteed and is implementation dependent. + +```lex``` +Lexicographically sorted. Tests are sorted, alphanumerically, by name. + +```rand``` +Randomly sorted. Test names are sorted using ```std::random_shuffle()```. By default the random number generator is seeded with 0 - and so the order is repeatable. To control the random seed see rng-seed. + + +## Specify a seed for the Random Number Generator +
--rng-seed <'time'|number>
+ +Sets a seed for the random number generator using ```std::srand()```. +If a number is provided this is used directly as the seed so the random pattern is repeatable. +Alternatively if the keyword ```time``` is provided then the result of calling ```std::time(0)``` is used and so the pattern becomes unpredictable. + +In either case the actual value for the seed is printed as part of Catch's output so if an issue is discovered that is sensitive to test ordering the ordering can be reproduced - even if it was originally seeded from ```std::time(0)```. + ## Usage
-h, -?, --help
From 840b99af92081b1ac8aebc553e177f4cb6833418 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 16 Dec 2014 18:13:29 +0000 Subject: [PATCH 064/102] Added docs for --input-file (somehow missing from previous commit) --- docs/command-line.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/command-line.md b/docs/command-line.md index f9bf27eb..e863e198 100644 --- a/docs/command-line.md +++ b/docs/command-line.md @@ -159,11 +159,19 @@ The ony available warning, presently, is ```NoAssertions```. This warning fails When set to ```yes``` Catch will report the duration of each test case, in milliseconds. Note that it does this regardless of whether a test case passes or fails. Note, also, the certain reporters (e.g. Junit) always report test case durations regardless of this option being set or not. + +## Load test names to run from a file +
-f, --input-file <filename>
+ +Provide the name of a file that contains a list of test case names - one per line. Blank lines are skipped and anything after the comment character, ```#```, is ignored. + +A useful way to generate an initial instance of this file is to use the list-test-names-only option. This can then be manually curated to specify a specific subset of tests - or in a specific order. + ## Just test names
--list-test-names-only
-This option lists all available tests in a non-indented form, one on each line. This makes it ideal for saving to a file and feeding back into the ```-f``` or ```--input-file``` option. +This option lists all available tests in a non-indented form, one on each line. This makes it ideal for saving to a file and feeding back into the ```-f``` or ```--input-file``` option. From 0b1fa6a08052f51ad58171d572c25c291f863e02 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 16 Dec 2014 18:19:28 +0000 Subject: [PATCH 065/102] fixed (hopefully) formatting of '--order' docs if only there was a standard-markdown! --- docs/command-line.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/command-line.md b/docs/command-line.md index e863e198..bad0c9ee 100644 --- a/docs/command-line.md +++ b/docs/command-line.md @@ -181,13 +181,13 @@ This option lists all available tests in a non-indented form, one on each line. Test cases are ordered one of three ways: -```decl``` +* ```decl``` Declaration order. The order the tests were originally declared in. Note that ordering between files is not guaranteed and is implementation dependent. -```lex``` -Lexicographically sorted. Tests are sorted, alphanumerically, by name. +* ```lex``` +Lexicographically sorted. Tests are sorted, alpha-numerically, by name. -```rand``` +* ```rand``` Randomly sorted. Test names are sorted using ```std::random_shuffle()```. By default the random number generator is seeded with 0 - and so the order is repeatable. To control the random seed see rng-seed. From c0c6e7a746ad27e89250255458862281c3ed70e3 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 16 Dec 2014 18:19:42 +0000 Subject: [PATCH 066/102] Fixed single_include link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 84d1ff59..828a43a1 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/C [Please see this page if you are updating from a version before 1.0](docs/whats-changed.md) -[The latest, single header, version can be downloaded directly using this link] +[The latest, single header, version can be downloaded directly using this link] ## What's the Catch? From f5c98591319876c797c4e5960bdd5d0ae2321718 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 16 Dec 2014 18:21:42 +0000 Subject: [PATCH 067/102] Try again to fix --order docs --- docs/command-line.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/command-line.md b/docs/command-line.md index bad0c9ee..7e412f38 100644 --- a/docs/command-line.md +++ b/docs/command-line.md @@ -181,13 +181,13 @@ This option lists all available tests in a non-indented form, one on each line. Test cases are ordered one of three ways: -* ```decl``` +### decl Declaration order. The order the tests were originally declared in. Note that ordering between files is not guaranteed and is implementation dependent. -* ```lex``` +### lex Lexicographically sorted. Tests are sorted, alpha-numerically, by name. -* ```rand``` +### rand Randomly sorted. Test names are sorted using ```std::random_shuffle()```. By default the random number generator is seeded with 0 - and so the order is repeatable. To control the random seed see rng-seed. From 7abc9fa8b7d9788681f7eb582bde23eb984f5a8c Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 16 Dec 2014 18:38:40 +0000 Subject: [PATCH 068/102] Added docs for --invisibles also reordered command line docs jump list to match order listed when getting usage from Catch itself. --- docs/command-line.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/docs/command-line.md b/docs/command-line.md index 7e412f38..d1d4bd4a 100644 --- a/docs/command-line.md +++ b/docs/command-line.md @@ -2,15 +2,18 @@ Catch works quite nicely without any command line options at all - but for those Click one of the followings links to take you straight to that option - or scroll on to browse the available options. ` ...`
- ` -r, --reporter`
- ` -b, --break`
- ` -s, --success`
- ` -a, --abort`
- ` -l, --list`
+ ` -h, -?, --help`
+ ` -l, --list-tests`
` -t, --list-tags`
- ` -o, --out`
- ` -n, --name`
+ ` -s, --success`
+ ` -b, --break`
` -e, --nothrow`
+ ` -i, --invisibles`
+ ` -o, --out`
+ ` -r, --reporter`
+ ` -n, --name`
+ ` -a, --abort`
+ ` -x, --abortx`
` -w, --warn`
` -d, --durations`
` -f, --input-file`
@@ -24,7 +27,6 @@ Click one of the followings links to take you straight to that option - or scrol
- ` -h, -?, --help`
@@ -145,6 +147,13 @@ Sometimes exceptions are expected outside of one of the assertions that tests fo When running with this option any throw checking assertions are skipped so as not to contribute additional noise. Be careful if this affects the behaviour of subsequent tests. + +## Make whitespace visible +
-i, --invisibles
+ +If a string comparison fails due to differences in whitespace - especially leading or trailing whitespace - it can be hard to see what's going on. +This option transforms tabs and newline characters into ```\t``` and ```\n``` respectively when printing. + ## Warnings
-w, --warn <warning name>
From b454c43dead46a6d9ebcd77312c53226d6424b2c Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 17 Dec 2014 18:16:24 +0000 Subject: [PATCH 069/102] Extends configuration docs --- docs/configuration.md | 55 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 185eb440..f12ec68e 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -2,22 +2,65 @@ Catch is designed to "just work" as much as possible. For most people the only c Nonetheless there are still some occasions where finer control is needed. For these occasions Catch exposes a small set of macros for configuring how it is built. +# main()/ implementation + + CATCH_CONFIG_MAIN // Designates this as implementation file and defines main() + CATCH_CONFIG_RUNNER // Designates this as implementation file + +Although Catch is header only it still, internally, maintains a distinction between interface headers and headers that contain implementation. Only one source file in your test project should compile the implementation headers and this is controlled through the use of one of these macros - one of these identifiers should be defined before including Catch in *exactly one implementation file in your project*. + +# Prefixing Catch macros + + CATCH_CONFIG_PREFIX_ALL + +To keep test code clean and uncluttered Catch uses short macro names (e.g. ```TEST_CASE``` and ```REQUIRE```). Occasionally these may conflict with identifiers from platform headers or the system under test. In this case the above identifier can be defined. This will cause all the Catch user macros to be prefixed with ```CATCH_``` (e.g. ```CATCH_TEST_CASE``` and ```CATCH_REQUIRE```). + + # Terminal colour -Yes, I am English, so I will continue to spell "colour" with a 'u'. - -When sending output to the terminal, if it detects that it can, Catch will use colourised text. On Windows the Win32 API, ```SetConsoleTextAttribute```, is used. On POSIX systems ANSI colour escape codes are inserted into the stream. - -For finer control you can define one of the following identifiers (these are mutually exclusive - but that is not checked so may behave unexpectedly if you mix them): - CATCH_CONFIG_COLOUR_NONE // completely disables all text colouring CATCH_CONFIG_COLOUR_WINDOWS // forces the Win32 console API to be used CATCH_CONFIG_COLOUR_ANSI // forces ANSI colour codes to be used +Yes, I am English, so I will continue to spell "colour" with a 'u'. + +When sending output to the terminal, if it detects that it can, Catch will use colourised text. On Windows the Win32 API, ```SetConsoleTextAttribute```, is used. On POSIX systems ANSI colour escape codes are inserted into the stream. + +For finer control you can define one of the above identifiers (these are mutually exclusive - but that is not checked so may behave unexpectedly if you mix them): + Note that when ANSI colour codes are used "unistd.h" must be includable - along with a definition of ```isatty()``` Typically you should place the ```#define``` before #including "catch.hpp" in your main source file - but if you prefer you can define it for your whole project by whatever your IDE or build system provides for you to do so. +# Console width + + CATCH_CONFIG_CONSOLE_WIDTH = x // where x is a number + +Catch formats output intended for the console to fit within a fixed number of characters. This is especially important as indentation is used extensively and uncontrolled line wraps break this. +By default a console width of 80 is assumed but this can be controlled by defining the above identifier to be a different value. + +# stdout + + CATCH_CONFIG_NOSTDOUT + +Catch does not use ```std::cout``` and ```std::cerr``` directly but gets them from ```Catch::cout()``` and ```Catch::cerr()``` respectively. If the above identifier is defined these functions are left unimplemented and you must implement them yourself. Their signatures are: + + std::ostream& cout(); + std::ostream& cerr(); + +This can be useful on certain platforms that do not provide ```std::cout``` and ```std::cerr```, such as certain embedded systems. + +# C++ conformance toggles + + CATCH_CONFIG_CPP11_NULLPTR + CATCH_CONFIG_CPP11_NOEXCEPT + CATCH_CONFIG_SFINAE // Basic, C++03, support for SFINAE + CATCH_CONFIG_VARIADIC_MACROS // Usually pre-C++11 compiler extensions are sufficient + CATCH_CONFIG_NO_VARIADIC_MACROS // Suppress if Catch is too eager to enable it + +Catch has some basic compiler detection that will attempt to select the appropriate mix of these macros. However being incomplete - and often without access to the respective compilers - this detection tends to be conservative. +So overriding control is given to the user. If a compiler supports a feature (and Catch does not already detect it) then one or more of these may be defined to enable it (or suppress it, in some cases). If you do do this please raise an issue, specifying your compiler version (ideally with an idea of how to detect it) and stating that it has such support. + --- [Home](Readme.md) \ No newline at end of file From acf638f2bc87d0d5137af27f2750125117703774 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 17 Dec 2014 18:45:50 +0000 Subject: [PATCH 070/102] Added docs for floating point comparisons --- docs/assertions.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/docs/assertions.md b/docs/assertions.md index 5e839989..82bb96a3 100644 --- a/docs/assertions.md +++ b/docs/assertions.md @@ -17,12 +17,12 @@ The ```CHECK``` family are equivalent but execution continues in the same test c Evaluates the expression and records the result. If an exception is thrown it is caught, reported, and counted as a failure. These are the macros you will use most of the time Examples: - -```c++ +``` CHECK( str == "string value" ); CHECK( thisReturnsTrue() ); REQUIRE( i == 42 ); ``` + * **REQUIRE_FALSE(** _expression_ **)** and * **CHECK_FALSE(** _expression_ **)** @@ -30,10 +30,28 @@ Evaluates the expression and records the _logical NOT_ of the result. If an exce (these forms exist as a workaround for the fact that ! prefixed expressions cannot be decomposed). Example: -```c++ +``` REQUIRE_FALSE( thisReturnsFalse() ); ``` +### Floating point comparisons + +When comparing floating point numbers - especially if at least one of them has been computed - great care must be taken to allow for rounding errors and inexact representations. + +Catch provides a way to perform tolerant comparisons of floating point values through use of a wrapper class called ```Approx```. ```Approx``` can be used on either side of a comparison expression. It overloads the comparisons operators to take a tolerance into account. Here's a simple example: + +``` +REQUIRE( performComputation() == Approx( 2.1 ) ); +``` + +By default a small epsilon value is used that covers many simple cases of rounding errors. When this is insufficent the epsilon value (the amount within which a difference either way is ignored) can be specified by calling the ```epsilon()``` method on the ```Approx``` instance. e.g.: + +``` +REQUIRE( 22/7 == Approx( 3.141 ).epsilon( 0.01 ) ); +``` + +When dealing with very large or very small numbers it can be useful to specify a scale, which can be achieved by calling the ```scale()``` method on the ```Approx``` instance. + ## Exceptions * **REQUIRE_THROWS(** _expression_ **)** and From db0421e840a01125e0e52928de62cfd42c4dd5e4 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 19 Dec 2014 17:52:33 +0000 Subject: [PATCH 071/102] First commit of (in progress) TeamCity reporter Should run but is not complete --- include/catch.hpp | 8 +- include/internal/catch_interfaces_reporter.h | 1 + include/internal/catch_list.hpp | 2 +- include/reporters/catch_reporter_teamcity.hpp | 124 ++++++++++++++++++ projects/SelfTest/TestMain.cpp | 1 + .../CatchSelfTest.xcodeproj/project.pbxproj | 2 + 6 files changed, 133 insertions(+), 5 deletions(-) create mode 100644 include/reporters/catch_reporter_teamcity.hpp diff --git a/include/catch.hpp b/include/catch.hpp index 4251cd08..9f82c72d 100644 --- a/include/catch.hpp +++ b/include/catch.hpp @@ -11,11 +11,11 @@ #include "internal/catch_suppress_warnings.h" -#ifdef CATCH_CONFIG_MAIN -# define CATCH_CONFIG_RUNNER +#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) +# define CATCH_IMPL #endif -#ifdef CATCH_CONFIG_RUNNER +#ifdef CATCH_IMPL # ifndef CLARA_CONFIG_MAIN # define CLARA_CONFIG_MAIN_NOT_DEFINED # define CLARA_CONFIG_MAIN @@ -43,7 +43,7 @@ #include "internal/catch_objc.hpp" #endif -#ifdef CATCH_CONFIG_RUNNER +#ifdef CATCH_IMPL #include "internal/catch_impl.hpp" #endif diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h index 872b65c5..6e058bf0 100644 --- a/include/internal/catch_interfaces_reporter.h +++ b/include/internal/catch_interfaces_reporter.h @@ -238,6 +238,7 @@ namespace Catch virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0; + // The return value indicates if the messages buffer should be cleared: virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0; virtual void sectionEnded( SectionStats const& sectionStats ) = 0; virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0; diff --git a/include/internal/catch_list.hpp b/include/internal/catch_list.hpp index 34ffbc26..1c510ef8 100644 --- a/include/internal/catch_list.hpp +++ b/include/internal/catch_list.hpp @@ -139,7 +139,7 @@ namespace Catch { } inline std::size_t listReporters( Config const& /*config*/ ) { - Catch::cout() << "Available reports:\n"; + Catch::cout() << "Available reporters:\n"; IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); IReporterRegistry::FactoryMap::const_iterator itBegin = factories.begin(), itEnd = factories.end(), it; std::size_t maxNameLen = 0; diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp new file mode 100644 index 00000000..127ad7b6 --- /dev/null +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -0,0 +1,124 @@ +/* + * Created by Phil Nash on 19th December 2014 + * Copyright 2014 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ +#ifndef TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED +#define TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED + +#include "catch_reporter_bases.hpp" + +#include "../internal/catch_reporter_registrars.hpp" + +#include + +namespace Catch { + + struct TeamCityReporter : StreamingReporterBase { + TeamCityReporter( ReporterConfig const& _config ) + : StreamingReporterBase( _config ) + {} + + static bool replace( std::string& str, std::string const& replaceThis, std::string const& withThis ) { + std::size_t i = str.find( replaceThis ); + if( i != std::string::npos ) { + str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() ); + return true; + } + return false; + } + static std::string escape( std::string const& str ) { + std::string escaped = str; + while( replace( escaped, "\'", "|\'" ) || + replace( escaped, "\n", "|n" ) || + replace( escaped, "\r", "|r" ) || + replace( escaped, "|", "||" ) || + replace( escaped, "[", "|[" ) || + replace( escaped, "]", "|]" ) ); + return escaped; + } + virtual ~TeamCityReporter(); + + static std::string getDescription() { + return "Reports test results as TeamCity service messages"; + } + virtual ReporterPreferences getPreferences() const { + ReporterPreferences prefs; + prefs.shouldRedirectStdOut = true; + return prefs; + } + + // !TBD: ignored tests + + virtual void noMatchingTestCases( std::string const& /* spec */ ) {} + + virtual void testGroupStarting( GroupInfo const& groupInfo ) { + StreamingReporterBase::testGroupStarting( groupInfo ); + stream << "##teamcity[testSuiteStarted name='" + << escape( groupInfo.name ) << "']\n"; + } + virtual void testGroupEnded( TestGroupStats const& testGroupStats ) { + StreamingReporterBase::testGroupEnded( testGroupStats ); + stream << "##teamcity[testSuiteFinished name='" + << escape( testGroupStats.groupInfo.name ) << "']\n"; + } + + + virtual void assertionStarting( AssertionInfo const& ) { + } + + virtual bool assertionEnded( AssertionStats const& assertionStats ) { + if( !assertionStats.assertionResult.isOk() ) { + stream << "##teamcity[testFailed" + << " name='" << escape( currentTestCaseInfo->name )<< "'" + << " message='message here'" // !TBD + << " details='details?'" // !TBD + << "]\n"; + } + return true; + } + +// virtual void sectionStarting( SectionInfo const& _sectionInfo ) { +// // !TBD +// } +// virtual void sectionEnded( SectionStats const& _sectionStats ) { +// // !TBD +// } + + virtual void testCaseStarting( TestCaseInfo const& testInfo ) { + StreamingReporterBase::testCaseStarting( testInfo ); + stream << "##teamcity[testStarted name='" + << escape( testInfo.name ) << "']\n"; + } + virtual void testCaseEnded( TestCaseStats const& testCaseStats ) { + StreamingReporterBase::testCaseEnded( testCaseStats ); + if( !testCaseStats.stdOut.empty() ) + stream << "##teamcity[testStdOut name='" + << escape( testCaseStats.testInfo.name ) + << "' out='" << escape( testCaseStats.stdOut ) << "']\n"; + if( !testCaseStats.stdErr.empty() ) + stream << "##teamcity[testStdErr name='" + << escape( testCaseStats.testInfo.name ) + << "' out='" << escape( testCaseStats.stdErr ) << "']\n"; + stream << "##teamcity[testFinished name='" + << escape( testCaseStats.testInfo.name ) << "']\n"; + } +// virtual void testRunEnded( TestRunStats const& _testRunStats ) { +// // !TBD +// } + + private: + + }; + +#ifdef CATCH_IMPL + TeamCityReporter::~TeamCityReporter() {} +#endif + + INTERNAL_CATCH_REGISTER_REPORTER( "teamcity", TeamCityReporter ) + +} // end namespace Catch + +#endif // TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index b6fc8690..69176788 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -8,6 +8,7 @@ #define CATCH_CONFIG_MAIN #include "catch.hpp" +#include "reporters/catch_reporter_teamcity.hpp" // Some example tag aliases CATCH_REGISTER_TAG_ALIAS( "[@nhf]", "[failing]~[.]" ) diff --git a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj index 70f402e1..e4b59f56 100644 --- a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj +++ b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj @@ -96,6 +96,7 @@ 26847E5C16BBACB60043B9C1 /* catch_message.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_message.hpp; sourceTree = ""; }; 26847E5D16BBADB40043B9C1 /* catch_message.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_message.cpp; path = ../../../SelfTest/SurrogateCpps/catch_message.cpp; sourceTree = ""; }; 268F47B018A93F7800D8C14F /* catch_clara.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_clara.h; sourceTree = ""; }; + 2691574A1A4480C50054F1ED /* catch_reporter_teamcity.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_reporter_teamcity.hpp; sourceTree = ""; }; 26926E8318D7777D004E10F2 /* clara.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = clara.h; path = ../../../../include/external/clara.h; sourceTree = ""; }; 26926E8418D77809004E10F2 /* tbc_text_format.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tbc_text_format.h; path = ../../../../include/external/tbc_text_format.h; sourceTree = ""; }; 26948284179A9AB900ED166E /* SectionTrackerTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SectionTrackerTests.cpp; path = ../../../SelfTest/SectionTrackerTests.cpp; sourceTree = ""; }; @@ -313,6 +314,7 @@ 4A6D0C67149B3E3D00DB3EAA /* catch_reporter_junit.hpp */, 4A6D0C68149B3E3D00DB3EAA /* catch_reporter_xml.hpp */, 4AB42F84166F3E1A0099F2C8 /* catch_reporter_console.hpp */, + 2691574A1A4480C50054F1ED /* catch_reporter_teamcity.hpp */, ); name = reporters; path = ../../../../include/reporters; From 458b3ae257d46cecd8bc555a9ea59284997f12e4 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 19 Dec 2014 18:16:19 +0000 Subject: [PATCH 072/102] Fixed replace(inPlace) function and added tests (should have done that in the first place - I'll never learn!) --- include/internal/catch_common.h | 1 + include/internal/catch_common.hpp | 16 ++++++++++- include/reporters/catch_reporter_teamcity.hpp | 20 ++++--------- projects/SelfTest/TestMain.cpp | 28 +++++++++++++++++++ 4 files changed, 50 insertions(+), 15 deletions(-) diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h index 2001c297..68d23688 100644 --- a/include/internal/catch_common.h +++ b/include/internal/catch_common.h @@ -71,6 +71,7 @@ namespace Catch { void toLowerInPlace( std::string& s ); std::string toLower( std::string const& s ); std::string trim( std::string const& str ); + bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ); struct pluralise { pluralise( std::size_t count, std::string const& label ); diff --git a/include/internal/catch_common.hpp b/include/internal/catch_common.hpp index 6147aa5f..29e9ed5a 100644 --- a/include/internal/catch_common.hpp +++ b/include/internal/catch_common.hpp @@ -36,7 +36,21 @@ namespace Catch { return start != std::string::npos ? str.substr( start, 1+end-start ) : ""; } - + + bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) { + bool replaced = false; + std::size_t i = str.find( replaceThis ); + while( i != std::string::npos ) { + replaced = true; + str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() ); + if( i < str.size()-withThis.size() ) + i = str.find( replaceThis, i+withThis.size() ); + else + i = std::string::npos; + } + return replaced; + } + pluralise::pluralise( std::size_t count, std::string const& label ) : m_count( count ), m_label( label ) diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp index 127ad7b6..2de57d6a 100644 --- a/include/reporters/catch_reporter_teamcity.hpp +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -21,22 +21,14 @@ namespace Catch { : StreamingReporterBase( _config ) {} - static bool replace( std::string& str, std::string const& replaceThis, std::string const& withThis ) { - std::size_t i = str.find( replaceThis ); - if( i != std::string::npos ) { - str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() ); - return true; - } - return false; - } static std::string escape( std::string const& str ) { std::string escaped = str; - while( replace( escaped, "\'", "|\'" ) || - replace( escaped, "\n", "|n" ) || - replace( escaped, "\r", "|r" ) || - replace( escaped, "|", "||" ) || - replace( escaped, "[", "|[" ) || - replace( escaped, "]", "|]" ) ); + replaceInPlace( escaped, "\'", "|\'" ); + replaceInPlace( escaped, "\n", "|n" ); + replaceInPlace( escaped, "\r", "|r" ); + replaceInPlace( escaped, "|", "||" ); + replaceInPlace( escaped, "[", "|[" ); + replaceInPlace( escaped, "]", "|]" ); return escaped; } virtual ~TeamCityReporter(); diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index 69176788..154a2994 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -348,6 +348,34 @@ private: std::vector colours; }; +TEST_CASE( "replaceInPlace", "" ) { + std::string letters = "abcdefcg"; + SECTION( "replace single char" ) { + CHECK( replaceInPlace( letters, "b", "z" ) ); + CHECK( letters == "azcdefcg" ); + } + SECTION( "replace two chars" ) { + CHECK( replaceInPlace( letters, "c", "z" ) ); + CHECK( letters == "abzdefzg" ); + } + SECTION( "replace first char" ) { + CHECK( replaceInPlace( letters, "a", "z" ) ); + CHECK( letters == "zbcdefcg" ); + } + SECTION( "replace last char" ) { + CHECK( replaceInPlace( letters, "g", "z" ) ); + CHECK( letters == "abcdefcz" ); + } + SECTION( "replace all chars" ) { + CHECK( replaceInPlace( letters, letters, "replaced" ) ); + CHECK( letters == "replaced" ); + } + SECTION( "replace no chars" ) { + CHECK_FALSE( replaceInPlace( letters, "x", "z" ) ); + CHECK( letters == letters ); + } +} + // !TBD: This will be folded into Text class TEST_CASE( "Strings can be rendered with colour", "[.colour]" ) { From 7306eb3cfcf36b8f4d8ff478a25be358b1651ef0 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 19 Dec 2014 19:05:24 +0000 Subject: [PATCH 073/102] TeamCity reporter added more detail to the assertion message --- include/reporters/catch_reporter_teamcity.hpp | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp index 2de57d6a..16215e7a 100644 --- a/include/reporters/catch_reporter_teamcity.hpp +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -62,11 +62,61 @@ namespace Catch { } virtual bool assertionEnded( AssertionStats const& assertionStats ) { - if( !assertionStats.assertionResult.isOk() ) { + AssertionResult const& result = assertionStats.assertionResult; + if( !result.isOk() ) { + + std::string message; + switch( result.getResultType() ) { + case ResultWas::ExpressionFailed: + message = "expression failed"; + break; + case ResultWas::ThrewException: + message = "unexpected exception with message"; + break; + case ResultWas::FatalErrorCondition: + message = "fatal error condition"; + break; + case ResultWas::DidntThrowException: + message = "no exception was thrown where one was expected"; + break; + case ResultWas::ExplicitFailure: + message = "explicit failure"; + break; + + // We shouldn't get here because of the isOk() test + case ResultWas::Ok: + case ResultWas::Info: + case ResultWas::Warning: + + // These cases are here to prevent compiler warnings + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + CATCH_NOT_IMPLEMENTED; + } + if( assertionStats.infoMessages.size() == 1 ) + message += " with message:"; + if( assertionStats.infoMessages.size() > 1 ) + message += " with messages:"; + for( std::vector::const_iterator + it = assertionStats.infoMessages.begin(), + itEnd = assertionStats.infoMessages.end(); + it != itEnd; + ++it ) + message += "\n" + it->message; + + + std::string details = + " " + result.getExpressionInMacro() + "\n" + + "with expansion:\n" + + " " + result.getExpandedExpression() + "\n"; + + // !TBD: file/ line + stream << "##teamcity[testFailed" << " name='" << escape( currentTestCaseInfo->name )<< "'" - << " message='message here'" // !TBD - << " details='details?'" // !TBD + << " message='" << escape( message ) << "'" + << " details='" << escape( details ) << "'" << "]\n"; } return true; From 3724463be71405378ce6b813f44961709138911c Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 19 Dec 2014 19:24:41 +0000 Subject: [PATCH 074/102] Fixed escape order and expression reporting --- include/reporters/catch_reporter_teamcity.hpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp index 16215e7a..30cda566 100644 --- a/include/reporters/catch_reporter_teamcity.hpp +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -23,10 +23,10 @@ namespace Catch { static std::string escape( std::string const& str ) { std::string escaped = str; + replaceInPlace( escaped, "|", "||" ); replaceInPlace( escaped, "\'", "|\'" ); replaceInPlace( escaped, "\n", "|n" ); replaceInPlace( escaped, "\r", "|r" ); - replaceInPlace( escaped, "|", "||" ); replaceInPlace( escaped, "[", "|[" ); replaceInPlace( escaped, "]", "|]" ); return escaped; @@ -66,12 +66,13 @@ namespace Catch { if( !result.isOk() ) { std::string message; + std::string details; switch( result.getResultType() ) { case ResultWas::ExpressionFailed: message = "expression failed"; break; case ResultWas::ThrewException: - message = "unexpected exception with message"; + message = "unexpected exception"; break; case ResultWas::FatalErrorCondition: message = "fatal error condition"; @@ -106,10 +107,12 @@ namespace Catch { message += "\n" + it->message; - std::string details = - " " + result.getExpressionInMacro() + "\n" + - "with expansion:\n" + - " " + result.getExpandedExpression() + "\n"; + if( !result.hasExpression() ) { + details = + " " + result.getExpressionInMacro() + "\n" + "with expansion:\n" + + " " + result.getExpandedExpression() + "\n"; + } // !TBD: file/ line From 5933d75cdcebecc6fc5f43a37fd7ec53b0759d66 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 19 Dec 2014 19:25:53 +0000 Subject: [PATCH 075/102] Fixed HasExpression check classic spurious ! prefix --- include/reporters/catch_reporter_teamcity.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp index 30cda566..f436567d 100644 --- a/include/reporters/catch_reporter_teamcity.hpp +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -107,7 +107,7 @@ namespace Catch { message += "\n" + it->message; - if( !result.hasExpression() ) { + if( result.hasExpression() ) { details = " " + result.getExpressionInMacro() + "\n" "with expansion:\n" + From 8ec959e936a94d2a465669cb1e34d6e947e0e4b1 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Sat, 20 Dec 2014 00:46:02 +0000 Subject: [PATCH 076/102] TeamCity reporter work expanded reporting - includes section headers --- include/reporters/catch_reporter_bases.hpp | 10 +++ include/reporters/catch_reporter_console.hpp | 9 -- include/reporters/catch_reporter_teamcity.hpp | 88 ++++++++++++++----- projects/SelfTest/TrickyTests.cpp | 4 +- 4 files changed, 78 insertions(+), 33 deletions(-) diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp index ddbc63b7..25f320b3 100644 --- a/include/reporters/catch_reporter_bases.hpp +++ b/include/reporters/catch_reporter_bases.hpp @@ -198,6 +198,16 @@ namespace Catch { }; + template + char const* getLineOfChars() { + static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0}; + if( !*line ) { + memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 ); + line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0; + } + return line; + } + } // end namespace Catch #endif // TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp index 7c0a23bf..9fde2037 100644 --- a/include/reporters/catch_reporter_console.hpp +++ b/include/reporters/catch_reporter_console.hpp @@ -445,15 +445,6 @@ namespace Catch { void printSummaryDivider() { stream << getLineOfChars<'-'>() << "\n"; } - template - static char const* getLineOfChars() { - static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0}; - if( !*line ) { - memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 ); - line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0; - } - return line; - } private: bool m_headerPrinted; diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp index f436567d..47eafb19 100644 --- a/include/reporters/catch_reporter_teamcity.hpp +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -18,7 +18,8 @@ namespace Catch { struct TeamCityReporter : StreamingReporterBase { TeamCityReporter( ReporterConfig const& _config ) - : StreamingReporterBase( _config ) + : StreamingReporterBase( _config ), + m_headerPrintedForThisSection( false ) {} static std::string escape( std::string const& str ) { @@ -65,23 +66,26 @@ namespace Catch { AssertionResult const& result = assertionStats.assertionResult; if( !result.isOk() ) { - std::string message; - std::string details; + std::ostringstream msg; + if( !m_headerPrintedForThisSection ) + printTestCaseAndSectionHeader( msg ); + m_headerPrintedForThisSection = true; + switch( result.getResultType() ) { case ResultWas::ExpressionFailed: - message = "expression failed"; + msg << "expression failed"; break; case ResultWas::ThrewException: - message = "unexpected exception"; + msg << "unexpected exception"; break; case ResultWas::FatalErrorCondition: - message = "fatal error condition"; + msg << "fatal error condition"; break; case ResultWas::DidntThrowException: - message = "no exception was thrown where one was expected"; + msg << "no exception was thrown where one was expected"; break; case ResultWas::ExplicitFailure: - message = "explicit failure"; + msg << "explicit failure"; break; // We shouldn't get here because of the isOk() test @@ -96,38 +100,38 @@ namespace Catch { CATCH_NOT_IMPLEMENTED; } if( assertionStats.infoMessages.size() == 1 ) - message += " with message:"; + msg << " with message:"; if( assertionStats.infoMessages.size() > 1 ) - message += " with messages:"; + msg << " with messages:"; for( std::vector::const_iterator it = assertionStats.infoMessages.begin(), itEnd = assertionStats.infoMessages.end(); it != itEnd; ++it ) - message += "\n" + it->message; + msg << "\n \"" << it->message << "\""; if( result.hasExpression() ) { - details = - " " + result.getExpressionInMacro() + "\n" - "with expansion:\n" + - " " + result.getExpandedExpression() + "\n"; + msg << + "\n " << result.getExpressionInMacro() << "\n" + "with expansion:\n" << + " " << result.getExpandedExpression() << "\n"; } - - // !TBD: file/ line + msg << "\n" << result.getSourceInfo() << "\n"; + msg << "---------------------------------------"; stream << "##teamcity[testFailed" << " name='" << escape( currentTestCaseInfo->name )<< "'" - << " message='" << escape( message ) << "'" - << " details='" << escape( details ) << "'" + << " message='" << escape( msg.str() ) << "'" << "]\n"; } return true; } -// virtual void sectionStarting( SectionInfo const& _sectionInfo ) { -// // !TBD -// } + virtual void sectionStarting( SectionInfo const& sectionInfo ) { + m_headerPrintedForThisSection = false; + StreamingReporterBase::sectionStarting( sectionInfo ); + } // virtual void sectionEnded( SectionStats const& _sectionStats ) { // // !TBD // } @@ -155,6 +159,46 @@ namespace Catch { // } private: + void printTestCaseAndSectionHeader( std::ostream& os ) { + assert( !m_sectionStack.empty() ); + printOpenHeader( os, currentTestCaseInfo->name ); + + if( m_sectionStack.size() > 1 ) { + std::vector::const_iterator + it = m_sectionStack.begin()+1, // Skip first section (test case) + itEnd = m_sectionStack.end(); + for( ; it != itEnd; ++it ) + printHeaderString( os, it->name, 2 ); + } + + SourceLineInfo lineInfo = m_sectionStack.front().lineInfo; + + if( !lineInfo.empty() ){ + os << getLineOfChars<'-'>() << "\n"; + os << lineInfo << "\n"; + } + os << getLineOfChars<'.'>() << "\n\n"; + } + + void printOpenHeader( std::ostream& os, std::string const& _name ) { + os << getLineOfChars<'-'>() << "\n"; + printHeaderString( os, _name ); + } + + // if string has a : in first line will set indent to follow it on + // subsequent lines + void printHeaderString( std::ostream& os, std::string const& _string, std::size_t indent = 0 ) { + std::size_t i = _string.find( ": " ); + if( i != std::string::npos ) + i+=2; + else + i = 0; + os << Text( _string, TextAttributes() + .setIndent( indent+i) + .setInitialIndent( indent ) ) << "\n"; + } + private: + bool m_headerPrintedForThisSection; }; diff --git a/projects/SelfTest/TrickyTests.cpp b/projects/SelfTest/TrickyTests.cpp index a1676570..4fe2c0ba 100644 --- a/projects/SelfTest/TrickyTests.cpp +++ b/projects/SelfTest/TrickyTests.cpp @@ -81,7 +81,7 @@ struct Opaque /////////////////////////////////////////////////////////////////////////////// TEST_CASE ( - "A failing expression with a non streamable type is still captured[failing]", + "A failing expression with a non streamable type is still captured", "[Tricky][failing][.]" ) { @@ -97,7 +97,7 @@ TEST_CASE /////////////////////////////////////////////////////////////////////////////// TEST_CASE ( - "string literals of different sizes can be compared[failing]", + "string literals of different sizes can be compared", "[Tricky][failing][.]" ) { From 2771220a41ebe52efc94be80ee5f391324e9adea Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Sat, 20 Dec 2014 01:02:17 +0000 Subject: [PATCH 077/102] Cleaned up section headers - and don't reprint test case name --- include/reporters/catch_reporter_teamcity.hpp | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp index 47eafb19..ffb9bf5c 100644 --- a/include/reporters/catch_reporter_teamcity.hpp +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -68,9 +68,11 @@ namespace Catch { std::ostringstream msg; if( !m_headerPrintedForThisSection ) - printTestCaseAndSectionHeader( msg ); + printSectionHeader( msg ); m_headerPrintedForThisSection = true; + msg << result.getSourceInfo() << "\n"; + switch( result.getResultType() ) { case ResultWas::ExpressionFailed: msg << "expression failed"; @@ -117,8 +119,6 @@ namespace Catch { "with expansion:\n" << " " << result.getExpandedExpression() << "\n"; } - msg << "\n" << result.getSourceInfo() << "\n"; - msg << "---------------------------------------"; stream << "##teamcity[testFailed" << " name='" << escape( currentTestCaseInfo->name )<< "'" @@ -159,32 +159,27 @@ namespace Catch { // } private: - void printTestCaseAndSectionHeader( std::ostream& os ) { + void printSectionHeader( std::ostream& os ) { assert( !m_sectionStack.empty() ); - printOpenHeader( os, currentTestCaseInfo->name ); - + if( m_sectionStack.size() > 1 ) { + os << getLineOfChars<'-'>() << "\n"; + std::vector::const_iterator it = m_sectionStack.begin()+1, // Skip first section (test case) itEnd = m_sectionStack.end(); for( ; it != itEnd; ++it ) - printHeaderString( os, it->name, 2 ); + printHeaderString( os, it->name ); + os << getLineOfChars<'-'>() << "\n"; } SourceLineInfo lineInfo = m_sectionStack.front().lineInfo; - if( !lineInfo.empty() ){ - os << getLineOfChars<'-'>() << "\n"; + if( !lineInfo.empty() ) os << lineInfo << "\n"; - } os << getLineOfChars<'.'>() << "\n\n"; } - void printOpenHeader( std::ostream& os, std::string const& _name ) { - os << getLineOfChars<'-'>() << "\n"; - printHeaderString( os, _name ); - } - // if string has a : in first line will set indent to follow it on // subsequent lines void printHeaderString( std::ostream& os, std::string const& _string, std::size_t indent = 0 ) { From 3f9e3e21ea8240923afe8c63f21f55d221041fc5 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Sun, 21 Dec 2014 00:17:45 +0000 Subject: [PATCH 078/102] Some clean-up ready for first push to GitHub --- include/reporters/catch_reporter_teamcity.hpp | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp index ffb9bf5c..364b6281 100644 --- a/include/reporters/catch_reporter_teamcity.hpp +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -14,6 +14,11 @@ #include +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + namespace Catch { struct TeamCityReporter : StreamingReporterBase { @@ -132,15 +137,13 @@ namespace Catch { m_headerPrintedForThisSection = false; StreamingReporterBase::sectionStarting( sectionInfo ); } -// virtual void sectionEnded( SectionStats const& _sectionStats ) { -// // !TBD -// } - + virtual void testCaseStarting( TestCaseInfo const& testInfo ) { StreamingReporterBase::testCaseStarting( testInfo ); stream << "##teamcity[testStarted name='" << escape( testInfo.name ) << "']\n"; } + virtual void testCaseEnded( TestCaseStats const& testCaseStats ) { StreamingReporterBase::testCaseEnded( testCaseStats ); if( !testCaseStats.stdOut.empty() ) @@ -154,10 +157,7 @@ namespace Catch { stream << "##teamcity[testFinished name='" << escape( testCaseStats.testInfo.name ) << "']\n"; } -// virtual void testRunEnded( TestRunStats const& _testRunStats ) { -// // !TBD -// } - + private: void printSectionHeader( std::ostream& os ) { assert( !m_sectionStack.empty() ); @@ -205,4 +205,8 @@ namespace Catch { } // end namespace Catch +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + #endif // TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED From 3dc3763b07dd3010881bc0b21c8163dbc49e795d Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Sun, 21 Dec 2014 00:20:09 +0000 Subject: [PATCH 079/102] Rebased --- .../Baselines/console.std.approved.txt | 8 +- .../Baselines/console.sw.approved.txt | 122 ++++++++++++++++- .../SelfTest/Baselines/junit.sw.approved.txt | 12 +- .../SelfTest/Baselines/xml.sw.approved.txt | 125 +++++++++++++++++- 4 files changed, 252 insertions(+), 15 deletions(-) diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index a97b7a3a..5c9783cb 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -759,7 +759,7 @@ warning: error ------------------------------------------------------------------------------- -A failing expression with a non streamable type is still captured[failing] +A failing expression with a non streamable type is still captured ------------------------------------------------------------------------------- TrickyTests.cpp: ............................................................................... @@ -775,7 +775,7 @@ with expansion: {?} == {?} ------------------------------------------------------------------------------- -string literals of different sizes can be compared[failing] +string literals of different sizes can be compared ------------------------------------------------------------------------------- TrickyTests.cpp: ............................................................................... @@ -786,6 +786,6 @@ with expansion: "first" == "second" =============================================================================== -test cases: 148 | 109 passed | 38 failed | 1 failed as expected -assertions: 739 | 647 passed | 79 failed | 13 failed as expected +test cases: 149 | 110 passed | 38 failed | 1 failed as expected +assertions: 751 | 659 passed | 79 failed | 13 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 7f6be8ec..682a2ac7 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -4518,6 +4518,120 @@ with expansion: five six" +------------------------------------------------------------------------------- +replaceInPlace + replace single char +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( replaceInPlace( letters, "b", "z" ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( letters == "azcdefcg" ) +with expansion: + "azcdefcg" == "azcdefcg" + +------------------------------------------------------------------------------- +replaceInPlace + replace two chars +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( replaceInPlace( letters, "c", "z" ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( letters == "abzdefzg" ) +with expansion: + "abzdefzg" == "abzdefzg" + +------------------------------------------------------------------------------- +replaceInPlace + replace first char +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( replaceInPlace( letters, "a", "z" ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( letters == "zbcdefcg" ) +with expansion: + "zbcdefcg" == "zbcdefcg" + +------------------------------------------------------------------------------- +replaceInPlace + replace last char +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( replaceInPlace( letters, "g", "z" ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( letters == "abcdefcz" ) +with expansion: + "abcdefcz" == "abcdefcz" + +------------------------------------------------------------------------------- +replaceInPlace + replace all chars +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( replaceInPlace( letters, letters, "replaced" ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( letters == "replaced" ) +with expansion: + "replaced" == "replaced" + +------------------------------------------------------------------------------- +replaceInPlace + replace no chars +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_FALSE( replaceInPlace( letters, "x", "z" ) ) +with expansion: + !false + +TestMain.cpp:: +PASSED: + CHECK( letters == letters ) +with expansion: + "abcdefcg" == "abcdefcg" + hello hello ------------------------------------------------------------------------------- @@ -5604,7 +5718,7 @@ warning: No assertions in test case 'Where the LHS is not a simple value[failing]' ------------------------------------------------------------------------------- -A failing expression with a non streamable type is still captured[failing] +A failing expression with a non streamable type is still captured ------------------------------------------------------------------------------- TrickyTests.cpp: ............................................................................... @@ -5620,7 +5734,7 @@ with expansion: {?} == {?} ------------------------------------------------------------------------------- -string literals of different sizes can be compared[failing] +string literals of different sizes can be compared ------------------------------------------------------------------------------- TrickyTests.cpp: ............................................................................... @@ -7683,6 +7797,6 @@ with expansion: true =============================================================================== -test cases: 148 | 93 passed | 54 failed | 1 failed as expected -assertions: 759 | 647 passed | 99 failed | 13 failed as expected +test cases: 149 | 94 passed | 54 failed | 1 failed as expected +assertions: 771 | 659 passed | 99 failed | 13 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 7529791d..b65529c7 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,5 +1,5 @@ - + @@ -485,6 +485,12 @@ MiscTests.cpp: + + + + + + hello @@ -496,7 +502,7 @@ hello - + TrickyTests.cpp: @@ -504,7 +510,7 @@ TrickyTests.cpp: TrickyTests.cpp: - + TrickyTests.cpp: diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 612ed0bf..54ac8624 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -4714,6 +4714,123 @@ four"
+ +
+ + + replaceInPlace( letters, "b", "z" ) + + + true + + + + + letters == "azcdefcg" + + + "azcdefcg" == "azcdefcg" + + + +
+
+ + + replaceInPlace( letters, "c", "z" ) + + + true + + + + + letters == "abzdefzg" + + + "abzdefzg" == "abzdefzg" + + + +
+
+ + + replaceInPlace( letters, "a", "z" ) + + + true + + + + + letters == "zbcdefcg" + + + "zbcdefcg" == "zbcdefcg" + + + +
+
+ + + replaceInPlace( letters, "g", "z" ) + + + true + + + + + letters == "abcdefcz" + + + "abcdefcz" == "abcdefcz" + + + +
+
+ + + replaceInPlace( letters, letters, "replaced" ) + + + true + + + + + letters == "replaced" + + + "replaced" == "replaced" + + + +
+
+ + + !replaceInPlace( letters, "x", "z" ) + + + !false + + + + + letters == letters + + + "abcdefcg" == "abcdefcg" + + + +
+ +
@@ -5774,7 +5891,7 @@ there" - + &o1 == &o2 @@ -5793,7 +5910,7 @@ there" - + std::string( "first" ) == "second" @@ -7950,7 +8067,7 @@ there"
- + - + From 576aff60858785d62cfcd93f22df081665cb89e9 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Sun, 21 Dec 2014 00:21:23 +0000 Subject: [PATCH 080/102] build 10 First cut of TeamCity reporter --- README.md | 2 +- include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 51 ++++++++++++++++++++---------- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 828a43a1..26e771da 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![catch logo](catch-logo-small.png) -*v1.1 build 9 (develop branch)* +*v1.1 build 10 (develop branch)* Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index e0794fad..40633707 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -13,7 +13,7 @@ namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 9, "develop" ); + Version libraryVersion( 1, 1, 10, "develop" ); } #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 0f840bc9..3babc0e1 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * CATCH v1.1 build 9 (develop branch) - * Generated: 2014-12-15 07:26:07.689692 + * CATCH v1.1 build 10 (develop branch) + * Generated: 2014-12-21 00:20:17.212897 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -33,11 +33,11 @@ #pragma GCC diagnostic ignored "-Wpadded" #endif -#ifdef CATCH_CONFIG_MAIN -# define CATCH_CONFIG_RUNNER +#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) +# define CATCH_IMPL #endif -#ifdef CATCH_CONFIG_RUNNER +#ifdef CATCH_IMPL # ifndef CLARA_CONFIG_MAIN # define CLARA_CONFIG_MAIN_NOT_DEFINED # define CLARA_CONFIG_MAIN @@ -227,6 +227,7 @@ namespace Catch { void toLowerInPlace( std::string& s ); std::string toLower( std::string const& s ); std::string trim( std::string const& str ); + bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ); struct pluralise { pluralise( std::size_t count, std::string const& label ); @@ -2737,7 +2738,7 @@ return @ desc; \ #endif -#ifdef CATCH_CONFIG_RUNNER +#ifdef CATCH_IMPL // #included from: internal/catch_impl.hpp #define TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED @@ -4676,6 +4677,7 @@ namespace Catch virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0; + // The return value indicates if the messages buffer should be cleared: virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0; virtual void sectionEnded( SectionStats const& sectionStats ) = 0; virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0; @@ -4824,7 +4826,7 @@ namespace Catch { } inline std::size_t listReporters( Config const& /*config*/ ) { - Catch::cout() << "Available reports:\n"; + Catch::cout() << "Available reporters:\n"; IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); IReporterRegistry::FactoryMap::const_iterator itBegin = factories.begin(), itEnd = factories.end(), it; std::size_t maxNameLen = 0; @@ -6669,7 +6671,7 @@ namespace Catch { namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 9, "develop" ); + Version libraryVersion( 1, 1, 10, "develop" ); } // #included from: catch_message.hpp @@ -6912,6 +6914,20 @@ namespace Catch { return start != std::string::npos ? str.substr( start, 1+end-start ) : ""; } + bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) { + bool replaced = false; + std::size_t i = str.find( replaceThis ); + while( i != std::string::npos ) { + replaced = true; + str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() ); + if( i < str.size()-withThis.size() ) + i = str.find( replaceThis, i+withThis.size() ); + else + i = std::string::npos; + } + return replaced; + } + pluralise::pluralise( std::size_t count, std::string const& label ) : m_count( count ), m_label( label ) @@ -7652,6 +7668,16 @@ namespace Catch { }; + template + char const* getLineOfChars() { + static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0}; + if( !*line ) { + memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 ); + line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0; + } + return line; + } + } // end namespace Catch // #included from: ../internal/catch_reporter_registrars.hpp @@ -8724,15 +8750,6 @@ namespace Catch { void printSummaryDivider() { stream << getLineOfChars<'-'>() << "\n"; } - template - static char const* getLineOfChars() { - static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0}; - if( !*line ) { - memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 ); - line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0; - } - return line; - } private: bool m_headerPrinted; From a9f16b18f7b3b7df2e99c11c6ee21205c613c5f7 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 22 Dec 2014 07:42:25 +0000 Subject: [PATCH 081/102] Fix memset build error Moved #include to catch_reporter_bases.hpp --- include/reporters/catch_reporter_bases.hpp | 2 ++ include/reporters/catch_reporter_console.hpp | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp index 25f320b3..771d1d68 100644 --- a/include/reporters/catch_reporter_bases.hpp +++ b/include/reporters/catch_reporter_bases.hpp @@ -10,6 +10,8 @@ #include "../internal/catch_interfaces_reporter.h" +#include + namespace Catch { struct StreamingReporterBase : SharedImpl { diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp index 9fde2037..16896f4c 100644 --- a/include/reporters/catch_reporter_console.hpp +++ b/include/reporters/catch_reporter_console.hpp @@ -13,8 +13,6 @@ #include "../internal/catch_reporter_registrars.hpp" #include "../internal/catch_console_colour.hpp" -#include - namespace Catch { struct ConsoleReporter : StreamingReporterBase { From b771394e00d1d296dc8b6862c8d0deff15cd4e6a Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 22 Dec 2014 07:42:57 +0000 Subject: [PATCH 082/102] regenerated single include --- single_include/catch.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 3babc0e1..1f20000a 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* * CATCH v1.1 build 10 (develop branch) - * Generated: 2014-12-21 00:20:17.212897 + * Generated: 2014-12-22 07:42:39.411909 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -7481,6 +7481,8 @@ namespace Catch { // #included from: catch_reporter_bases.hpp #define TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED +#include + namespace Catch { struct StreamingReporterBase : SharedImpl { @@ -8318,8 +8320,6 @@ namespace Catch { // #included from: ../reporters/catch_reporter_console.hpp #define TWOBLUECUBES_CATCH_REPORTER_CONSOLE_HPP_INCLUDED -#include - namespace Catch { struct ConsoleReporter : StreamingReporterBase { From 58dcb5ea928024544039babe8cdafcaf0c78c5ea Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 22 Dec 2014 19:45:16 +0000 Subject: [PATCH 083/102] Removed #includes for Catch headers see comment in file for details --- include/reporters/catch_reporter_teamcity.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp index 364b6281..6e608d42 100644 --- a/include/reporters/catch_reporter_teamcity.hpp +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -8,9 +8,11 @@ #ifndef TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED #define TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED -#include "catch_reporter_bases.hpp" - -#include "../internal/catch_reporter_registrars.hpp" +// Don't #include any Catch headers here - we can assume they are already +// included before this header. +// This is not good practice in general but is necessary in this case so this +// file can be distributed as a single header that works with the main +// Catch single header. #include From 7619920f860645dbd1d71ec44c9f76893bdff2f1 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 22 Dec 2014 20:10:33 +0000 Subject: [PATCH 084/102] Support for reporting skipped tests - implemented by TeamCity reporter --- include/catch_runner.hpp | 8 +++++++ include/internal/catch_interfaces_reporter.h | 2 ++ include/internal/catch_interfaces_testcase.h | 2 +- .../internal/catch_legacy_reporter_adapter.h | 1 + .../catch_legacy_reporter_adapter.hpp | 2 ++ .../catch_test_case_registry_impl.hpp | 23 +++++++++++-------- include/reporters/catch_reporter_bases.hpp | 7 ++++++ include/reporters/catch_reporter_teamcity.hpp | 12 ++++++++-- 8 files changed, 45 insertions(+), 12 deletions(-) diff --git a/include/catch_runner.hpp b/include/catch_runner.hpp index 67f94e3e..bf03ccdf 100644 --- a/include/catch_runner.hpp +++ b/include/catch_runner.hpp @@ -60,6 +60,14 @@ namespace Catch { m_testsAlreadyRun.insert( *it ); } } + std::vector skippedTestCases; + getRegistryHub().getTestCaseRegistry().getFilteredTests( testSpec, *m_config, skippedTestCases, true ); + + for( std::vector::const_iterator it = skippedTestCases.begin(), itEnd = skippedTestCases.end(); + it != itEnd; + ++it ) + m_reporter->skipTest( *it ); + context.testGroupEnded( "all tests", totals, 1, 1 ); return totals; } diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h index 6e058bf0..5296177a 100644 --- a/include/internal/catch_interfaces_reporter.h +++ b/include/internal/catch_interfaces_reporter.h @@ -244,6 +244,8 @@ namespace Catch virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0; virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0; virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; + + virtual void skipTest( TestCaseInfo const& testInfo ) = 0; }; diff --git a/include/internal/catch_interfaces_testcase.h b/include/internal/catch_interfaces_testcase.h index 21ed3c3a..a23ff9f4 100644 --- a/include/internal/catch_interfaces_testcase.h +++ b/include/internal/catch_interfaces_testcase.h @@ -28,7 +28,7 @@ namespace Catch { struct ITestCaseRegistry { virtual ~ITestCaseRegistry(); virtual std::vector const& getAllTests() const = 0; - virtual void getFilteredTests( TestSpec const& testSpec, IConfig const& config, std::vector& matchingTestCases ) const = 0; + virtual void getFilteredTests( TestSpec const& testSpec, IConfig const& config, std::vector& matchingTestCases, bool negated = false ) const = 0; }; } diff --git a/include/internal/catch_legacy_reporter_adapter.h b/include/internal/catch_legacy_reporter_adapter.h index fb579c7c..72c43d7d 100644 --- a/include/internal/catch_legacy_reporter_adapter.h +++ b/include/internal/catch_legacy_reporter_adapter.h @@ -50,6 +50,7 @@ namespace Catch virtual void testCaseEnded( TestCaseStats const& testCaseStats ); virtual void testGroupEnded( TestGroupStats const& testGroupStats ); virtual void testRunEnded( TestRunStats const& testRunStats ); + virtual void skipTest( TestCaseInfo const& ); private: Ptr m_legacyReporter; diff --git a/include/internal/catch_legacy_reporter_adapter.hpp b/include/internal/catch_legacy_reporter_adapter.hpp index 09f73b28..6034581e 100644 --- a/include/internal/catch_legacy_reporter_adapter.hpp +++ b/include/internal/catch_legacy_reporter_adapter.hpp @@ -77,6 +77,8 @@ namespace Catch void LegacyReporterAdapter::testRunEnded( TestRunStats const& testRunStats ) { m_legacyReporter->EndTesting( testRunStats.totals ); } + void LegacyReporterAdapter::skipTest( TestCaseInfo const& ) { + } } #endif // TWOBLUECUBES_CATCH_LEGACY_REPORTER_ADAPTER_H_INCLUDED diff --git a/include/internal/catch_test_case_registry_impl.hpp b/include/internal/catch_test_case_registry_impl.hpp index 6c01a187..21165a30 100644 --- a/include/internal/catch_test_case_registry_impl.hpp +++ b/include/internal/catch_test_case_registry_impl.hpp @@ -67,33 +67,38 @@ namespace Catch { return m_nonHiddenFunctions; } - virtual void getFilteredTests( TestSpec const& testSpec, IConfig const& config, std::vector& matchingTestCases ) const { + virtual void getFilteredTests( TestSpec const& testSpec, IConfig const& config, std::vector& matchingTestCases, bool negated = false ) const { for( std::vector::const_iterator it = m_functionsInOrder.begin(), itEnd = m_functionsInOrder.end(); it != itEnd; ++it ) { - if( testSpec.matches( *it ) && ( config.allowThrows() || !it->throws() ) ) + bool includeTest = testSpec.matches( *it ) && ( config.allowThrows() || !it->throws() ); + if( includeTest != negated ) matchingTestCases.push_back( *it ); } + sortTests( config, matchingTestCases ); + } + + private: + + static void sortTests( IConfig const& config, std::vector& matchingTestCases ) { + switch( config.runOrder() ) { case RunTests::InLexicographicalOrder: std::sort( matchingTestCases.begin(), matchingTestCases.end(), LexSort() ); break; case RunTests::InRandomOrder: - { - RandomNumberGenerator rng; - std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng ); - } + { + RandomNumberGenerator rng; + std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng ); + } break; case RunTests::InDeclarationOrder: // already in declaration order break; } } - - private: - std::set m_functions; std::vector m_functionsInOrder; std::vector m_nonHiddenFunctions; diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp index 771d1d68..e5684b32 100644 --- a/include/reporters/catch_reporter_bases.hpp +++ b/include/reporters/catch_reporter_bases.hpp @@ -55,6 +55,11 @@ namespace Catch { currentTestRunInfo.reset(); } + virtual void skipTest( TestCaseInfo const& ) { + // Don't do anything with this by default. + // It can optionally be overridden in the derived class. + } + Ptr m_config; std::ostream& stream; @@ -185,6 +190,8 @@ namespace Catch { } virtual void testRunEndedCumulative() = 0; + virtual void skipTest( TestCaseInfo const& ) {} + Ptr m_config; std::ostream& stream; std::vector m_assertions; diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp index 6e608d42..737a8195 100644 --- a/include/reporters/catch_reporter_teamcity.hpp +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -49,8 +49,16 @@ namespace Catch { prefs.shouldRedirectStdOut = true; return prefs; } - - // !TBD: ignored tests + + virtual void skipTest( TestCaseInfo const& testInfo ) { + stream << "##teamcity[testIgnored name='" + << escape( testInfo.name ) << "'"; + if( testInfo.isHidden() ) + stream << " message='hidden test'"; + else + stream << " message='test skipped because it didn't match the test spec'"; + stream << "]\n"; + } virtual void noMatchingTestCases( std::string const& /* spec */ ) {} From fa751e6a37bfd8111de18d4d21e8791a20736edd Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 22 Dec 2014 20:17:26 +0000 Subject: [PATCH 085/102] FIxed a couple of test names --- projects/SelfTest/TrickyTests.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/SelfTest/TrickyTests.cpp b/projects/SelfTest/TrickyTests.cpp index 4fe2c0ba..462718db 100644 --- a/projects/SelfTest/TrickyTests.cpp +++ b/projects/SelfTest/TrickyTests.cpp @@ -44,7 +44,7 @@ TEST_CASE /////////////////////////////////////////////////////////////////////////////// TEST_CASE ( - "Where the is more to the expression after the RHS[failing]", + "Where there is more to the expression after the RHS", "[Tricky][failing][.]" ) { @@ -55,7 +55,7 @@ TEST_CASE /////////////////////////////////////////////////////////////////////////////// TEST_CASE ( - "Where the LHS is not a simple value[failing]", + "Where the LHS is not a simple value", "[Tricky][failing][.]" ) { From 3c8c9b293390d7f105e6f9cb3c9f3d0b89f63fe8 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 22 Dec 2014 20:17:50 +0000 Subject: [PATCH 086/102] rebased --- projects/SelfTest/Baselines/console.std.approved.txt | 4 ++-- projects/SelfTest/Baselines/console.sw.approved.txt | 8 ++++---- projects/SelfTest/Baselines/junit.sw.approved.txt | 4 ++-- projects/SelfTest/Baselines/xml.sw.approved.txt | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 5c9783cb..76e28c32 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -737,7 +737,7 @@ with expansion: hello hello ------------------------------------------------------------------------------- -Where the is more to the expression after the RHS[failing] +Where there is more to the expression after the RHS ------------------------------------------------------------------------------- TrickyTests.cpp: ............................................................................... @@ -748,7 +748,7 @@ warning: error ------------------------------------------------------------------------------- -Where the LHS is not a simple value[failing] +Where the LHS is not a simple value ------------------------------------------------------------------------------- TrickyTests.cpp: ............................................................................... diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 682a2ac7..cf360ece 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -5690,7 +5690,7 @@ with expansion: std::pair( 1, 2 ) == std::pair( 1, 2 ) ------------------------------------------------------------------------------- -Where the is more to the expression after the RHS[failing] +Where there is more to the expression after the RHS ------------------------------------------------------------------------------- TrickyTests.cpp: ............................................................................... @@ -5701,10 +5701,10 @@ warning: error -No assertions in test case 'Where the is more to the expression after the RHS[failing]' +No assertions in test case 'Where there is more to the expression after the RHS' ------------------------------------------------------------------------------- -Where the LHS is not a simple value[failing] +Where the LHS is not a simple value ------------------------------------------------------------------------------- TrickyTests.cpp: ............................................................................... @@ -5715,7 +5715,7 @@ warning: error -No assertions in test case 'Where the LHS is not a simple value[failing]' +No assertions in test case 'Where the LHS is not a simple value' ------------------------------------------------------------------------------- A failing expression with a non streamable type is still captured diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index b65529c7..8579d908 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -500,8 +500,8 @@ hello - - + + TrickyTests.cpp: diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 54ac8624..87c48b13 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -5879,13 +5879,13 @@ there" - + Uncomment the code in this test to check that it gives a sensible compiler error - + Uncomment the code in this test to check that it gives a sensible compiler error From 92f0836fd3d683d4237068d6dd602805ad888aee Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 22 Dec 2014 20:18:05 +0000 Subject: [PATCH 087/102] build 11 --- README.md | 2 +- include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 51 ++++++++++++++++++++++-------- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 26e771da..86edc78a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![catch logo](catch-logo-small.png) -*v1.1 build 10 (develop branch)* +*v1.1 build 11 (develop branch)* Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index 40633707..6c137e42 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -13,7 +13,7 @@ namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 10, "develop" ); + Version libraryVersion( 1, 1, 11, "develop" ); } #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 1f20000a..7bdc5141 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * CATCH v1.1 build 10 (develop branch) - * Generated: 2014-12-22 07:42:39.411909 + * CATCH v1.1 build 11 (develop branch) + * Generated: 2014-12-22 20:17:55.347268 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -480,7 +480,7 @@ namespace Catch { struct ITestCaseRegistry { virtual ~ITestCaseRegistry(); virtual std::vector const& getAllTests() const = 0; - virtual void getFilteredTests( TestSpec const& testSpec, IConfig const& config, std::vector& matchingTestCases ) const = 0; + virtual void getFilteredTests( TestSpec const& testSpec, IConfig const& config, std::vector& matchingTestCases, bool negated = false ) const = 0; }; } @@ -4683,6 +4683,8 @@ namespace Catch virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0; virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0; virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; + + virtual void skipTest( TestCaseInfo const& testInfo ) = 0; }; struct IReporterFactory { @@ -5482,6 +5484,14 @@ namespace Catch { m_testsAlreadyRun.insert( *it ); } } + std::vector skippedTestCases; + getRegistryHub().getTestCaseRegistry().getFilteredTests( testSpec, *m_config, skippedTestCases, true ); + + for( std::vector::const_iterator it = skippedTestCases.begin(), itEnd = skippedTestCases.end(); + it != itEnd; + ++it ) + m_reporter->skipTest( *it ); + context.testGroupEnded( "all tests", totals, 1, 1 ); return totals; } @@ -5695,33 +5705,38 @@ namespace Catch { return m_nonHiddenFunctions; } - virtual void getFilteredTests( TestSpec const& testSpec, IConfig const& config, std::vector& matchingTestCases ) const { + virtual void getFilteredTests( TestSpec const& testSpec, IConfig const& config, std::vector& matchingTestCases, bool negated = false ) const { for( std::vector::const_iterator it = m_functionsInOrder.begin(), itEnd = m_functionsInOrder.end(); it != itEnd; ++it ) { - if( testSpec.matches( *it ) && ( config.allowThrows() || !it->throws() ) ) + bool includeTest = testSpec.matches( *it ) && ( config.allowThrows() || !it->throws() ); + if( includeTest != negated ) matchingTestCases.push_back( *it ); } + sortTests( config, matchingTestCases ); + } + + private: + + static void sortTests( IConfig const& config, std::vector& matchingTestCases ) { + switch( config.runOrder() ) { case RunTests::InLexicographicalOrder: std::sort( matchingTestCases.begin(), matchingTestCases.end(), LexSort() ); break; case RunTests::InRandomOrder: - { - RandomNumberGenerator rng; - std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng ); - } + { + RandomNumberGenerator rng; + std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng ); + } break; case RunTests::InDeclarationOrder: // already in declaration order break; } } - - private: - std::set m_functions; std::vector m_functionsInOrder; std::vector m_nonHiddenFunctions; @@ -6671,7 +6686,7 @@ namespace Catch { namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 10, "develop" ); + Version libraryVersion( 1, 1, 11, "develop" ); } // #included from: catch_message.hpp @@ -6755,6 +6770,7 @@ namespace Catch virtual void testCaseEnded( TestCaseStats const& testCaseStats ); virtual void testGroupEnded( TestGroupStats const& testGroupStats ); virtual void testRunEnded( TestRunStats const& testRunStats ); + virtual void skipTest( TestCaseInfo const& ); private: Ptr m_legacyReporter; @@ -6828,6 +6844,8 @@ namespace Catch void LegacyReporterAdapter::testRunEnded( TestRunStats const& testRunStats ) { m_legacyReporter->EndTesting( testRunStats.totals ); } + void LegacyReporterAdapter::skipTest( TestCaseInfo const& ) { + } } // #included from: catch_timer.hpp @@ -7526,6 +7544,11 @@ namespace Catch { currentTestRunInfo.reset(); } + virtual void skipTest( TestCaseInfo const& ) { + // Don't do anything with this by default. + // It can optionally be overridden in the derived class. + } + Ptr m_config; std::ostream& stream; @@ -7655,6 +7678,8 @@ namespace Catch { } virtual void testRunEndedCumulative() = 0; + virtual void skipTest( TestCaseInfo const& ) {} + Ptr m_config; std::ostream& stream; std::vector m_assertions; From 3e0c5018123e7e32b3c35f4169cbdca4bcb8f332 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 29 Dec 2014 20:04:54 +0000 Subject: [PATCH 088/102] Fixed escaping of ' in TeamCity reporter --- include/reporters/catch_reporter_teamcity.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp index 737a8195..0647244f 100644 --- a/include/reporters/catch_reporter_teamcity.hpp +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -32,7 +32,7 @@ namespace Catch { static std::string escape( std::string const& str ) { std::string escaped = str; replaceInPlace( escaped, "|", "||" ); - replaceInPlace( escaped, "\'", "|\'" ); + replaceInPlace( escaped, "'", "|'" ); replaceInPlace( escaped, "\n", "|n" ); replaceInPlace( escaped, "\r", "|r" ); replaceInPlace( escaped, "[", "|[" ); @@ -56,7 +56,7 @@ namespace Catch { if( testInfo.isHidden() ) stream << " message='hidden test'"; else - stream << " message='test skipped because it didn't match the test spec'"; + stream << " message='test skipped because it didn|'t match the test spec'"; stream << "]\n"; } From 6817bb099db44744cc32da193cbe710ffcead8b8 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 30 Dec 2014 18:24:31 +0000 Subject: [PATCH 089/102] Fixed up xml reporter and rebased --- include/internal/catch_totals.hpp | 3 + include/reporters/catch_reporter_xml.hpp | 11 ++-- .../Baselines/console.std.approved.txt | 2 +- .../Baselines/console.sw.approved.txt | 21 ++++++- .../SelfTest/Baselines/junit.sw.approved.txt | 3 +- .../SelfTest/Baselines/xml.sw.approved.txt | 55 +++++++++++++------ projects/SelfTest/TestMain.cpp | 5 ++ 7 files changed, 73 insertions(+), 27 deletions(-) diff --git a/include/internal/catch_totals.hpp b/include/internal/catch_totals.hpp index 75386ae8..551e2947 100644 --- a/include/internal/catch_totals.hpp +++ b/include/internal/catch_totals.hpp @@ -35,6 +35,9 @@ namespace Catch { bool allPassed() const { return failed == 0 && failedButOk == 0; } + bool allOk() const { + return failed == 0; + } std::size_t passed; std::size_t failed; diff --git a/include/reporters/catch_reporter_xml.hpp b/include/reporters/catch_reporter_xml.hpp index 1b7c0199..08971d1f 100644 --- a/include/reporters/catch_reporter_xml.hpp +++ b/include/reporters/catch_reporter_xml.hpp @@ -99,7 +99,7 @@ namespace Catch { if( assertionResult.hasExpression() ) { m_xml.startElement( "Expression" ) .writeAttribute( "success", assertionResult.succeeded() ) - .writeAttribute( "type", assertionResult.getTestMacroName() ) +// .writeAttribute( "type", assertionResult.getTestMacroName() ) .writeAttribute( "filename", assertionResult.getSourceInfo().file ) .writeAttribute( "line", assertionResult.getSourceInfo().line ); @@ -111,8 +111,6 @@ namespace Catch { // And... Print a result applicable to each result type. switch( assertionResult.getResultType() ) { - default: - break; case ResultWas::ThrewException: m_xml.scopedElement( "Exception" ) .writeAttribute( "filename", assertionResult.getSourceInfo().file ) @@ -130,13 +128,14 @@ namespace Catch { .writeText( assertionResult.getMessage() ); break; case ResultWas::Warning: - m_xml.scopedElement( "Warning" ) - .writeText( assertionResult.getMessage() ); + // Warning will already have been written break; case ResultWas::ExplicitFailure: m_xml.scopedElement( "Failure" ) .writeText( assertionResult.getMessage() ); break; + default: + break; } if( assertionResult.hasExpression() ) @@ -163,7 +162,7 @@ namespace Catch { virtual void testCaseEnded( TestCaseStats const& testCaseStats ) { StreamingReporterBase::testCaseEnded( testCaseStats ); XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); - e.writeAttribute( "success", testCaseStats.totals.assertions.allPassed() ); + e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() ); if ( m_config->showDurations() == ShowDurations::Always ) e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() ); diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 76e28c32..87319a67 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -787,5 +787,5 @@ with expansion: =============================================================================== test cases: 149 | 110 passed | 38 failed | 1 failed as expected -assertions: 751 | 659 passed | 79 failed | 13 failed as expected +assertions: 753 | 661 passed | 79 failed | 13 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index cf360ece..0c9a8ac9 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -4632,6 +4632,25 @@ PASSED: with expansion: "abcdefcg" == "abcdefcg" +------------------------------------------------------------------------------- +replaceInPlace + escape ' +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( replaceInPlace( s, "'", "|'" ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( s == "didn|'t" ) +with expansion: + "didn|'t" == "didn|'t" + hello hello ------------------------------------------------------------------------------- @@ -7798,5 +7817,5 @@ with expansion: =============================================================================== test cases: 149 | 94 passed | 54 failed | 1 failed as expected -assertions: 771 | 659 passed | 99 failed | 13 failed as expected +assertions: 773 | 661 passed | 99 failed | 13 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 8579d908..ba3f1799 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,5 +1,5 @@ - + @@ -491,6 +491,7 @@ MiscTests.cpp: + hello diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 87c48b13..f05a2726 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -531,7 +531,7 @@ 1.3 == Approx( 1.301 ) - + @@ -1541,7 +1541,7 @@ - + @@ -2775,7 +2775,7 @@ this is a warning - + @@ -2873,7 +2873,7 @@
- +
@@ -2984,7 +2984,7 @@ - + @@ -3016,7 +3016,7 @@ toString(p): 0x - +
@@ -3117,7 +3117,7 @@
- +
@@ -3219,7 +3219,7 @@ - + @@ -3323,7 +3323,7 @@
- +
@@ -3525,19 +3525,19 @@ - + This one ran - + - + - + @@ -4829,10 +4829,29 @@ four"
+
+ + + replaceInPlace( s, "'", "|'" ) + + + true + + + + + s == "didn|'t" + + + "didn|'t" == "didn|'t" + + + +
- + @@ -5883,13 +5902,13 @@ there" Uncomment the code in this test to check that it gives a sensible compiler error - + Uncomment the code in this test to check that it gives a sensible compiler error - + @@ -8067,7 +8086,7 @@ there"
- + - + diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index 154a2994..4b60a4f5 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -374,6 +374,11 @@ TEST_CASE( "replaceInPlace", "" ) { CHECK_FALSE( replaceInPlace( letters, "x", "z" ) ); CHECK( letters == letters ); } + SECTION( "escape '" ) { + std::string s = "didn't"; + CHECK( replaceInPlace( s, "'", "|'" ) ); + CHECK( s == "didn|'t" ); + } } // !TBD: This will be folded into Text class From c6635a7b7933250a76f4eeb3e10b6a7e373b6026 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 30 Dec 2014 18:25:27 +0000 Subject: [PATCH 090/102] Added type attribute to xml reporter output - reports the macro used --- include/reporters/catch_reporter_xml.hpp | 2 +- .../SelfTest/Baselines/xml.sw.approved.txt | 1462 ++++++++--------- 2 files changed, 732 insertions(+), 732 deletions(-) diff --git a/include/reporters/catch_reporter_xml.hpp b/include/reporters/catch_reporter_xml.hpp index 08971d1f..d8cb1dd1 100644 --- a/include/reporters/catch_reporter_xml.hpp +++ b/include/reporters/catch_reporter_xml.hpp @@ -99,7 +99,7 @@ namespace Catch { if( assertionResult.hasExpression() ) { m_xml.startElement( "Expression" ) .writeAttribute( "success", assertionResult.succeeded() ) -// .writeAttribute( "type", assertionResult.getTestMacroName() ) + .writeAttribute( "type", assertionResult.getTestMacroName() ) .writeAttribute( "filename", assertionResult.getSourceInfo().file ) .writeAttribute( "line", assertionResult.getSourceInfo().line ); diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index f05a2726..1dcfec76 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -1,7 +1,7 @@ - + Catch::toString(e0) == "0" @@ -9,7 +9,7 @@ "0" == "0" - + Catch::toString(e1) == "1" @@ -20,7 +20,7 @@ - + Catch::toString(e0) == "E2{0}" @@ -28,7 +28,7 @@ "E2{0}" == "E2{0}" - + Catch::toString(e1) == "E2{1}" @@ -39,7 +39,7 @@ - + Catch::toString(e0) == "0" @@ -47,7 +47,7 @@ "0" == "0" - + Catch::toString(e1) == "1" @@ -58,7 +58,7 @@ - + Catch::toString(e0) == "E2/V0" @@ -66,7 +66,7 @@ "E2/V0" == "E2/V0" - + Catch::toString(e1) == "E2/V1" @@ -74,7 +74,7 @@ "E2/V1" == "E2/V1" - + Catch::toString(e3) == "Unknown enum value 10" @@ -87,7 +87,7 @@ - + d == Approx( 1.23 ) @@ -95,7 +95,7 @@ 1.23 == Approx( 1.23 ) - + d != Approx( 1.22 ) @@ -103,7 +103,7 @@ 1.23 != Approx( 1.22 ) - + d != Approx( 1.24 ) @@ -111,7 +111,7 @@ 1.23 != Approx( 1.24 ) - + Approx( d ) == 1.23 @@ -119,7 +119,7 @@ Approx( 1.23 ) == 1.23 - + Approx( d ) != 1.22 @@ -127,7 +127,7 @@ Approx( 1.23 ) != 1.22 - + Approx( d ) != 1.24 @@ -138,7 +138,7 @@ - + d != Approx( 1.231 ) @@ -146,7 +146,7 @@ 1.23 != Approx( 1.231 ) - + d == Approx( 1.231 ).epsilon( 0.1 ) @@ -157,7 +157,7 @@ - + 1.23f == Approx( 1.23f ) @@ -165,7 +165,7 @@ 1.23f == Approx( 1.2300000191 ) - + 0.0f == Approx( 0.0f ) @@ -176,7 +176,7 @@ - + 1 == Approx( 1 ) @@ -184,7 +184,7 @@ 1 == Approx( 1.0 ) - + 0 == Approx( 0 ) @@ -195,7 +195,7 @@ - + 1.0f == Approx( 1 ) @@ -203,7 +203,7 @@ 1.0f == Approx( 1.0 ) - + 0 == Approx( dZero) @@ -211,7 +211,7 @@ 0 == Approx( 0.0 ) - + 0 == Approx( dSmall ).epsilon( 0.001 ) @@ -219,7 +219,7 @@ 0 == Approx( 0.00001 ) - + 1.234f == Approx( dMedium ) @@ -227,7 +227,7 @@ 1.234f == Approx( 1.234 ) - + dMedium == Approx( 1.234f ) @@ -238,7 +238,7 @@ - + d == approx( 1.23 ) @@ -246,7 +246,7 @@ 1.23 == Approx( 1.23 ) - + d == approx( 1.22 ) @@ -254,7 +254,7 @@ 1.23 == Approx( 1.22 ) - + d == approx( 1.24 ) @@ -262,7 +262,7 @@ 1.23 == Approx( 1.24 ) - + d != approx( 1.25 ) @@ -270,7 +270,7 @@ 1.23 != Approx( 1.25 ) - + approx( d ) == 1.23 @@ -278,7 +278,7 @@ Approx( 1.23 ) == 1.23 - + approx( d ) == 1.22 @@ -286,7 +286,7 @@ Approx( 1.23 ) == 1.22 - + approx( d ) == 1.24 @@ -294,7 +294,7 @@ Approx( 1.23 ) == 1.24 - + approx( d ) != 1.25 @@ -305,7 +305,7 @@ - + divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) @@ -313,7 +313,7 @@ 3.1428571429 == Approx( 3.141 ) - + divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) @@ -324,7 +324,7 @@ - + s == "hello" @@ -335,7 +335,7 @@ - + s == "world" @@ -346,7 +346,7 @@ - + m_a == 1 @@ -357,7 +357,7 @@ - + m_a == 2 @@ -368,7 +368,7 @@ - + data.int_seven == 7 @@ -376,7 +376,7 @@ 7 == 7 - + data.float_nine_point_one == Approx( 9.1f ) @@ -384,7 +384,7 @@ 9.1f == Approx( 9.1000003815 ) - + data.double_pi == Approx( 3.1415926535 ) @@ -392,7 +392,7 @@ 3.1415926535 == Approx( 3.1415926535 ) - + data.str_hello == "hello" @@ -400,7 +400,7 @@ "hello" == "hello" - + "hello" == data.str_hello @@ -408,7 +408,7 @@ "hello" == "hello" - + data.str_hello.size() == 5 @@ -416,7 +416,7 @@ 5 == 5 - + x == Approx( 1.3 ) @@ -427,7 +427,7 @@ - + data.int_seven == 6 @@ -435,7 +435,7 @@ 7 == 6 - + data.int_seven == 8 @@ -443,7 +443,7 @@ 7 == 8 - + data.int_seven == 0 @@ -451,7 +451,7 @@ 7 == 0 - + data.float_nine_point_one == Approx( 9.11f ) @@ -459,7 +459,7 @@ 9.1f == Approx( 9.1099996567 ) - + data.float_nine_point_one == Approx( 9.0f ) @@ -467,7 +467,7 @@ 9.1f == Approx( 9.0 ) - + data.float_nine_point_one == Approx( 1 ) @@ -475,7 +475,7 @@ 9.1f == Approx( 1.0 ) - + data.float_nine_point_one == Approx( 0 ) @@ -483,7 +483,7 @@ 9.1f == Approx( 0.0 ) - + data.double_pi == Approx( 3.1415 ) @@ -491,7 +491,7 @@ 3.1415926535 == Approx( 3.1415 ) - + data.str_hello == "goodbye" @@ -499,7 +499,7 @@ "hello" == "goodbye" - + data.str_hello == "hell" @@ -507,7 +507,7 @@ "hello" == "hell" - + data.str_hello == "hello1" @@ -515,7 +515,7 @@ "hello" == "hello1" - + data.str_hello.size() == 6 @@ -523,7 +523,7 @@ 5 == 6 - + x == Approx( 1.301 ) @@ -534,7 +534,7 @@ - + data.int_seven != 6 @@ -542,7 +542,7 @@ 7 != 6 - + data.int_seven != 8 @@ -550,7 +550,7 @@ 7 != 8 - + data.float_nine_point_one != Approx( 9.11f ) @@ -558,7 +558,7 @@ 9.1f != Approx( 9.1099996567 ) - + data.float_nine_point_one != Approx( 9.0f ) @@ -566,7 +566,7 @@ 9.1f != Approx( 9.0 ) - + data.float_nine_point_one != Approx( 1 ) @@ -574,7 +574,7 @@ 9.1f != Approx( 1.0 ) - + data.float_nine_point_one != Approx( 0 ) @@ -582,7 +582,7 @@ 9.1f != Approx( 0.0 ) - + data.double_pi != Approx( 3.1415 ) @@ -590,7 +590,7 @@ 3.1415926535 != Approx( 3.1415 ) - + data.str_hello != "goodbye" @@ -598,7 +598,7 @@ "hello" != "goodbye" - + data.str_hello != "hell" @@ -606,7 +606,7 @@ "hello" != "hell" - + data.str_hello != "hello1" @@ -614,7 +614,7 @@ "hello" != "hello1" - + data.str_hello.size() != 6 @@ -625,7 +625,7 @@ - + data.int_seven != 7 @@ -633,7 +633,7 @@ 7 != 7 - + data.float_nine_point_one != Approx( 9.1f ) @@ -641,7 +641,7 @@ 9.1f != Approx( 9.1000003815 ) - + data.double_pi != Approx( 3.1415926535 ) @@ -649,7 +649,7 @@ 3.1415926535 != Approx( 3.1415926535 ) - + data.str_hello != "hello" @@ -657,7 +657,7 @@ "hello" != "hello" - + data.str_hello.size() != 5 @@ -668,7 +668,7 @@ - + data.int_seven < 8 @@ -676,7 +676,7 @@ 7 < 8 - + data.int_seven > 6 @@ -684,7 +684,7 @@ 7 > 6 - + data.int_seven > 0 @@ -692,7 +692,7 @@ 7 > 0 - + data.int_seven > -1 @@ -700,7 +700,7 @@ 7 > -1 - + data.int_seven >= 7 @@ -708,7 +708,7 @@ 7 >= 7 - + data.int_seven >= 6 @@ -716,7 +716,7 @@ 7 >= 6 - + data.int_seven <= 7 @@ -724,7 +724,7 @@ 7 <= 7 - + data.int_seven <= 8 @@ -732,7 +732,7 @@ 7 <= 8 - + data.float_nine_point_one > 9 @@ -740,7 +740,7 @@ 9.1f > 9 - + data.float_nine_point_one < 10 @@ -748,7 +748,7 @@ 9.1f < 10 - + data.float_nine_point_one < 9.2 @@ -756,7 +756,7 @@ 9.1f < 9.2 - + data.str_hello <= "hello" @@ -764,7 +764,7 @@ "hello" <= "hello" - + data.str_hello >= "hello" @@ -772,7 +772,7 @@ "hello" >= "hello" - + data.str_hello < "hellp" @@ -780,7 +780,7 @@ "hello" < "hellp" - + data.str_hello < "zebra" @@ -788,7 +788,7 @@ "hello" < "zebra" - + data.str_hello > "hellm" @@ -796,7 +796,7 @@ "hello" > "hellm" - + data.str_hello > "a" @@ -807,7 +807,7 @@ - + data.int_seven > 7 @@ -815,7 +815,7 @@ 7 > 7 - + data.int_seven < 7 @@ -823,7 +823,7 @@ 7 < 7 - + data.int_seven > 8 @@ -831,7 +831,7 @@ 7 > 8 - + data.int_seven < 6 @@ -839,7 +839,7 @@ 7 < 6 - + data.int_seven < 0 @@ -847,7 +847,7 @@ 7 < 0 - + data.int_seven < -1 @@ -855,7 +855,7 @@ 7 < -1 - + data.int_seven >= 8 @@ -863,7 +863,7 @@ 7 >= 8 - + data.int_seven <= 6 @@ -871,7 +871,7 @@ 7 <= 6 - + data.float_nine_point_one < 9 @@ -879,7 +879,7 @@ 9.1f < 9 - + data.float_nine_point_one > 10 @@ -887,7 +887,7 @@ 9.1f > 10 - + data.float_nine_point_one > 9.2 @@ -895,7 +895,7 @@ 9.1f > 9.2 - + data.str_hello > "hello" @@ -903,7 +903,7 @@ "hello" > "hello" - + data.str_hello < "hello" @@ -911,7 +911,7 @@ "hello" < "hello" - + data.str_hello > "hellp" @@ -919,7 +919,7 @@ "hello" > "hellp" - + data.str_hello > "z" @@ -927,7 +927,7 @@ "hello" > "z" - + data.str_hello < "hellm" @@ -935,7 +935,7 @@ "hello" < "hellm" - + data.str_hello < "a" @@ -943,7 +943,7 @@ "hello" < "a" - + data.str_hello >= "z" @@ -951,7 +951,7 @@ "hello" >= "z" - + data.str_hello <= "a" @@ -962,7 +962,7 @@ - + i == 1 @@ -970,7 +970,7 @@ 1 == 1 - + ui == 2 @@ -978,7 +978,7 @@ 2 == 2 - + l == 3 @@ -986,7 +986,7 @@ 3 == 3 - + ul == 4 @@ -994,7 +994,7 @@ 4 == 4 - + c == 5 @@ -1002,7 +1002,7 @@ 5 == 5 - + uc == 6 @@ -1010,7 +1010,7 @@ 6 == 6 - + 1 == i @@ -1018,7 +1018,7 @@ 1 == 1 - + 2 == ui @@ -1026,7 +1026,7 @@ 2 == 2 - + 3 == l @@ -1034,7 +1034,7 @@ 3 == 3 - + 4 == ul @@ -1042,7 +1042,7 @@ 4 == 4 - + 5 == c @@ -1050,7 +1050,7 @@ 5 == 5 - + 6 == uc @@ -1058,7 +1058,7 @@ 6 == 6 - + (std::numeric_limits<unsigned long>::max)() > ul @@ -1069,7 +1069,7 @@ - + long_var == unsigned_char_var @@ -1077,7 +1077,7 @@ 1 == 1 - + long_var == unsigned_short_var @@ -1085,7 +1085,7 @@ 1 == 1 - + long_var == unsigned_int_var @@ -1093,7 +1093,7 @@ 1 == 1 - + long_var == unsigned_long_var @@ -1104,7 +1104,7 @@ - + unsigned_char_var == 1 @@ -1112,7 +1112,7 @@ 1 == 1 - + unsigned_short_var == 1 @@ -1120,7 +1120,7 @@ 1 == 1 - + unsigned_int_var == 1 @@ -1128,7 +1128,7 @@ 1 == 1 - + unsigned_long_var == 1 @@ -1139,7 +1139,7 @@ - + ( -1 > 2u ) @@ -1147,7 +1147,7 @@ true - + -1 > 2u @@ -1155,7 +1155,7 @@ -1 > 2 - + ( 2u < -1 ) @@ -1163,7 +1163,7 @@ true - + 2u < -1 @@ -1171,7 +1171,7 @@ 2 < -1 - + ( minInt > 2u ) @@ -1179,7 +1179,7 @@ true - + minInt > 2u @@ -1190,7 +1190,7 @@ - + 54 == 6*9 @@ -1201,7 +1201,7 @@ - + p == __null @@ -1209,7 +1209,7 @@ __null == 0 - + p == pNULL @@ -1217,7 +1217,7 @@ __null == __null - + p != __null @@ -1225,7 +1225,7 @@ 0x != 0 - + cp != __null @@ -1233,7 +1233,7 @@ 0x != 0 - + cpc != __null @@ -1241,7 +1241,7 @@ 0x != 0 - + returnsNull() == __null @@ -1249,7 +1249,7 @@ {null string} == 0 - + returnsConstNull() == __null @@ -1257,7 +1257,7 @@ {null string} == 0 - + __null != p @@ -1268,7 +1268,7 @@ - + false == false @@ -1276,7 +1276,7 @@ false == false - + true == true @@ -1284,7 +1284,7 @@ true == true - + !false @@ -1292,7 +1292,7 @@ true - + !false @@ -1300,7 +1300,7 @@ !false - + !falseValue @@ -1308,7 +1308,7 @@ true - + !falseValue @@ -1316,7 +1316,7 @@ !false - + !(1 == 2) @@ -1324,7 +1324,7 @@ true - + !1 == 2 @@ -1335,7 +1335,7 @@ - + false != false @@ -1343,7 +1343,7 @@ false != false - + true != true @@ -1351,7 +1351,7 @@ true != true - + !true @@ -1359,7 +1359,7 @@ false - + !true @@ -1367,7 +1367,7 @@ !true - + !trueValue @@ -1375,7 +1375,7 @@ false - + !trueValue @@ -1383,7 +1383,7 @@ !true - + !(1 == 1) @@ -1391,7 +1391,7 @@ false - + !1 == 1 @@ -1402,7 +1402,7 @@ - + thisThrows() @@ -1410,7 +1410,7 @@ thisThrows() - + thisDoesntThrow() @@ -1418,7 +1418,7 @@ thisDoesntThrow() - + thisThrows() @@ -1429,7 +1429,7 @@ - + thisThrows() @@ -1440,7 +1440,7 @@ expected exception - + thisDoesntThrow() @@ -1448,7 +1448,7 @@ thisDoesntThrow() - + thisThrows() @@ -1468,7 +1468,7 @@ - + 1 == 1 @@ -1499,7 +1499,7 @@ - + thisThrows() == 0 @@ -1513,7 +1513,7 @@ - + thisThrows() == 0 @@ -1527,7 +1527,7 @@ - + thisThrows() == 0 @@ -1550,7 +1550,7 @@ - + throwCustom() @@ -1564,7 +1564,7 @@ - + throwCustom() @@ -1584,7 +1584,7 @@ - + thisFunctionNotImplemented( 7 ) @@ -1595,7 +1595,7 @@ - + multiply( i, 2 ) == i*2 @@ -1603,7 +1603,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -1611,7 +1611,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1619,7 +1619,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -1627,7 +1627,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1635,7 +1635,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -1643,7 +1643,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1651,7 +1651,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -1659,7 +1659,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1667,7 +1667,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -1675,7 +1675,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1683,7 +1683,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -1691,7 +1691,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1699,7 +1699,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -1707,7 +1707,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1715,7 +1715,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -1723,7 +1723,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1731,7 +1731,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -1739,7 +1739,7 @@ 200 == 200 - + multiply( i, 2 ) == i*2 @@ -1747,7 +1747,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -1755,7 +1755,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1763,7 +1763,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -1771,7 +1771,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1779,7 +1779,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -1787,7 +1787,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1795,7 +1795,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -1803,7 +1803,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1811,7 +1811,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -1819,7 +1819,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1827,7 +1827,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -1835,7 +1835,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1843,7 +1843,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -1851,7 +1851,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1859,7 +1859,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -1867,7 +1867,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1875,7 +1875,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -1883,7 +1883,7 @@ 202 == 202 - + multiply( i, 2 ) == i*2 @@ -1891,7 +1891,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -1899,7 +1899,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1907,7 +1907,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -1915,7 +1915,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1923,7 +1923,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -1931,7 +1931,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1939,7 +1939,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -1947,7 +1947,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1955,7 +1955,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -1963,7 +1963,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1971,7 +1971,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -1979,7 +1979,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -1987,7 +1987,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -1995,7 +1995,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -2003,7 +2003,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2011,7 +2011,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -2019,7 +2019,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2027,7 +2027,7 @@ 204 == 204 - + multiply( i, 2 ) == i*2 @@ -2035,7 +2035,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -2043,7 +2043,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2051,7 +2051,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -2059,7 +2059,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2067,7 +2067,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -2075,7 +2075,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2083,7 +2083,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2091,7 +2091,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2099,7 +2099,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2107,7 +2107,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2115,7 +2115,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2123,7 +2123,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2131,7 +2131,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2139,7 +2139,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2147,7 +2147,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2155,7 +2155,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2163,7 +2163,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2171,7 +2171,7 @@ 206 == 206 - + multiply( i, 2 ) == i*2 @@ -2179,7 +2179,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -2187,7 +2187,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2195,7 +2195,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -2203,7 +2203,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2211,7 +2211,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -2219,7 +2219,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2227,7 +2227,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2235,7 +2235,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2243,7 +2243,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2251,7 +2251,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2259,7 +2259,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2267,7 +2267,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2275,7 +2275,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2283,7 +2283,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2291,7 +2291,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2299,7 +2299,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2307,7 +2307,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2315,7 +2315,7 @@ 208 == 208 - + multiply( i, 2 ) == i*2 @@ -2323,7 +2323,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -2331,7 +2331,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2339,7 +2339,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -2347,7 +2347,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2355,7 +2355,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -2363,7 +2363,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2371,7 +2371,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2379,7 +2379,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2387,7 +2387,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2395,7 +2395,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2403,7 +2403,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2411,7 +2411,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2419,7 +2419,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2427,7 +2427,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2435,7 +2435,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2443,7 +2443,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2451,7 +2451,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2459,7 +2459,7 @@ 210 == 210 - + multiply( i, 2 ) == i*2 @@ -2467,7 +2467,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -2475,7 +2475,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2483,7 +2483,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -2491,7 +2491,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2499,7 +2499,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -2507,7 +2507,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2515,7 +2515,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2523,7 +2523,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2531,7 +2531,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2539,7 +2539,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2547,7 +2547,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2555,7 +2555,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2563,7 +2563,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2571,7 +2571,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2579,7 +2579,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2587,7 +2587,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2595,7 +2595,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2603,7 +2603,7 @@ 212 == 212 - + multiply( i, 2 ) == i*2 @@ -2611,7 +2611,7 @@ 2 == 2 - + multiply( j, 2 ) == j*2 @@ -2619,7 +2619,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2627,7 +2627,7 @@ 4 == 4 - + multiply( j, 2 ) == j*2 @@ -2635,7 +2635,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2643,7 +2643,7 @@ 6 == 6 - + multiply( j, 2 ) == j*2 @@ -2651,7 +2651,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2659,7 +2659,7 @@ 8 == 8 - + multiply( j, 2 ) == j*2 @@ -2667,7 +2667,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2675,7 +2675,7 @@ 10 == 10 - + multiply( j, 2 ) == j*2 @@ -2683,7 +2683,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2691,7 +2691,7 @@ 30 == 30 - + multiply( j, 2 ) == j*2 @@ -2699,7 +2699,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2707,7 +2707,7 @@ 40 == 40 - + multiply( j, 2 ) == j*2 @@ -2715,7 +2715,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2723,7 +2723,7 @@ 42 == 42 - + multiply( j, 2 ) == j*2 @@ -2731,7 +2731,7 @@ 214 == 214 - + multiply( i, 2 ) == i*2 @@ -2739,7 +2739,7 @@ 72 == 72 - + multiply( j, 2 ) == j*2 @@ -2750,7 +2750,7 @@ - + i->first == i->second-1 @@ -2758,7 +2758,7 @@ 0 == 0 - + i->first == i->second-1 @@ -2787,7 +2787,7 @@ so should this - + a == 1 @@ -2798,7 +2798,7 @@ - + a == 2 @@ -2809,7 +2809,7 @@ this message should be logged - + a == 1 @@ -2820,7 +2820,7 @@ and this, but later - + a == 0 @@ -2828,7 +2828,7 @@ 2 == 0 - + a == 2 @@ -2876,7 +2876,7 @@ - + i < 10 @@ -2884,7 +2884,7 @@ 0 < 10 - + i < 10 @@ -2892,7 +2892,7 @@ 1 < 10 - + i < 10 @@ -2900,7 +2900,7 @@ 2 < 10 - + i < 10 @@ -2908,7 +2908,7 @@ 3 < 10 - + i < 10 @@ -2916,7 +2916,7 @@ 4 < 10 - + i < 10 @@ -2924,7 +2924,7 @@ 5 < 10 - + i < 10 @@ -2932,7 +2932,7 @@ 6 < 10 - + i < 10 @@ -2940,7 +2940,7 @@ 7 < 10 - + i < 10 @@ -2948,7 +2948,7 @@ 8 < 10 - + i < 10 @@ -2962,7 +2962,7 @@ i := 10 - + i < 10 @@ -2973,7 +2973,7 @@ - + 1 == 2 @@ -2999,7 +2999,7 @@ i := 7 - + false @@ -3020,7 +3020,7 @@
- + a != b @@ -3028,7 +3028,7 @@ 1 != 2 - + b != a @@ -3039,7 +3039,7 @@
- + a != b @@ -3053,7 +3053,7 @@
- + a != b @@ -3061,7 +3061,7 @@ 1 != 2 - + b != a @@ -3070,7 +3070,7 @@
- + a != b @@ -3087,7 +3087,7 @@
- + a == b @@ -3121,7 +3121,7 @@
- + b > a @@ -3137,7 +3137,7 @@ Testing if fib[0] (1) is even - + ( fib[i] % 2 ) == 0 @@ -3148,7 +3148,7 @@ Testing if fib[1] (1) is even - + ( fib[i] % 2 ) == 0 @@ -3156,7 +3156,7 @@ 1 == 0 - + ( fib[i] % 2 ) == 0 @@ -3167,7 +3167,7 @@ Testing if fib[3] (3) is even - + ( fib[i] % 2 ) == 0 @@ -3178,7 +3178,7 @@ Testing if fib[4] (5) is even - + ( fib[i] % 2 ) == 0 @@ -3186,7 +3186,7 @@ 1 == 0 - + ( fib[i] % 2 ) == 0 @@ -3197,7 +3197,7 @@ Testing if fib[6] (13) is even - + ( fib[i] % 2 ) == 0 @@ -3208,7 +3208,7 @@ Testing if fib[7] (21) is even - + ( fib[i] % 2 ) == 0 @@ -3222,7 +3222,7 @@ - + makeString( false ) != static_cast<char*>(__null) @@ -3230,7 +3230,7 @@ "valid string" != {null string} - + makeString( true ) == static_cast<char*>(__null) @@ -3241,7 +3241,7 @@ - + flag @@ -3249,7 +3249,7 @@ true - + testCheckedIf( true ) @@ -3260,7 +3260,7 @@ - + flag @@ -3268,7 +3268,7 @@ false - + testCheckedIf( false ) @@ -3279,7 +3279,7 @@ - + flag @@ -3287,7 +3287,7 @@ true - + testCheckedElse( true ) @@ -3298,7 +3298,7 @@ - + flag @@ -3306,7 +3306,7 @@ false - + testCheckedElse( false ) @@ -3329,7 +3329,7 @@ 3 - + false @@ -3340,7 +3340,7 @@ - + x == 0 @@ -3351,7 +3351,7 @@ - + testStringForMatching() Contains( "string" ) @@ -3359,7 +3359,7 @@ "this string contains 'abc' as a substring" contains: "string" - + testStringForMatching() Contains( "abc" ) @@ -3367,7 +3367,7 @@ "this string contains 'abc' as a substring" contains: "abc" - + testStringForMatching() StartsWith( "this" ) @@ -3375,7 +3375,7 @@ "this string contains 'abc' as a substring" starts with: "this" - + testStringForMatching() EndsWith( "substring" ) @@ -3386,7 +3386,7 @@ - + testStringForMatching() Contains( "not there" ) @@ -3397,7 +3397,7 @@ - + testStringForMatching() StartsWith( "string" ) @@ -3408,7 +3408,7 @@ - + testStringForMatching() EndsWith( "this" ) @@ -3419,7 +3419,7 @@ - + testStringForMatching() Equals( "something else" ) @@ -3430,7 +3430,7 @@ - + "" Equals(__null) @@ -3441,7 +3441,7 @@ - + testStringForMatching() AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) ) @@ -3452,7 +3452,7 @@ - + testStringForMatching() AnyOf( Catch::Contains( "string" ), Catch::Contains( "not there" ) ) @@ -3460,7 +3460,7 @@ "this string contains 'abc' as a substring" ( contains: "string" or contains: "not there" ) - + testStringForMatching() AnyOf( Catch::Contains( "not there" ), Catch::Contains( "string" ) ) @@ -3471,7 +3471,7 @@ - + testStringForMatching() Equals( "this string contains 'abc' as a substring" ) @@ -3482,7 +3482,7 @@ - + Factorial(0) == 1 @@ -3490,7 +3490,7 @@ 1 == 1 - + Factorial(1) == 1 @@ -3498,7 +3498,7 @@ 1 == 1 - + Factorial(2) == 2 @@ -3506,7 +3506,7 @@ 2 == 2 - + Factorial(3) == 6 @@ -3514,7 +3514,7 @@ 6 == 6 - + Factorial(10) == 3628800 @@ -3540,7 +3540,7 @@ - + v.size() == 5 @@ -3548,7 +3548,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3557,7 +3557,7 @@
- + v.size() == 10 @@ -3565,7 +3565,7 @@ 10 == 10 - + v.capacity() >= 10 @@ -3575,7 +3575,7 @@
- + v.size() == 5 @@ -3583,7 +3583,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3592,7 +3592,7 @@
- + v.size() == 0 @@ -3600,7 +3600,7 @@ 0 == 0 - + v.capacity() >= 5 @@ -3609,7 +3609,7 @@
- + v.capacity() == 0 @@ -3621,7 +3621,7 @@
- + v.size() == 5 @@ -3629,7 +3629,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3638,7 +3638,7 @@
- + v.size() == 5 @@ -3646,7 +3646,7 @@ 5 == 5 - + v.capacity() >= 10 @@ -3656,7 +3656,7 @@
- + v.size() == 5 @@ -3664,7 +3664,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3673,7 +3673,7 @@
- + v.size() == 5 @@ -3681,7 +3681,7 @@ 5 == 5 - + v.capacity() >= 5 @@ -3709,7 +3709,7 @@ - + s1 == s2 @@ -3727,7 +3727,7 @@ - + result == "\"wide load\"" @@ -3738,7 +3738,7 @@ - + result == "\"wide load\"" @@ -3749,7 +3749,7 @@ - + result == "\"wide load\"" @@ -3760,7 +3760,7 @@ - + result == "\"wide load\"" @@ -3772,7 +3772,7 @@
- + parseIntoConfig( argv, config ) @@ -3780,7 +3780,7 @@ parseIntoConfig( argv, config ) - + config.shouldDebugBreak == false @@ -3788,7 +3788,7 @@ false == false - + config.abortAfter == -1 @@ -3796,7 +3796,7 @@ -1 == -1 - + config.noThrow == false @@ -3804,7 +3804,7 @@ false == false - + config.reporterName.empty() @@ -3816,7 +3816,7 @@
- + parseIntoConfig( argv, config ) @@ -3824,7 +3824,7 @@ parseIntoConfig( argv, config ) - + cfg.testSpec().matches( fakeTestCase( "notIncluded" ) ) == false @@ -3832,7 +3832,7 @@ false == false - + cfg.testSpec().matches( fakeTestCase( "test1" ) ) @@ -3846,7 +3846,7 @@
- + parseIntoConfig( argv, config ) @@ -3854,7 +3854,7 @@ parseIntoConfig( argv, config ) - + cfg.testSpec().matches( fakeTestCase( "test1" ) ) == false @@ -3862,7 +3862,7 @@ false == false - + cfg.testSpec().matches( fakeTestCase( "alwaysIncluded" ) ) @@ -3876,7 +3876,7 @@
- + parseIntoConfig( argv, config ) @@ -3884,7 +3884,7 @@ parseIntoConfig( argv, config ) - + cfg.testSpec().matches( fakeTestCase( "test1" ) ) == false @@ -3892,7 +3892,7 @@ false == false - + cfg.testSpec().matches( fakeTestCase( "alwaysIncluded" ) ) @@ -3906,7 +3906,7 @@
- + parseIntoConfig( argv, config ) @@ -3914,7 +3914,7 @@ parseIntoConfig( argv, config ) - + config.reporterName == "console" @@ -3928,7 +3928,7 @@
- + parseIntoConfig( argv, config ) @@ -3936,7 +3936,7 @@ parseIntoConfig( argv, config ) - + config.reporterName == "xml" @@ -3950,7 +3950,7 @@
- + parseIntoConfig( argv, config ) @@ -3958,7 +3958,7 @@ parseIntoConfig( argv, config ) - + config.reporterName == "junit" @@ -3972,7 +3972,7 @@
- + parseIntoConfig( argv, config ) @@ -3980,7 +3980,7 @@ parseIntoConfig( argv, config ) - + config.shouldDebugBreak == true @@ -3994,7 +3994,7 @@
- + parseIntoConfig( argv, config ) @@ -4002,7 +4002,7 @@ parseIntoConfig( argv, config ) - + config.shouldDebugBreak @@ -4016,7 +4016,7 @@
- + parseIntoConfig( argv, config ) @@ -4024,7 +4024,7 @@ parseIntoConfig( argv, config ) - + config.abortAfter == 1 @@ -4038,7 +4038,7 @@
- + parseIntoConfig( argv, config ) @@ -4046,7 +4046,7 @@ parseIntoConfig( argv, config ) - + config.abortAfter == 2 @@ -4060,7 +4060,7 @@
- + parseIntoConfigAndReturnError( argv, config ) Contains( "greater than zero" ) @@ -4075,7 +4075,7 @@
- + parseIntoConfigAndReturnError( argv, config ) Contains( "-x" ) @@ -4090,7 +4090,7 @@
- + parseIntoConfig( argv, config ) @@ -4098,7 +4098,7 @@ parseIntoConfig( argv, config ) - + config.noThrow == true @@ -4112,7 +4112,7 @@
- + parseIntoConfig( argv, config ) @@ -4120,7 +4120,7 @@ parseIntoConfig( argv, config ) - + config.noThrow == true @@ -4134,7 +4134,7 @@
- + parseIntoConfig( argv, config ) @@ -4142,7 +4142,7 @@ parseIntoConfig( argv, config ) - + config.outputFilename == "filename.ext" @@ -4156,7 +4156,7 @@
- + parseIntoConfig( argv, config ) @@ -4164,7 +4164,7 @@ parseIntoConfig( argv, config ) - + config.outputFilename == "filename.ext" @@ -4178,7 +4178,7 @@
- + parseIntoConfig( argv, config ) @@ -4186,7 +4186,7 @@ parseIntoConfig( argv, config ) - + config.abortAfter == 1 @@ -4194,7 +4194,7 @@ 1 == 1 - + config.shouldDebugBreak @@ -4202,7 +4202,7 @@ true - + config.noThrow == true @@ -4219,7 +4219,7 @@
- + Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString @@ -4229,7 +4229,7 @@ "one two three four" - + Text( testString, TextAttributes().setWidth( 18 ) ).toString() == testString @@ -4245,7 +4245,7 @@
- + Text( testString, TextAttributes().setWidth( 17 ) ).toString() == "one two three\nfour" @@ -4257,7 +4257,7 @@ four" four" - + Text( testString, TextAttributes().setWidth( 16 ) ).toString() == "one two three\nfour" @@ -4269,7 +4269,7 @@ four" four" - + Text( testString, TextAttributes().setWidth( 14 ) ).toString() == "one two three\nfour" @@ -4281,7 +4281,7 @@ four" four" - + Text( testString, TextAttributes().setWidth( 13 ) ).toString() == "one two three\nfour" @@ -4293,7 +4293,7 @@ four" four" - + Text( testString, TextAttributes().setWidth( 12 ) ).toString() == "one two\nthree four" @@ -4311,7 +4311,7 @@ three four"
- + Text( testString, TextAttributes().setWidth( 9 ) ).toString() == "one two\nthree\nfour" @@ -4325,7 +4325,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 8 ) ).toString() == "one two\nthree\nfour" @@ -4339,7 +4339,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 7 ) ).toString() == "one two\nthree\nfour" @@ -4359,7 +4359,7 @@ four"
- + Text( testString, TextAttributes().setWidth( 6 ) ).toString() == "one\ntwo\nthree\nfour" @@ -4375,7 +4375,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 5 ) ).toString() == "one\ntwo\nthree\nfour" @@ -4397,7 +4397,7 @@ four"
- + Text( "abcdef", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndef" @@ -4409,7 +4409,7 @@ def" def" - + Text( "abcdefg", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndefg" @@ -4421,7 +4421,7 @@ defg" defg" - + Text( "abcdefgh", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndef-\ngh" @@ -4435,7 +4435,7 @@ def- gh" - + Text( testString, TextAttributes().setWidth( 4 ) ).toString() == "one\ntwo\nthr-\nee\nfour" @@ -4453,7 +4453,7 @@ ee four" - + Text( testString, TextAttributes().setWidth( 3 ) ).toString() == "one\ntwo\nth-\nree\nfo-\nur" @@ -4479,7 +4479,7 @@ ur"
- + text.size() == 4 @@ -4487,7 +4487,7 @@ ur" 4 == 4 - + text[0] == "one" @@ -4495,7 +4495,7 @@ ur" "one" == "one" - + text[1] == "two" @@ -4503,7 +4503,7 @@ ur" "two" == "two" - + text[2] == "three" @@ -4511,7 +4511,7 @@ ur" "three" == "three" - + text[3] == "four" @@ -4525,7 +4525,7 @@ ur"
- + text.toString() == " one two\n three\n four" @@ -4545,7 +4545,7 @@ ur"
- + Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString @@ -4557,7 +4557,7 @@ three four" three four" - + Text( testString, TextAttributes().setWidth( 18 ) ).toString() == testString @@ -4569,7 +4569,7 @@ three four" three four" - + Text( testString, TextAttributes().setWidth( 10 ) ).toString() == testString @@ -4587,7 +4587,7 @@ three four"
- + Text( "abcdef\n", TextAttributes().setWidth( 10 ) ).toString() == "abcdef\n" @@ -4599,7 +4599,7 @@ three four" " - + Text( "abcdef", TextAttributes().setWidth( 6 ) ).toString() == "abcdef" @@ -4607,7 +4607,7 @@ three four" "abcdef" == "abcdef" - + Text( "abcdef\n", TextAttributes().setWidth( 6 ) ).toString() == "abcdef\n" @@ -4625,7 +4625,7 @@ three four"
- + Text( testString, TextAttributes().setWidth( 9 ) ).toString() == "one two\nthree\nfour" @@ -4639,7 +4639,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 8 ) ).toString() == "one two\nthree\nfour" @@ -4653,7 +4653,7 @@ three four" - + Text( testString, TextAttributes().setWidth( 7 ) ).toString() == "one two\nthree\nfour" @@ -4673,7 +4673,7 @@ four"
- + Text( testString, TextAttributes().setWidth( 6 ) ).toString() == "one\ntwo\nthree\nfour" @@ -4694,7 +4694,7 @@ four"
- + Text( testString, TextAttributes().setWidth( 15 ) ).toString() == "one two three\n four\n five\n six" @@ -4716,7 +4716,7 @@ four"
- + replaceInPlace( letters, "b", "z" ) @@ -4724,7 +4724,7 @@ four" true - + letters == "azcdefcg" @@ -4735,7 +4735,7 @@ four"
- + replaceInPlace( letters, "c", "z" ) @@ -4743,7 +4743,7 @@ four" true - + letters == "abzdefzg" @@ -4754,7 +4754,7 @@ four"
- + replaceInPlace( letters, "a", "z" ) @@ -4762,7 +4762,7 @@ four" true - + letters == "zbcdefcg" @@ -4773,7 +4773,7 @@ four"
- + replaceInPlace( letters, "g", "z" ) @@ -4781,7 +4781,7 @@ four" true - + letters == "abcdefcz" @@ -4792,7 +4792,7 @@ four"
- + replaceInPlace( letters, letters, "replaced" ) @@ -4800,7 +4800,7 @@ four" true - + letters == "replaced" @@ -4811,7 +4811,7 @@ four"
- + !replaceInPlace( letters, "x", "z" ) @@ -4819,7 +4819,7 @@ four" !false - + letters == letters @@ -4830,7 +4830,7 @@ four"
- + replaceInPlace( s, "'", "|'" ) @@ -4838,7 +4838,7 @@ four" true - + s == "didn|'t" @@ -4854,7 +4854,7 @@ four" - + Text( "hi there" ).toString() == "hi there" @@ -4862,7 +4862,7 @@ four" "hi there" == "hi there" - + Text( "hi there", narrow ).toString() == "hi\nthere" @@ -4877,7 +4877,7 @@ there" - + t.toString() EndsWith( "... message truncated due to excessive size" ) @@ -5888,7 +5888,7 @@ there" - + (std::pair<int, int>( 1, 2 )) == aNicePair @@ -5911,7 +5911,7 @@ there" - + &o1 == &o2 @@ -5919,7 +5919,7 @@ there" 0x == 0x - + o1 == o2 @@ -5930,7 +5930,7 @@ there" - + std::string( "first" ) == "second" @@ -5941,7 +5941,7 @@ there" - + i++ == 7 @@ -5949,7 +5949,7 @@ there" 7 == 7 - + i++ == 8 @@ -5960,7 +5960,7 @@ there" - + 0x == o @@ -5971,7 +5971,7 @@ there" - + t == 1u @@ -5982,7 +5982,7 @@ there" - + 0x == bit30and31 @@ -5993,7 +5993,7 @@ there" - + obj.prop != __null @@ -6005,7 +6005,7 @@ there"
- + is_true<true>::value == true @@ -6013,7 +6013,7 @@ there" true == true - + true == is_true<true>::value @@ -6024,7 +6024,7 @@ there"
- + is_true<false>::value == false @@ -6032,7 +6032,7 @@ there" false == false - + false == is_true<false>::value @@ -6043,7 +6043,7 @@ there"
- + !is_true<false>::value @@ -6054,7 +6054,7 @@ there"
- + !!is_true<true>::value @@ -6065,7 +6065,7 @@ there"
- + is_true<true>::value @@ -6073,7 +6073,7 @@ there" true - + !is_true<false>::value @@ -6086,7 +6086,7 @@ there" - + True @@ -6094,7 +6094,7 @@ there" true - + !False @@ -6102,7 +6102,7 @@ there" true - + !False @@ -6113,7 +6113,7 @@ there" - + Catch::alwaysTrue() @@ -6122,7 +6122,7 @@ there"
- + Catch::alwaysTrue() @@ -6131,7 +6131,7 @@ there"
- + Catch::alwaysTrue() @@ -6143,7 +6143,7 @@ there"
- + Catch::alwaysTrue() @@ -6152,7 +6152,7 @@ there"
- + Catch::alwaysTrue() @@ -6161,7 +6161,7 @@ there"
- + Catch::alwaysTrue() @@ -6176,7 +6176,7 @@ there" - + s == "7" @@ -6187,7 +6187,7 @@ there" - + a @@ -6195,7 +6195,7 @@ there" true - + a == &foo @@ -6206,7 +6206,7 @@ there" - + m == &S::f @@ -6219,7 +6219,7 @@ there" - + p == 0 @@ -6230,7 +6230,7 @@ there" - + ptr.get() == nullptr @@ -6253,7 +6253,7 @@ there" - + Catch::toString( item ) == "toString( has_toString )" @@ -6266,7 +6266,7 @@ there" - + Catch::toString( item ) == "StringMaker<has_maker>" @@ -6279,7 +6279,7 @@ there" - + Catch::toString( item ) == "toString( has_maker_and_toString )" @@ -6292,7 +6292,7 @@ there" - + Catch::toString( v ) == "{ {?} }" @@ -6303,7 +6303,7 @@ there" - + Catch::toString( v ) == "{ StringMaker<has_maker> }" @@ -6316,7 +6316,7 @@ there" - + Catch::toString( v ) == "{ StringMaker<has_maker_and_toString> }" @@ -6329,7 +6329,7 @@ there" - + Catch::toString( value ) == "{ 34, \"xyzzy\" }" @@ -6340,7 +6340,7 @@ there" - + Catch::toString(value) == "{ 34, \"xyzzy\" }" @@ -6351,7 +6351,7 @@ there" - + Catch::toString( pr ) == "{ { \"green\", 55 } }" @@ -6364,7 +6364,7 @@ there" - + Catch::toString( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" @@ -6377,7 +6377,7 @@ there" - + Catch::toString(vv) == "{ }" @@ -6385,7 +6385,7 @@ there" "{ }" == "{ }" - + Catch::toString(vv) == "{ 42 }" @@ -6393,7 +6393,7 @@ there" "{ 42 }" == "{ 42 }" - + Catch::toString(vv) == "{ 42, 512 }" @@ -6404,7 +6404,7 @@ there" - + Catch::toString(vv) == "{ }" @@ -6412,7 +6412,7 @@ there" "{ }" == "{ }" - + Catch::toString(vv) == "{ \"hello\" }" @@ -6420,7 +6420,7 @@ there" "{ "hello" }" == "{ "hello" }" - + Catch::toString(vv) == "{ \"hello\", \"world\" }" @@ -6433,7 +6433,7 @@ there" - + Catch::toString(vv) == "{ }" @@ -6441,7 +6441,7 @@ there" "{ }" == "{ }" - + Catch::toString(vv) == "{ 42 }" @@ -6449,7 +6449,7 @@ there" "{ 42 }" == "{ 42 }" - + Catch::toString(vv) == "{ 42, 512 }" @@ -6460,7 +6460,7 @@ there" - + Catch::toString(v) == "{ }" @@ -6468,7 +6468,7 @@ there" "{ }" == "{ }" - + Catch::toString(v) == "{ { \"hello\" }, { \"world\" } }" @@ -6482,7 +6482,7 @@ there"
- + spec.hasFilters() == false @@ -6490,7 +6490,7 @@ there" false == false - + spec.matches( tcA ) == false @@ -6498,7 +6498,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6509,7 +6509,7 @@ there"
- + spec.hasFilters() == false @@ -6517,7 +6517,7 @@ there" false == false - + spec.matches(tcA ) == false @@ -6525,7 +6525,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6536,7 +6536,7 @@ there"
- + spec.hasFilters() == false @@ -6544,7 +6544,7 @@ there" false == false - + spec.matches( tcA ) == false @@ -6552,7 +6552,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6563,7 +6563,7 @@ there"
- + spec.hasFilters() == true @@ -6571,7 +6571,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6579,7 +6579,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6590,7 +6590,7 @@ there"
- + spec.hasFilters() == true @@ -6598,7 +6598,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6606,7 +6606,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6617,7 +6617,7 @@ there"
- + spec.hasFilters() == true @@ -6625,7 +6625,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6633,7 +6633,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6641,7 +6641,7 @@ there" true == true - + spec.matches( tcC ) == false @@ -6652,7 +6652,7 @@ there"
- + spec.hasFilters() == true @@ -6660,7 +6660,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6668,7 +6668,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6676,7 +6676,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6684,7 +6684,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -6692,7 +6692,7 @@ there" false == false - + parseTestSpec( "*a" ).matches( tcA ) == true @@ -6703,7 +6703,7 @@ there"
- + spec.hasFilters() == true @@ -6711,7 +6711,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6719,7 +6719,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6727,7 +6727,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6735,7 +6735,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -6743,7 +6743,7 @@ there" false == false - + parseTestSpec( "a*" ).matches( tcA ) == true @@ -6754,7 +6754,7 @@ there"
- + spec.hasFilters() == true @@ -6762,7 +6762,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6770,7 +6770,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6778,7 +6778,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6786,7 +6786,7 @@ there" true == true - + spec.matches( tcD ) == true @@ -6794,7 +6794,7 @@ there" true == true - + parseTestSpec( "*a*" ).matches( tcA ) == true @@ -6805,7 +6805,7 @@ there"
- + spec.hasFilters() == true @@ -6813,7 +6813,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6821,7 +6821,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -6832,7 +6832,7 @@ there"
- + spec.hasFilters() == true @@ -6840,7 +6840,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6848,7 +6848,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -6859,7 +6859,7 @@ there"
- + spec.hasFilters() == true @@ -6867,7 +6867,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6875,7 +6875,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -6886,7 +6886,7 @@ there"
- + spec.hasFilters() == true @@ -6894,7 +6894,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6902,7 +6902,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -6910,7 +6910,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -6918,7 +6918,7 @@ there" true == true - + spec.matches( tcD ) == true @@ -6929,7 +6929,7 @@ there"
- + spec.hasFilters() == true @@ -6937,7 +6937,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -6945,7 +6945,7 @@ there" true == true - + spec.matches( tcB ) == true @@ -6953,7 +6953,7 @@ there" true == true - + spec.matches( tcC ) == true @@ -6961,7 +6961,7 @@ there" true == true - + spec.matches( tcD ) == true @@ -6972,7 +6972,7 @@ there"
- + spec.hasFilters() == true @@ -6980,7 +6980,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -6988,7 +6988,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -6996,7 +6996,7 @@ there" true == true - + spec.matches( tcC ) == false @@ -7007,7 +7007,7 @@ there"
- + spec.hasFilters() == true @@ -7015,7 +7015,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7023,7 +7023,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -7031,7 +7031,7 @@ there" true == true - + spec.matches( tcC ) == true @@ -7042,7 +7042,7 @@ there"
- + spec.hasFilters() == true @@ -7050,7 +7050,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7058,7 +7058,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7066,7 +7066,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -7077,7 +7077,7 @@ there"
- + spec.hasFilters() == true @@ -7085,7 +7085,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7093,7 +7093,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7101,7 +7101,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -7112,7 +7112,7 @@ there"
- + spec.hasFilters() == true @@ -7120,7 +7120,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7128,7 +7128,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7136,7 +7136,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -7144,7 +7144,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -7155,7 +7155,7 @@ there"
- + spec.hasFilters() == true @@ -7163,7 +7163,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -7171,7 +7171,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -7179,7 +7179,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -7190,7 +7190,7 @@ there"
- + spec.hasFilters() == true @@ -7198,7 +7198,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7206,7 +7206,7 @@ there" false == false - + spec.matches( tcB ) == true @@ -7214,7 +7214,7 @@ there" true == true - + spec.matches( tcC ) == false @@ -7225,7 +7225,7 @@ there"
- + spec.hasFilters() == true @@ -7233,7 +7233,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7241,7 +7241,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7249,7 +7249,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -7257,7 +7257,7 @@ there" false == false - + spec.matches( tcD ) == true @@ -7268,7 +7268,7 @@ there"
- + spec.hasFilters() == true @@ -7276,7 +7276,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7284,7 +7284,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7292,7 +7292,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -7300,7 +7300,7 @@ there" false == false - + spec.matches( tcD ) == true @@ -7311,7 +7311,7 @@ there"
- + spec.hasFilters() == true @@ -7319,7 +7319,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -7327,7 +7327,7 @@ there" true == true - + spec.matches( tcB ) == false @@ -7335,7 +7335,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -7343,7 +7343,7 @@ there" true == true - + spec.matches( tcD ) == true @@ -7354,7 +7354,7 @@ there"
- + spec.hasFilters() == true @@ -7362,7 +7362,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -7370,7 +7370,7 @@ there" true == true - + spec.matches( tcB ) == true @@ -7378,7 +7378,7 @@ there" true == true - + spec.matches( tcC ) == false @@ -7386,7 +7386,7 @@ there" false == false - + spec.matches( tcD ) == false @@ -7397,7 +7397,7 @@ there"
- + spec.hasFilters() == true @@ -7405,7 +7405,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -7413,7 +7413,7 @@ there" true == true - + spec.matches( tcB ) == true @@ -7421,7 +7421,7 @@ there" true == true - + spec.matches( tcC ) == true @@ -7429,7 +7429,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -7440,7 +7440,7 @@ there"
- + spec.hasFilters() == true @@ -7448,7 +7448,7 @@ there" true == true - + spec.matches( tcA ) == true @@ -7456,7 +7456,7 @@ there" true == true - + spec.matches( tcB ) == true @@ -7464,7 +7464,7 @@ there" true == true - + spec.matches( tcC ) == true @@ -7472,7 +7472,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -7483,7 +7483,7 @@ there"
- + spec.hasFilters() == true @@ -7491,7 +7491,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7499,7 +7499,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7507,7 +7507,7 @@ there" false == false - + spec.matches( tcC ) == true @@ -7515,7 +7515,7 @@ there" true == true - + spec.matches( tcD ) == false @@ -7526,7 +7526,7 @@ there"
- + spec.hasFilters() == false @@ -7534,7 +7534,7 @@ there" false == false - + spec.matches( tcA ) == false @@ -7542,7 +7542,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7550,7 +7550,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -7558,7 +7558,7 @@ there" false == false - + spec.matches( tcD ) == false @@ -7569,7 +7569,7 @@ there"
- + spec.hasFilters() == false @@ -7577,7 +7577,7 @@ there" false == false - + spec.matches( tcA ) == false @@ -7585,7 +7585,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7593,7 +7593,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -7601,7 +7601,7 @@ there" false == false - + spec.matches( tcD ) == false @@ -7612,7 +7612,7 @@ there"
- + spec.hasFilters() == true @@ -7620,7 +7620,7 @@ there" true == true - + spec.matches( tcA ) == false @@ -7628,7 +7628,7 @@ there" false == false - + spec.matches( tcB ) == false @@ -7636,7 +7636,7 @@ there" false == false - + spec.matches( tcC ) == false @@ -7644,7 +7644,7 @@ there" false == false - + spec.matches( tcD ) == true @@ -7658,7 +7658,7 @@ there"
- + what Contains( "[@zzz]" ) @@ -7668,7 +7668,7 @@ there" Redefined at file:10" contains: "[@zzz]" - + what Contains( "file" ) @@ -7678,7 +7678,7 @@ there" Redefined at file:10" contains: "file" - + what Contains( "2" ) @@ -7688,7 +7688,7 @@ there" Redefined at file:10" contains: "2" - + what Contains( "10" ) @@ -7701,7 +7701,7 @@ there"
- + registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) @@ -7709,7 +7709,7 @@ there" registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) - + registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) @@ -7717,7 +7717,7 @@ there" registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) - + registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) @@ -7725,7 +7725,7 @@ there" registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) - + registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) @@ -7753,7 +7753,7 @@ there"
- + itDoesThis() @@ -7762,7 +7762,7 @@ there"
- + itDoesThat() @@ -7782,7 +7782,7 @@ there"
- + v.size() == 0 @@ -7792,7 +7792,7 @@ there"
- + v.size() == 10 @@ -7800,7 +7800,7 @@ there" 10 == 10 - + v.capacity() >= 10 @@ -7810,7 +7810,7 @@ there"
- + v.size() == 5 @@ -7818,7 +7818,7 @@ there" 5 == 5 - + v.capacity() >= 10 @@ -7837,7 +7837,7 @@ there"
- + v.size() == 0 @@ -7847,7 +7847,7 @@ there"
- + v.capacity() >= 10 @@ -7855,7 +7855,7 @@ there" 10 >= 10 - + v.size() == 0 @@ -7885,7 +7885,7 @@ there"
- + before == 0 @@ -7895,7 +7895,7 @@ there"
- + after > before @@ -7912,7 +7912,7 @@ there" - + !testCaseTracker.isCompleted() @@ -7921,7 +7921,7 @@ there"
- + !testCaseTracker.isCompleted() @@ -7929,7 +7929,7 @@ there" !false - + testCaseTracker.isCompleted() @@ -7939,7 +7939,7 @@ there"
- + !testCaseTracker.isCompleted() @@ -7948,7 +7948,7 @@ there"
- + testCaseTracker.enterSection( section1Name ) @@ -7956,7 +7956,7 @@ there" true - + !testCaseTracker.isCompleted() @@ -7964,7 +7964,7 @@ there" !false - + testCaseTracker.isCompleted() @@ -7972,7 +7972,7 @@ there" true - + !testCaseTracker.enterSection( section1Name ) @@ -7982,7 +7982,7 @@ there"
- + !testCaseTracker.isCompleted() @@ -7991,7 +7991,7 @@ there"
- + testCaseTracker.enterSection( section1Name ) @@ -7999,7 +7999,7 @@ there" true - + !testCaseTracker.enterSection( section2Name ) @@ -8007,7 +8007,7 @@ there" !false - + !testCaseTracker.isCompleted() @@ -8015,7 +8015,7 @@ there" !false - + !testCaseTracker.enterSection( section1Name ) @@ -8023,7 +8023,7 @@ there" !false - + testCaseTracker.enterSection( section2Name ) @@ -8031,7 +8031,7 @@ there" true - + testCaseTracker.isCompleted() @@ -8041,7 +8041,7 @@ there"
- + !testCaseTracker.isCompleted() @@ -8050,7 +8050,7 @@ there"
- + testCaseTracker.enterSection( section1Name ) @@ -8058,7 +8058,7 @@ there" true - + testCaseTracker.enterSection( section2Name ) @@ -8066,7 +8066,7 @@ there" true - + !testCaseTracker.isCompleted() @@ -8074,7 +8074,7 @@ there" !false - + testCaseTracker.isCompleted() From d76e08113b30997299200c654b27a71ec04af91b Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 30 Dec 2014 18:26:07 +0000 Subject: [PATCH 091/102] build 12 - includes updated xml reporter --- README.md | 2 +- include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 185 ++++++++++++++++++----------- 3 files changed, 115 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 86edc78a..9bc85d45 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![catch logo](catch-logo-small.png) -*v1.1 build 11 (develop branch)* +*v1.1 build 12 (develop branch)* Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index 6c137e42..ecddfac6 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -13,7 +13,7 @@ namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 11, "develop" ); + Version libraryVersion( 1, 1, 12, "develop" ); } #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 7bdc5141..554e0906 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * CATCH v1.1 build 11 (develop branch) - * Generated: 2014-12-22 20:17:55.347268 + * CATCH v1.1 build 12 (develop branch) + * Generated: 2014-12-30 18:25:37.281243 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -1689,6 +1689,9 @@ namespace Catch { bool allPassed() const { return failed == 0 && failedButOk == 0; } + bool allOk() const { + return failed == 0; + } std::size_t passed; std::size_t failed; @@ -6686,7 +6689,7 @@ namespace Catch { namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 11, "develop" ); + Version libraryVersion( 1, 1, 12, "develop" ); } // #included from: catch_message.hpp @@ -7986,81 +7989,90 @@ namespace Catch { } namespace Catch { - class XmlReporter : public SharedImpl { + class XmlReporter : public StreamingReporterBase { public: - XmlReporter( ReporterConfig const& config ) : m_config( config ), m_sectionDepth( 0 ) {} + XmlReporter( ReporterConfig const& _config ) + : StreamingReporterBase( _config ), + m_sectionDepth( 0 ) + {} + + virtual ~XmlReporter(); static std::string getDescription() { return "Reports test results as an XML document"; } - virtual ~XmlReporter(); - private: // IReporter - - virtual bool shouldRedirectStdout() const { - return true; + public: // StreamingReporterBase + virtual ReporterPreferences getPreferences() const { + ReporterPreferences prefs; + prefs.shouldRedirectStdOut = true; + return prefs; } - virtual void StartTesting() { - m_xml.setStream( m_config.stream() ); + virtual void noMatchingTestCases( std::string const& s ) { + StreamingReporterBase::noMatchingTestCases( s ); + } + + virtual void testRunStarting( TestRunInfo const& testInfo ) { + StreamingReporterBase::testRunStarting( testInfo ); + m_xml.setStream( stream ); m_xml.startElement( "Catch" ); - if( !m_config.fullConfig()->name().empty() ) - m_xml.writeAttribute( "name", m_config.fullConfig()->name() ); + if( !m_config->name().empty() ) + m_xml.writeAttribute( "name", m_config->name() ); } - virtual void EndTesting( const Totals& totals ) { - m_xml.scopedElement( "OverallResults" ) - .writeAttribute( "successes", totals.assertions.passed ) - .writeAttribute( "failures", totals.assertions.failed ) - .writeAttribute( "expectedFailures", totals.assertions.failedButOk ); - m_xml.endElement(); - } - - virtual void StartGroup( const std::string& groupName ) { + virtual void testGroupStarting( GroupInfo const& groupInfo ) { + StreamingReporterBase::testGroupStarting( groupInfo ); m_xml.startElement( "Group" ) - .writeAttribute( "name", groupName ); + .writeAttribute( "name", groupInfo.name ); } - virtual void EndGroup( const std::string&, const Totals& totals ) { - m_xml.scopedElement( "OverallResults" ) - .writeAttribute( "successes", totals.assertions.passed ) - .writeAttribute( "failures", totals.assertions.failed ) - .writeAttribute( "expectedFailures", totals.assertions.failedButOk ); - m_xml.endElement(); + virtual void testCaseStarting( TestCaseInfo const& testInfo ) { + StreamingReporterBase::testCaseStarting(testInfo); + m_xml.startElement( "TestCase" ).writeAttribute( "name", trim( testInfo.name ) ); + + if ( m_config->showDurations() == ShowDurations::Always ) + m_testCaseTimer.start(); } - virtual void StartSection( const std::string& sectionName, const std::string& description ) { + virtual void sectionStarting( SectionInfo const& sectionInfo ) { + StreamingReporterBase::sectionStarting( sectionInfo ); if( m_sectionDepth++ > 0 ) { m_xml.startElement( "Section" ) - .writeAttribute( "name", trim( sectionName ) ) - .writeAttribute( "description", description ); - } - } - virtual void NoAssertionsInSection( const std::string& ) {} - virtual void NoAssertionsInTestCase( const std::string& ) {} - - virtual void EndSection( const std::string& /*sectionName*/, const Counts& assertions ) { - if( --m_sectionDepth > 0 ) { - m_xml.scopedElement( "OverallResults" ) - .writeAttribute( "successes", assertions.passed ) - .writeAttribute( "failures", assertions.failed ) - .writeAttribute( "expectedFailures", assertions.failedButOk ); - m_xml.endElement(); + .writeAttribute( "name", trim( sectionInfo.name ) ) + .writeAttribute( "description", sectionInfo.description ); } } - virtual void StartTestCase( const Catch::TestCaseInfo& testInfo ) { - m_xml.startElement( "TestCase" ).writeAttribute( "name", trim( testInfo.name ) ); - m_currentTestSuccess = true; - } + virtual void assertionStarting( AssertionInfo const& ) { } - virtual void Result( const Catch::AssertionResult& assertionResult ) { - if( !m_config.fullConfig()->includeSuccessfulResults() && assertionResult.getResultType() == ResultWas::Ok ) - return; + virtual bool assertionEnded( AssertionStats const& assertionStats ) { + const AssertionResult& assertionResult = assertionStats.assertionResult; + // Print any info messages in tags. + if( assertionStats.assertionResult.getResultType() != ResultWas::Ok ) { + for( std::vector::const_iterator it = assertionStats.infoMessages.begin(), itEnd = assertionStats.infoMessages.end(); + it != itEnd; + ++it ) { + if( it->type == ResultWas::Info ) { + m_xml.scopedElement( "Info" ) + .writeText( it->message ); + } else if ( it->type == ResultWas::Warning ) { + m_xml.scopedElement( "Warning" ) + .writeText( it->message ); + } + } + } + + // Drop out if result was successful but we're not printing them. + if( !m_config->includeSuccessfulResults() && isOk(assertionResult.getResultType()) ) + return true; + + // Print the expression if there is one. if( assertionResult.hasExpression() ) { m_xml.startElement( "Expression" ) .writeAttribute( "success", assertionResult.succeeded() ) + .writeAttribute( "type", assertionResult.getTestMacroName() ) .writeAttribute( "filename", assertionResult.getSourceInfo().file ) .writeAttribute( "line", assertionResult.getSourceInfo().line ); @@ -8068,65 +8080,96 @@ namespace Catch { .writeText( assertionResult.getExpression() ); m_xml.scopedElement( "Expanded" ) .writeText( assertionResult.getExpandedExpression() ); - m_currentTestSuccess &= assertionResult.succeeded(); } + // And... Print a result applicable to each result type. switch( assertionResult.getResultType() ) { case ResultWas::ThrewException: m_xml.scopedElement( "Exception" ) .writeAttribute( "filename", assertionResult.getSourceInfo().file ) .writeAttribute( "line", assertionResult.getSourceInfo().line ) .writeText( assertionResult.getMessage() ); - m_currentTestSuccess = false; break; case ResultWas::FatalErrorCondition: m_xml.scopedElement( "Fatal Error Condition" ) .writeAttribute( "filename", assertionResult.getSourceInfo().file ) .writeAttribute( "line", assertionResult.getSourceInfo().line ) .writeText( assertionResult.getMessage() ); - m_currentTestSuccess = false; break; case ResultWas::Info: m_xml.scopedElement( "Info" ) .writeText( assertionResult.getMessage() ); break; case ResultWas::Warning: - m_xml.scopedElement( "Warning" ) - .writeText( assertionResult.getMessage() ); + // Warning will already have been written break; case ResultWas::ExplicitFailure: m_xml.scopedElement( "Failure" ) .writeText( assertionResult.getMessage() ); - m_currentTestSuccess = false; break; - case ResultWas::Unknown: - case ResultWas::Ok: - case ResultWas::FailureBit: - case ResultWas::ExpressionFailed: - case ResultWas::Exception: - case ResultWas::DidntThrowException: + default: break; } + if( assertionResult.hasExpression() ) m_xml.endElement(); + + return true; } - virtual void Aborted() { - // !TBD + virtual void sectionEnded( SectionStats const& sectionStats ) { + StreamingReporterBase::sectionEnded( sectionStats ); + if( --m_sectionDepth > 0 ) { + XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); + e.writeAttribute( "successes", sectionStats.assertions.passed ); + e.writeAttribute( "failures", sectionStats.assertions.failed ); + e.writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk ); + + if ( m_config->showDurations() == ShowDurations::Always ) + e.writeAttribute( "durationInSeconds", sectionStats.durationInSeconds ); + + m_xml.endElement(); + } } - virtual void EndTestCase( const Catch::TestCaseInfo&, const Totals&, const std::string&, const std::string& ) { - m_xml.scopedElement( "OverallResult" ).writeAttribute( "success", m_currentTestSuccess ); + virtual void testCaseEnded( TestCaseStats const& testCaseStats ) { + StreamingReporterBase::testCaseEnded( testCaseStats ); + XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); + e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() ); + + if ( m_config->showDurations() == ShowDurations::Always ) + e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() ); + + m_xml.endElement(); + } + + virtual void testGroupEnded( TestGroupStats const& testGroupStats ) { + StreamingReporterBase::testGroupEnded( testGroupStats ); + // TODO: Check testGroupStats.aborting and act accordingly. + m_xml.scopedElement( "OverallResults" ) + .writeAttribute( "successes", testGroupStats.totals.assertions.passed ) + .writeAttribute( "failures", testGroupStats.totals.assertions.failed ) + .writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk ); + m_xml.endElement(); + } + + virtual void testRunEnded( TestRunStats const& testRunStats ) { + StreamingReporterBase::testRunEnded( testRunStats ); + m_xml.scopedElement( "OverallResults" ) + .writeAttribute( "successes", testRunStats.totals.assertions.passed ) + .writeAttribute( "failures", testRunStats.totals.assertions.failed ) + .writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk ); m_xml.endElement(); } private: - ReporterConfig m_config; - bool m_currentTestSuccess; + Timer m_testCaseTimer; XmlWriter m_xml; int m_sectionDepth; }; + INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter ) + } // end namespace Catch // #included from: ../reporters/catch_reporter_junit.hpp @@ -9119,8 +9162,6 @@ namespace Catch { Matchers::Impl::StdString::EndsWith::~EndsWith() {} void Config::dummy() {} - - INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "xml", XmlReporter ) } #ifdef __clang__ From 50183208a38aca621e021f90d69cd2591a9e05b8 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 30 Dec 2014 18:47:01 +0000 Subject: [PATCH 092/102] Added tests for toString> and rebased --- .../Baselines/console.std.approved.txt | 4 +- .../Baselines/console.sw.approved.txt | 94 ++++++++++++++++++- .../SelfTest/Baselines/junit.sw.approved.txt | 8 +- .../SelfTest/Baselines/xml.sw.approved.txt | 92 +++++++++++++++++- .../CatchSelfTest.xcodeproj/project.pbxproj | 4 + 5 files changed, 195 insertions(+), 7 deletions(-) diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 87319a67..5b5639a5 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -786,6 +786,6 @@ with expansion: "first" == "second" =============================================================================== -test cases: 149 | 110 passed | 38 failed | 1 failed as expected -assertions: 753 | 661 passed | 79 failed | 13 failed as expected +test cases: 155 | 116 passed | 38 failed | 1 failed as expected +assertions: 761 | 669 passed | 79 failed | 13 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 0c9a8ac9..fbacd9a8 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -7373,6 +7373,96 @@ PASSED: with expansion: true == true +------------------------------------------------------------------------------- +tuple<> +------------------------------------------------------------------------------- +ToStringTuple.cpp: +............................................................................... + +ToStringTuple.cpp:: +PASSED: + CHECK( "{ }" == Catch::toString(type{}) ) +with expansion: + "{ }" == "{ }" + +ToStringTuple.cpp:: +PASSED: + CHECK( "{ }" == Catch::toString(value) ) +with expansion: + "{ }" == "{ }" + +------------------------------------------------------------------------------- +tuple +------------------------------------------------------------------------------- +ToStringTuple.cpp: +............................................................................... + +ToStringTuple.cpp:: +PASSED: + CHECK( "{ 0 }" == Catch::toString(type{0}) ) +with expansion: + "{ 0 }" == "{ 0 }" + +------------------------------------------------------------------------------- +tuple +------------------------------------------------------------------------------- +ToStringTuple.cpp: +............................................................................... + +ToStringTuple.cpp:: +PASSED: + CHECK( "1.2f" == Catch::toString(float(1.2)) ) +with expansion: + "1.2f" == "1.2f" + +ToStringTuple.cpp:: +PASSED: + CHECK( "{ 1.2f, 0 }" == Catch::toString(type{1.2,0}) ) +with expansion: + "{ 1.2f, 0 }" == "{ 1.2f, 0 }" + +------------------------------------------------------------------------------- +tuple +------------------------------------------------------------------------------- +ToStringTuple.cpp: +............................................................................... + +ToStringTuple.cpp:: +PASSED: + CHECK( "{ \"hello\", \"world\" }" == Catch::toString(type{"hello","world"}) ) +with expansion: + "{ "hello", "world" }" + == + "{ "hello", "world" }" + +------------------------------------------------------------------------------- +tuple,tuple<>,float> +------------------------------------------------------------------------------- +ToStringTuple.cpp: +............................................................................... + +ToStringTuple.cpp:: +PASSED: + CHECK( "{ { 42 }, { }, 1.2f }" == Catch::toString(value) ) +with expansion: + "{ { 42 }, { }, 1.2f }" + == + "{ { 42 }, { }, 1.2f }" + +------------------------------------------------------------------------------- +tuple +------------------------------------------------------------------------------- +ToStringTuple.cpp: +............................................................................... + +ToStringTuple.cpp:: +PASSED: + CHECK( "{ nullptr, 42, \"Catch me\" }" == Catch::toString(value) ) +with expansion: + "{ nullptr, 42, "Catch me" }" + == + "{ nullptr, 42, "Catch me" }" + ------------------------------------------------------------------------------- Tag alias can be registered against tag patterns The same tag alias can only be registered once @@ -7816,6 +7906,6 @@ with expansion: true =============================================================================== -test cases: 149 | 94 passed | 54 failed | 1 failed as expected -assertions: 773 | 661 passed | 99 failed | 13 failed as expected +test cases: 155 | 100 passed | 54 failed | 1 failed as expected +assertions: 781 | 669 passed | 99 failed | 13 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index ba3f1799..2da1e452 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,5 +1,5 @@ - + @@ -585,6 +585,12 @@ TrickyTests.cpp: + + + + + + diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 1dcfec76..6f30c63f 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -7656,6 +7656,94 @@ there"
+ + + + "{ }" == Catch::toString(type{}) + + + "{ }" == "{ }" + + + + + "{ }" == Catch::toString(value) + + + "{ }" == "{ }" + + + + + + + + "{ 0 }" == Catch::toString(type{0}) + + + "{ 0 }" == "{ 0 }" + + + + + + + + "1.2f" == Catch::toString(float(1.2)) + + + "1.2f" == "1.2f" + + + + + "{ 1.2f, 0 }" == Catch::toString(type{1.2,0}) + + + "{ 1.2f, 0 }" == "{ 1.2f, 0 }" + + + + + + + + "{ \"hello\", \"world\" }" == Catch::toString(type{"hello","world"}) + + + "{ "hello", "world" }" +== +"{ "hello", "world" }" + + + + + + + + "{ { 42 }, { }, 1.2f }" == Catch::toString(value) + + + "{ { 42 }, { }, 1.2f }" +== +"{ { 42 }, { }, 1.2f }" + + + + + + + + "{ nullptr, 42, \"Catch me\" }" == Catch::toString(value) + + + "{ nullptr, 42, "Catch me" }" +== +"{ nullptr, 42, "Catch me" }" + + + +
@@ -8086,7 +8174,7 @@ there"
- + - + diff --git a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj index e4b59f56..6658ca69 100644 --- a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj +++ b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 266ECD74170F3C620030D735 /* BDDTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266ECD73170F3C620030D735 /* BDDTests.cpp */; }; 26711C8F195D465C0033EDA2 /* TagAliasTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26711C8D195D465C0033EDA2 /* TagAliasTests.cpp */; }; 26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26847E5D16BBADB40043B9C1 /* catch_message.cpp */; }; + 2691574C1A532A280054F1ED /* ToStringTuple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2691574B1A532A280054F1ED /* ToStringTuple.cpp */; }; 26948286179A9AB900ED166E /* SectionTrackerTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26948284179A9AB900ED166E /* SectionTrackerTests.cpp */; }; 2694A1FD16A0000E004816E3 /* catch_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2694A1FB16A0000E004816E3 /* catch_text.cpp */; }; 26E1B7D319213BC900812682 /* CmdLineTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E1B7D119213BC900812682 /* CmdLineTests.cpp */; }; @@ -97,6 +98,7 @@ 26847E5D16BBADB40043B9C1 /* catch_message.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_message.cpp; path = ../../../SelfTest/SurrogateCpps/catch_message.cpp; sourceTree = ""; }; 268F47B018A93F7800D8C14F /* catch_clara.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_clara.h; sourceTree = ""; }; 2691574A1A4480C50054F1ED /* catch_reporter_teamcity.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_reporter_teamcity.hpp; sourceTree = ""; }; + 2691574B1A532A280054F1ED /* ToStringTuple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ToStringTuple.cpp; path = ../../../SelfTest/ToStringTuple.cpp; sourceTree = ""; }; 26926E8318D7777D004E10F2 /* clara.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = clara.h; path = ../../../../include/external/clara.h; sourceTree = ""; }; 26926E8418D77809004E10F2 /* tbc_text_format.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tbc_text_format.h; path = ../../../../include/external/tbc_text_format.h; sourceTree = ""; }; 26948284179A9AB900ED166E /* SectionTrackerTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SectionTrackerTests.cpp; path = ../../../SelfTest/SectionTrackerTests.cpp; sourceTree = ""; }; @@ -256,6 +258,7 @@ 4A6D0C40149B3DAB00DB3EAA /* Tests */ = { isa = PBXGroup; children = ( + 2691574B1A532A280054F1ED /* ToStringTuple.cpp */, 263F7A4819B6FE1E009474C2 /* ToStringPair.cpp */, 263F7A4919B6FE1E009474C2 /* ToStringVector.cpp */, 263F7A4A19B6FE1E009474C2 /* ToStringWhich.cpp */, @@ -558,6 +561,7 @@ 4A45DA2D16161FA2004F8D6B /* catch_interfaces_capture.cpp in Sources */, 4A45DA3116161FFC004F8D6B /* catch_interfaces_reporter.cpp in Sources */, 4A45DA3316162047004F8D6B /* catch_interfaces_exception.cpp in Sources */, + 2691574C1A532A280054F1ED /* ToStringTuple.cpp in Sources */, 26711C8F195D465C0033EDA2 /* TagAliasTests.cpp in Sources */, 4A45DA3516162071004F8D6B /* catch_interfaces_runner.cpp in Sources */, 4AB3D99D1616216500C9A0F8 /* catch_interfaces_testcase.cpp in Sources */, From 7f5615272b0fb51bcd7a669e68f3b4c7a87d93bb Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 30 Dec 2014 18:47:29 +0000 Subject: [PATCH 093/102] build 13 toString for std:tuple --- README.md | 2 +- include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 109 +++++++++++++++++++++-------- 3 files changed, 80 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 9bc85d45..73c3fa9d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![catch logo](catch-logo-small.png) -*v1.1 build 12 (develop branch)* +*v1.1 build 13 (develop branch)* Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index ecddfac6..3929e0c4 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -13,7 +13,7 @@ namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 12, "develop" ); + Version libraryVersion( 1, 1, 13, "develop" ); } #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 554e0906..bd377f92 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * CATCH v1.1 build 12 (develop branch) - * Generated: 2014-12-30 18:25:37.281243 + * CATCH v1.1 build 13 (develop branch) + * Generated: 2014-12-30 18:47:08.984634 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -1049,12 +1049,45 @@ inline id performOptionalSelector( id obj, SEL sel ) { #endif +#ifdef CATCH_CPP11_OR_GREATER +#include +#include +#endif + namespace Catch { // Why we're here. template std::string toString( T const& value ); +// Built in overloads + +std::string toString( std::string const& value ); +std::string toString( std::wstring const& value ); +std::string toString( const char* const value ); +std::string toString( char* const value ); +std::string toString( const wchar_t* const value ); +std::string toString( wchar_t* const value ); +std::string toString( int value ); +std::string toString( unsigned long value ); +std::string toString( unsigned int value ); +std::string toString( const double value ); +std::string toString( const float value ); +std::string toString( bool value ); +std::string toString( char value ); +std::string toString( signed char value ); +std::string toString( unsigned char value ); + +#ifdef CATCH_CONFIG_CPP11_NULLPTR +std::string toString( std::nullptr_t ); +#endif + +#ifdef __OBJC__ + std::string toString( NSString const * const& nsstring ); + std::string toString( NSString * CATCH_ARC_STRONG const& nsstring ); + std::string toString( NSObject* const& nsObject ); +#endif + namespace Detail { extern std::string unprintableString; @@ -1194,6 +1227,48 @@ std::string toString( std::vector const& v ) { return Detail::rangeToString( v.begin(), v.end() ); } +#ifdef CATCH_CPP11_OR_GREATER + toString for tuples + */ +namespace TupleDetail { + template< + typename Tuple, + std::size_t N = 0, + bool = (N < std::tuple_size::value) + > + struct ElementPrinter { + static void print( const Tuple& tuple, std::ostream& os ) + { + os << ( N ? ", " : " " ) + << Catch::toString(std::get(tuple)); + ElementPrinter::print(tuple,os); + } + }; + + template< + typename Tuple, + std::size_t N + > + struct ElementPrinter { + static void print( const Tuple&, std::ostream& ) {} + }; + +} + +template +struct StringMaker> { + + static std::string convert( const std::tuple& tuple ) + { + std::ostringstream os; + os << '{'; + TupleDetail::ElementPrinter>::print( tuple, os ); + os << " }"; + return os.str(); + } +}; +#endif + namespace Detail { template std::string makeString( T const& value ) { @@ -1213,34 +1288,6 @@ std::string toString( T const& value ) { return StringMaker::convert( value ); } -// Built in overloads - -std::string toString( std::string const& value ); -std::string toString( std::wstring const& value ); -std::string toString( const char* const value ); -std::string toString( char* const value ); -std::string toString( const wchar_t* const value ); -std::string toString( wchar_t* const value ); -std::string toString( int value ); -std::string toString( unsigned long value ); -std::string toString( unsigned int value ); -std::string toString( const double value ); -std::string toString( const float value ); -std::string toString( bool value ); -std::string toString( char value ); -std::string toString( signed char value ); -std::string toString( unsigned char value ); - -#ifdef CATCH_CONFIG_CPP11_NULLPTR -std::string toString( std::nullptr_t ); -#endif - -#ifdef __OBJC__ - std::string toString( NSString const * const& nsstring ); - std::string toString( NSString * CATCH_ARC_STRONG const& nsstring ); - std::string toString( NSObject* const& nsObject ); -#endif - namespace Detail { template std::string rangeToString( InputIterator first, InputIterator last ) { @@ -6689,7 +6736,7 @@ namespace Catch { namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 12, "develop" ); + Version libraryVersion( 1, 1, 13, "develop" ); } // #included from: catch_message.hpp From e5280b2c5722ab93419905d886e8675ee912bd25 Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Wed, 11 Feb 2015 12:40:20 -0800 Subject: [PATCH 094/102] Add --force-colour option to force colour output. Adding a --force-colour option to force colour output on POSIX systems, provided a debugger is not attached. This allows for Catch to output colours even if STDOUT is not a tty, which can be the case when the test executable is being spawned by a parent process (e.g. CMake's ctest). --- include/internal/catch_commandline.hpp | 4 ++++ include/internal/catch_config.hpp | 4 +++- include/internal/catch_console_colour_impl.hpp | 3 ++- include/internal/catch_interfaces_config.h | 1 + projects/SelfTest/TestMain.cpp | 18 +++++++++++++++++- 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp index a17059f4..8b085365 100644 --- a/include/internal/catch_commandline.hpp +++ b/include/internal/catch_commandline.hpp @@ -170,6 +170,10 @@ namespace Catch { .describe( "set a specific seed for random numbers" ) .bind( &setRngSeed, "'time'|number" ); + cli["--force-colour"] + .describe( "force colourised output" ) + .bind( &ConfigData::forceColour ); + return cli; } diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp index 3e332087..1f3ca64a 100644 --- a/include/internal/catch_config.hpp +++ b/include/internal/catch_config.hpp @@ -37,6 +37,7 @@ namespace Catch { noThrow( false ), showHelp( false ), showInvisibles( false ), + forceColour( false ), abortAfter( -1 ), rngSeed( 0 ), verbosity( Verbosity::Normal ), @@ -55,6 +56,7 @@ namespace Catch { bool noThrow; bool showHelp; bool showInvisibles; + bool forceColour; int abortAfter; unsigned int rngSeed; @@ -131,7 +133,6 @@ namespace Catch { std::string getReporterName() const { return m_data.reporterName; } - int abortAfter() const { return m_data.abortAfter; } TestSpec const& testSpec() const { return m_testSpec; } @@ -148,6 +149,7 @@ namespace Catch { virtual ShowDurations::OrNot showDurations() const { return m_data.showDurations; } virtual RunTests::InWhatOrder runOrder() const { return m_data.runOrder; } virtual unsigned int rngSeed() const { return m_data.rngSeed; } + virtual bool forceColour() const { return m_data.forceColour; } private: ConfigData m_data; diff --git a/include/internal/catch_console_colour_impl.hpp b/include/internal/catch_console_colour_impl.hpp index a62550bd..2c4b36c3 100644 --- a/include/internal/catch_console_colour_impl.hpp +++ b/include/internal/catch_console_colour_impl.hpp @@ -143,7 +143,8 @@ namespace { }; IColourImpl* platformColourInstance() { - return isatty(STDOUT_FILENO) + Ptr config = getCurrentContext().getConfig(); + return (config && config->forceColour()) || isatty(STDOUT_FILENO) ? PosixColourImpl::instance() : NoColourImpl::instance(); } diff --git a/include/internal/catch_interfaces_config.h b/include/internal/catch_interfaces_config.h index 5f30ac1d..1281bd7e 100644 --- a/include/internal/catch_interfaces_config.h +++ b/include/internal/catch_interfaces_config.h @@ -56,6 +56,7 @@ namespace Catch { virtual TestSpec const& testSpec() const = 0; virtual RunTests::InWhatOrder runOrder() const = 0; virtual unsigned int rngSeed() const = 0; + virtual bool forceColour() const = 0; }; } diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index 4b60a4f5..7cb7ca42 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -182,7 +182,23 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" CHECK( config.shouldDebugBreak ); CHECK( config.noThrow == true ); } - } + } + + SECTION( "force-colour", "") { + SECTION( "--force-colour", "" ) { + const char* argv[] = { "test", "--force-colour" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.forceColour ); + } + + SECTION( "without --force-colour", "" ) { + const char* argv[] = { "test" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( !config.forceColour ); + } + } } From 5eb7748a55a88a99223c7059f2a7ff0377d917e6 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 4 Mar 2015 07:08:53 +0000 Subject: [PATCH 095/102] Changed relative #includes and made SourceLineInfo sortable (added < op) --- include/internal/catch_capture.hpp | 2 +- include/internal/catch_common.h | 1 + include/internal/catch_common.hpp | 3 +++ include/internal/catch_context_impl.hpp | 2 +- include/internal/catch_impl.hpp | 2 +- include/internal/catch_objc.hpp | 2 +- include/internal/catch_test_registry.hpp | 2 +- 7 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 39e5fc87..58591265 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -15,7 +15,7 @@ #include "catch_common.h" #include "catch_tostring.h" #include "catch_interfaces_runner.h" -#include "internal/catch_compiler_capabilities.h" +#include "catch_compiler_capabilities.h" /////////////////////////////////////////////////////////////////////////////// diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h index 68d23688..aadb0d34 100644 --- a/include/internal/catch_common.h +++ b/include/internal/catch_common.h @@ -94,6 +94,7 @@ namespace Catch { # endif bool empty() const; bool operator == ( SourceLineInfo const& other ) const; + bool operator < ( SourceLineInfo const& other ) const; std::string file; std::size_t line; diff --git a/include/internal/catch_common.hpp b/include/internal/catch_common.hpp index 29e9ed5a..8a42d0a0 100644 --- a/include/internal/catch_common.hpp +++ b/include/internal/catch_common.hpp @@ -78,6 +78,9 @@ namespace Catch { bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const { return line == other.line && file == other.file; } + bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const { + return line < other.line || ( line == other.line && file < other.file ); + } std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { #ifndef __GNUG__ diff --git a/include/internal/catch_context_impl.hpp b/include/internal/catch_context_impl.hpp index 19534de0..a495503c 100644 --- a/include/internal/catch_context_impl.hpp +++ b/include/internal/catch_context_impl.hpp @@ -60,7 +60,7 @@ namespace Catch { std::string testName = getResultCapture()->getCurrentTestName(); std::map::const_iterator it = - m_generatorsByTestName.find( testName ); + m_generatorsByTestName.find( testName ); return it != m_generatorsByTestName.end() ? it->second : NULL; diff --git a/include/internal/catch_impl.hpp b/include/internal/catch_impl.hpp index 820b4975..24a8c3f8 100644 --- a/include/internal/catch_impl.hpp +++ b/include/internal/catch_impl.hpp @@ -16,7 +16,7 @@ #pragma clang diagnostic ignored "-Wweak-vtables" #endif -#include "catch_runner.hpp" +#include "../catch_runner.hpp" #include "catch_registry_hub.hpp" #include "catch_notimplemented_exception.hpp" #include "catch_context_impl.hpp" diff --git a/include/internal/catch_objc.hpp b/include/internal/catch_objc.hpp index 88b5ef78..7e315c22 100644 --- a/include/internal/catch_objc.hpp +++ b/include/internal/catch_objc.hpp @@ -17,7 +17,7 @@ // 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 -#include "internal/catch_test_case_info.h" +#include "catch_test_case_info.h" /////////////////////////////////////////////////////////////////////////////// // This protocol is really only here for (self) documenting purposes, since diff --git a/include/internal/catch_test_registry.hpp b/include/internal/catch_test_registry.hpp index 73de60b4..d12411d4 100644 --- a/include/internal/catch_test_registry.hpp +++ b/include/internal/catch_test_registry.hpp @@ -10,7 +10,7 @@ #include "catch_common.h" #include "catch_interfaces_testcase.h" -#include "internal/catch_compiler_capabilities.h" +#include "catch_compiler_capabilities.h" namespace Catch { From e04ba5c9f684389ecd268d6dac05b194af27899e Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 4 Mar 2015 07:47:43 +0000 Subject: [PATCH 096/102] Removed over-eager assertion. Doesn't hold if reporting due to a segfault #377 --- include/reporters/catch_reporter_bases.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp index e5684b32..865dc29e 100644 --- a/include/reporters/catch_reporter_bases.hpp +++ b/include/reporters/catch_reporter_bases.hpp @@ -44,7 +44,6 @@ namespace Catch { } virtual void testCaseEnded( TestCaseStats const& /* _testCaseStats */ ) { currentTestCaseInfo.reset(); - assert( m_sectionStack.empty() ); } virtual void testGroupEnded( TestGroupStats const& /* _testGroupStats */ ) { currentGroupInfo.reset(); From ce0b170dc2f93ea88da76489c5272ef100411e82 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 4 Mar 2015 07:54:35 +0000 Subject: [PATCH 097/102] Suppress warnings correctly for Intel compiler #376 --- include/internal/catch_reenable_warnings.h | 8 ++++-- include/internal/catch_suppress_warnings.h | 29 +++++++++++++--------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/include/internal/catch_reenable_warnings.h b/include/internal/catch_reenable_warnings.h index 07765f4b..33574e05 100644 --- a/include/internal/catch_reenable_warnings.h +++ b/include/internal/catch_reenable_warnings.h @@ -9,9 +9,13 @@ #define TWOBLUECUBES_CATCH_REENABLE_WARNINGS_H_INCLUDED #ifdef __clang__ -#pragma clang diagnostic pop +# ifdef __ICC // icpc defines the __clang__ macro +# pragma warning(pop) +# else +# pragma clang diagnostic pop +# endif #elif defined __GNUC__ -#pragma GCC diagnostic pop +# pragma GCC diagnostic pop #endif #endif // TWOBLUECUBES_CATCH_REENABLE_WARNINGS_H_INCLUDED diff --git a/include/internal/catch_suppress_warnings.h b/include/internal/catch_suppress_warnings.h index cc36c073..7351f63b 100644 --- a/include/internal/catch_suppress_warnings.h +++ b/include/internal/catch_suppress_warnings.h @@ -9,19 +9,24 @@ #define TWOBLUECUBES_CATCH_SUPPRESS_WARNINGS_H_INCLUDED #ifdef __clang__ -#pragma clang diagnostic ignored "-Wglobal-constructors" -#pragma clang diagnostic ignored "-Wvariadic-macros" -#pragma clang diagnostic ignored "-Wc99-extensions" -#pragma clang diagnostic ignored "-Wunused-variable" -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#pragma clang diagnostic ignored "-Wc++98-compat" -#pragma clang diagnostic ignored "-Wc++98-compat-pedantic" +# ifdef __ICC // icpc defines the __clang__ macro +# pragma warning(push) +# pragma warning(disable: 161 1682) +# else // __ICC +# pragma clang diagnostic ignored "-Wglobal-constructors" +# pragma clang diagnostic ignored "-Wvariadic-macros" +# pragma clang diagnostic ignored "-Wc99-extensions" +# pragma clang diagnostic ignored "-Wunused-variable" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +# pragma clang diagnostic ignored "-Wc++98-compat" +# pragma clang diagnostic ignored "-Wc++98-compat-pedantic" +# endif #elif defined __GNUC__ -#pragma GCC diagnostic ignored "-Wvariadic-macros" -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpadded" +# pragma GCC diagnostic ignored "-Wvariadic-macros" +# pragma GCC diagnostic ignored "-Wunused-variable" +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpadded" #endif #endif // TWOBLUECUBES_CATCH_SUPPRESS_WARNINGS_H_INCLUDED From 856468c8c41bf473c844dc9df78f149995c96c36 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 4 Mar 2015 08:22:32 +0000 Subject: [PATCH 098/102] Rebased to include new --force-colour tests --- .../Baselines/console.std.approved.txt | 2 +- .../Baselines/console.sw.approved.txt | 38 ++++++++++++++- .../SelfTest/Baselines/junit.sw.approved.txt | 4 +- .../SelfTest/Baselines/xml.sw.approved.txt | 48 ++++++++++++++++++- 4 files changed, 87 insertions(+), 5 deletions(-) diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 5b5639a5..16b9b0a7 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -787,5 +787,5 @@ with expansion: =============================================================================== test cases: 155 | 116 passed | 38 failed | 1 failed as expected -assertions: 761 | 669 passed | 79 failed | 13 failed as expected +assertions: 765 | 673 passed | 79 failed | 13 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index fbacd9a8..e254c3c3 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -4065,6 +4065,42 @@ PASSED: with expansion: true == true +------------------------------------------------------------------------------- +Process can be configured on command line + force-colour + --force-colour +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( config.forceColour ) +with expansion: + true + +------------------------------------------------------------------------------- +Process can be configured on command line + force-colour + without --force-colour +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( !config.forceColour ) +with expansion: + true + ------------------------------------------------------------------------------- Long strings can be wrapped plain string @@ -7907,5 +7943,5 @@ with expansion: =============================================================================== test cases: 155 | 100 passed | 54 failed | 1 failed as expected -assertions: 781 | 669 passed | 99 failed | 13 failed as expected +assertions: 785 | 673 passed | 99 failed | 13 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 2da1e452..48b84679 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,5 +1,5 @@ - + @@ -473,6 +473,8 @@ MiscTests.cpp: + + diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 6f30c63f..4d14a677 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -4214,6 +4214,50 @@
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + config.forceColour + + + true + + + +
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + !config.forceColour + + + true + + + +
+ +
@@ -8174,7 +8218,7 @@ there"
- + - + From a806c3e700e7b3cd5fae9a0f9bfecb19259e8fd3 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 4 Mar 2015 08:23:40 +0000 Subject: [PATCH 099/102] Build 14 --- README.md | 2 +- include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 63 ++++++++++++++++++++---------- 3 files changed, 44 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 73c3fa9d..c81a4fe4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![catch logo](catch-logo-small.png) -*v1.1 build 13 (develop branch)* +*v1.1 build 14 (develop branch)* Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index 3929e0c4..9507b38a 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -13,7 +13,7 @@ namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 13, "develop" ); + Version libraryVersion( 1, 1, 14, "develop" ); } #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED diff --git a/single_include/catch.hpp b/single_include/catch.hpp index bd377f92..d5bf7d49 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * CATCH v1.1 build 13 (develop branch) - * Generated: 2014-12-30 18:47:08.984634 + * CATCH v1.1 build 14 (develop branch) + * Generated: 2015-03-04 08:22:47.319013 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -18,19 +18,24 @@ #define TWOBLUECUBES_CATCH_SUPPRESS_WARNINGS_H_INCLUDED #ifdef __clang__ -#pragma clang diagnostic ignored "-Wglobal-constructors" -#pragma clang diagnostic ignored "-Wvariadic-macros" -#pragma clang diagnostic ignored "-Wc99-extensions" -#pragma clang diagnostic ignored "-Wunused-variable" -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#pragma clang diagnostic ignored "-Wc++98-compat" -#pragma clang diagnostic ignored "-Wc++98-compat-pedantic" +# ifdef __ICC // icpc defines the __clang__ macro +# pragma warning(push) +# pragma warning(disable: 161 1682) +# else // __ICC +# pragma clang diagnostic ignored "-Wglobal-constructors" +# pragma clang diagnostic ignored "-Wvariadic-macros" +# pragma clang diagnostic ignored "-Wc99-extensions" +# pragma clang diagnostic ignored "-Wunused-variable" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +# pragma clang diagnostic ignored "-Wc++98-compat" +# pragma clang diagnostic ignored "-Wc++98-compat-pedantic" +# endif #elif defined __GNUC__ -#pragma GCC diagnostic ignored "-Wvariadic-macros" -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpadded" +# pragma GCC diagnostic ignored "-Wvariadic-macros" +# pragma GCC diagnostic ignored "-Wunused-variable" +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpadded" #endif #if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) @@ -250,6 +255,7 @@ namespace Catch { # endif bool empty() const; bool operator == ( SourceLineInfo const& other ) const; + bool operator < ( SourceLineInfo const& other ) const; std::string file; std::size_t line; @@ -2800,7 +2806,7 @@ return @ desc; \ #pragma clang diagnostic ignored "-Wweak-vtables" #endif -// #included from: catch_runner.hpp +// #included from: ../catch_runner.hpp #define TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED // #included from: internal/catch_commandline.hpp @@ -3080,6 +3086,7 @@ namespace Catch { virtual TestSpec const& testSpec() const = 0; virtual RunTests::InWhatOrder runOrder() const = 0; virtual unsigned int rngSeed() const = 0; + virtual bool forceColour() const = 0; }; } @@ -3134,6 +3141,7 @@ namespace Catch { noThrow( false ), showHelp( false ), showInvisibles( false ), + forceColour( false ), abortAfter( -1 ), rngSeed( 0 ), verbosity( Verbosity::Normal ), @@ -3152,6 +3160,7 @@ namespace Catch { bool noThrow; bool showHelp; bool showInvisibles; + bool forceColour; int abortAfter; unsigned int rngSeed; @@ -3243,6 +3252,7 @@ namespace Catch { virtual ShowDurations::OrNot showDurations() const { return m_data.showDurations; } virtual RunTests::InWhatOrder runOrder() const { return m_data.runOrder; } virtual unsigned int rngSeed() const { return m_data.rngSeed; } + virtual bool forceColour() const { return m_data.forceColour; } private: ConfigData m_data; @@ -4280,6 +4290,10 @@ namespace Catch { .describe( "set a specific seed for random numbers" ) .bind( &setRngSeed, "'time'|number" ); + cli["--force-colour"] + .describe( "force colourised output" ) + .bind( &ConfigData::forceColour ); + return cli; } @@ -6179,7 +6193,7 @@ namespace Catch { std::string testName = getResultCapture()->getCurrentTestName(); std::map::const_iterator it = - m_generatorsByTestName.find( testName ); + m_generatorsByTestName.find( testName ); return it != m_generatorsByTestName.end() ? it->second : NULL; @@ -6363,7 +6377,8 @@ namespace { }; IColourImpl* platformColourInstance() { - return isatty(STDOUT_FILENO) + Ptr config = getCurrentContext().getConfig(); + return (config && config->forceColour()) || isatty(STDOUT_FILENO) ? PosixColourImpl::instance() : NoColourImpl::instance(); } @@ -6736,7 +6751,7 @@ namespace Catch { namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 1, 13, "develop" ); + Version libraryVersion( 1, 1, 14, "develop" ); } // #included from: catch_message.hpp @@ -7023,6 +7038,9 @@ namespace Catch { bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const { return line == other.line && file == other.file; } + bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const { + return line < other.line || ( line == other.line && file < other.file ); + } std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { #ifndef __GNUG__ @@ -7583,7 +7601,6 @@ namespace Catch { } virtual void testCaseEnded( TestCaseStats const& /* _testCaseStats */ ) { currentTestCaseInfo.reset(); - assert( m_sectionStack.empty() ); } virtual void testGroupEnded( TestGroupStats const& /* _testGroupStats */ ) { currentGroupInfo.reset(); @@ -9397,9 +9414,13 @@ using Catch::Detail::Approx; #define TWOBLUECUBES_CATCH_REENABLE_WARNINGS_H_INCLUDED #ifdef __clang__ -#pragma clang diagnostic pop +# ifdef __ICC // icpc defines the __clang__ macro +# pragma warning(pop) +# else +# pragma clang diagnostic pop +# endif #elif defined __GNUC__ -#pragma GCC diagnostic pop +# pragma GCC diagnostic pop #endif #endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED From 572911d8802f988992bb7075c09da724d23718fe Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 4 Mar 2015 18:33:31 +0000 Subject: [PATCH 100/102] Changed comment to work around header stitching bug --- include/internal/catch_tostring.h | 5 ++--- single_include/catch.hpp | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/internal/catch_tostring.h b/include/internal/catch_tostring.h index 6265cf20..8e6e1581 100644 --- a/include/internal/catch_tostring.h +++ b/include/internal/catch_tostring.h @@ -202,9 +202,8 @@ std::string toString( std::vector const& v ) { #ifdef CATCH_CPP11_OR_GREATER - /* - toString for tuples - */ + +// toString for tuples namespace TupleDetail { template< typename Tuple, diff --git a/single_include/catch.hpp b/single_include/catch.hpp index d5bf7d49..29647904 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* * CATCH v1.1 build 14 (develop branch) - * Generated: 2015-03-04 08:22:47.319013 + * Generated: 2015-03-04 18:32:24.627737 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -1234,8 +1234,8 @@ std::string toString( std::vector const& v ) { } #ifdef CATCH_CPP11_OR_GREATER - toString for tuples - */ + +// toString for tuples namespace TupleDetail { template< typename Tuple, From 090c74c420d429eda2474bc8e794b4274b7aae9c Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 4 Mar 2015 19:00:29 +0000 Subject: [PATCH 101/102] Use reinterpret_cast to eliminate some warnings #369 --- include/internal/catch_timer.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/internal/catch_timer.hpp b/include/internal/catch_timer.hpp index 988382b3..47d9536b 100644 --- a/include/internal/catch_timer.hpp +++ b/include/internal/catch_timer.hpp @@ -27,11 +27,11 @@ namespace Catch { uint64_t getCurrentTicks() { static uint64_t hz=0, hzo=0; if (!hz) { - QueryPerformanceFrequency((LARGE_INTEGER*)&hz); - QueryPerformanceCounter((LARGE_INTEGER*)&hzo); + QueryPerformanceFrequency( reinterpret_cast( &hz ) ); + QueryPerformanceCounter( reinterpret_cast( &hzo ) ); } uint64_t t; - QueryPerformanceCounter((LARGE_INTEGER*)&t); + QueryPerformanceCounter( reinterpret_cast( &t ) ); return ((t-hzo)*1000000)/hz; } #else From 0ae7578028fe30135015ace15a97009a547f2d46 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 4 Mar 2015 19:01:25 +0000 Subject: [PATCH 102/102] Restored tag parsing when checking for reserved tags - had been accidentally deleted in an earlier refactoring. A bit worrying that this didn't get spotted sooner! --- include/internal/catch_test_case_info.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/internal/catch_test_case_info.hpp b/include/internal/catch_test_case_info.hpp index 67f32b6e..308ddc74 100644 --- a/include/internal/catch_test_case_info.hpp +++ b/include/internal/catch_test_case_info.hpp @@ -30,7 +30,7 @@ namespace Catch { return TestCaseInfo::None; } inline bool isReservedTag( std::string const& tag ) { - return TestCaseInfo::None && tag.size() > 0 && !isalnum( tag[0] ); + return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !isalnum( tag[0] ); } inline void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) { if( isReservedTag( tag ) ) {