diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp index 52ba1f69..b9617932 100644 --- a/include/internal/catch_commandline.hpp +++ b/include/internal/catch_commandline.hpp @@ -24,15 +24,21 @@ namespace Catch { inline void addWarning( ConfigData& config, std::string const& _warning ) { if( _warning == "NoAssertions" ) - config.warnings = (ConfigData::WarnAbout::What)( config.warnings | ConfigData::WarnAbout::NoAssertions ); + config.warnings = (WarnAbout::What)( config.warnings | WarnAbout::NoAssertions ); else throw std::runtime_error( "Unrecognised warning: '" + _warning + "'" ); } inline void setVerbosity( ConfigData& config, int level ) { // !TBD: accept strings? - config.verbosity = (ConfigData::Verbosity::Level)level; + config.verbosity = (Verbosity::Level)level; } + inline void setShowDurations( ConfigData& config, bool _showDurations ) { + config.showDurations = _showDurations + ? ShowDurations::Always + : ShowDurations::Never; + } + inline Clara::CommandLine makeCommandLineParser() { @@ -121,6 +127,12 @@ namespace Catch { .describe( "which test or tests to use" ) .argName( "test name, pattern or tags" ); + cli.bind( &setShowDurations ) + .describe( "show test durations" ) + .shortOpt( "d") + .longOpt( "durations" ) + .argName( "durations" ); + return cli; } diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp index 6ed857fc..f561b260 100644 --- a/include/internal/catch_config.hpp +++ b/include/internal/catch_config.hpp @@ -26,17 +26,6 @@ namespace Catch { struct ConfigData { - struct Verbosity { enum Level { - NoOutput = 0, - Quiet, - Normal - }; }; - - struct WarnAbout { enum What { - Nothing = 0x00, - NoAssertions = 0x01 - }; }; - ConfigData() : listTests( false ), listTags( false ), @@ -47,7 +36,8 @@ namespace Catch { showHelp( false ), abortAfter( -1 ), verbosity( Verbosity::Normal ), - warnings( WarnAbout::Nothing ) + warnings( WarnAbout::Nothing ), + showDurations( ShowDurations::DefaultForReporter ) {} bool listTests; @@ -63,6 +53,7 @@ namespace Catch { Verbosity::Level verbosity; WarnAbout::What warnings; + ShowDurations::OrNot showDurations; std::string reporterName; std::string outputFilename; @@ -166,7 +157,9 @@ namespace Catch { virtual std::ostream& stream() const { return m_os; } virtual std::string name() const { return m_data.name.empty() ? m_data.processName : m_data.name; } virtual bool includeSuccessfulResults() const { return m_data.showSuccessfulTests; } - virtual bool warnAboutMissingAssertions() const { return m_data.warnings & ConfigData::WarnAbout::NoAssertions; } + virtual bool warnAboutMissingAssertions() const { return m_data.warnings & WarnAbout::NoAssertions; } + virtual ShowDurations::OrNot showDurations() const { return m_data.showDurations; } + private: ConfigData m_data; diff --git a/include/internal/catch_impl.hpp b/include/internal/catch_impl.hpp index 57f1f252..c4959026 100644 --- a/include/internal/catch_impl.hpp +++ b/include/internal/catch_impl.hpp @@ -30,6 +30,7 @@ #include "catch_text.hpp" #include "catch_message.hpp" #include "catch_legacy_reporter_adapter.hpp" +#include "catch_timer.hpp" #include "../reporters/catch_reporter_basic.hpp" #include "../reporters/catch_reporter_xml.hpp" @@ -57,7 +58,6 @@ namespace Catch { TestCaseStats::~TestCaseStats() {} TestGroupStats::~TestGroupStats() {} TestRunStats::~TestRunStats() {} - ThreadedSectionInfo::~ThreadedSectionInfo() {} TestGroupNode::~TestGroupNode() {} TestRunNode::~TestRunNode() {} diff --git a/include/internal/catch_interfaces_capture.h b/include/internal/catch_interfaces_capture.h index 029a4321..2601ab46 100644 --- a/include/internal/catch_interfaces_capture.h +++ b/include/internal/catch_interfaces_capture.h @@ -30,7 +30,7 @@ namespace Catch { virtual void assertionEnded( AssertionResult const& result ) = 0; virtual bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) = 0; - virtual void sectionEnded( SectionInfo const& name, Counts const& assertions ) = 0; + virtual void sectionEnded( SectionInfo const& name, Counts const& assertions, double _durationInSeconds ) = 0; virtual void pushScopedMessage( MessageInfo const& message ) = 0; virtual void popScopedMessage( MessageInfo const& message ) = 0; diff --git a/include/internal/catch_interfaces_config.h b/include/internal/catch_interfaces_config.h index 06786f81..79cfa97b 100644 --- a/include/internal/catch_interfaces_config.h +++ b/include/internal/catch_interfaces_config.h @@ -15,6 +15,23 @@ namespace Catch { + struct Verbosity { enum Level { + NoOutput = 0, + Quiet, + Normal + }; }; + + struct WarnAbout { enum What { + Nothing = 0x00, + NoAssertions = 0x01 + }; }; + + struct ShowDurations { enum OrNot { + DefaultForReporter, + Always, + Never + }; }; + struct IConfig : IShared { virtual ~IConfig(); @@ -26,6 +43,7 @@ namespace Catch { virtual bool shouldDebugBreak() const = 0; virtual bool warnAboutMissingAssertions() const = 0; virtual int abortAfter() const = 0; + virtual ShowDurations::OrNot showDurations() const = 0; }; } diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h index 17a1c3d4..057eef94 100644 --- a/include/internal/catch_interfaces_reporter.h +++ b/include/internal/catch_interfaces_reporter.h @@ -46,6 +46,20 @@ namespace Catch bool shouldRedirectStdOut; }; + + template + struct Node : SharedImpl<> { + Node( T const& _value, Node* _parent = NULL ) + : value( _value ), + parent( _parent ) + {} + virtual ~Node() {} + + T value; + std::vector > children; + Node* parent; + }; + struct TestRunInfo { TestRunInfo( std::string const& _name ) : name( _name ) {} std::string name; @@ -78,17 +92,6 @@ namespace Catch SourceLineInfo lineInfo; }; - struct ThreadedSectionInfo : SectionInfo, SharedImpl<> { - ThreadedSectionInfo( SectionInfo const& _sectionInfo, ThreadedSectionInfo* _parent = NULL ) - : SectionInfo( _sectionInfo ), - parent( _parent ) - {} - virtual ~ThreadedSectionInfo(); - - std::vector > children; - ThreadedSectionInfo* parent; - }; - struct AssertionStats { AssertionStats( AssertionResult const& _assertionResult, std::vector const& _infoMessages, @@ -117,15 +120,18 @@ namespace Catch struct SectionStats { SectionStats( SectionInfo const& _sectionInfo, Counts const& _assertions, + double _durationInSeconds, bool _missingAssertions ) : sectionInfo( _sectionInfo ), assertions( _assertions ), + durationInSeconds( _durationInSeconds ), missingAssertions( _missingAssertions ) {} virtual ~SectionStats(); SectionInfo sectionInfo; Counts assertions; + double durationInSeconds; bool missingAssertions; }; @@ -189,6 +195,7 @@ namespace Catch bool aborting; }; + struct IStreamingReporter : IShared { virtual ~IStreamingReporter(); @@ -236,7 +243,7 @@ namespace Catch unusedTestCaseInfo = _testInfo; } virtual void sectionStarting( SectionInfo const& _sectionInfo ) { - Ptr sectionInfo = new ThreadedSectionInfo( _sectionInfo ); + Ptr > sectionInfo = new Node( _sectionInfo ); if( !currentSectionInfo ) { currentSectionInfo = sectionInfo; m_rootSections.push_back( currentSectionInfo ); @@ -268,11 +275,11 @@ namespace Catch Option testRunInfo; Option unusedGroupInfo; Option unusedTestCaseInfo; - Ptr currentSectionInfo; + Ptr > currentSectionInfo; std::ostream& stream; // !TBD: This should really go in the TestCaseStats class - std::vector > m_rootSections; + std::vector > > m_rootSections; }; struct TestGroupNode : TestGroupStats { diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp index 7f763ab5..4b34f1e9 100644 --- a/include/internal/catch_runner_impl.hpp +++ b/include/internal/catch_runner_impl.hpp @@ -18,6 +18,7 @@ #include "catch_totals.hpp" #include "catch_test_spec.h" #include "catch_test_case_tracker.hpp" +#include "catch_timer.h" #include #include @@ -194,9 +195,9 @@ namespace Catch { return true; } - virtual void sectionEnded( SectionInfo const& info, Counts const& prevAssertions ) { + virtual void sectionEnded( SectionInfo const& info, Counts const& prevAssertions, double _durationInSeconds ) { if( std::uncaught_exception() ) { - m_unfinishedSections.push_back( UnfinishedSections( info, prevAssertions ) ); + m_unfinishedSections.push_back( UnfinishedSections( info, prevAssertions, _durationInSeconds ) ); return; } @@ -205,7 +206,7 @@ namespace Catch { m_testCaseTracker->leaveSection(); - m_reporter->sectionEnded( SectionStats( info, assertions, missingAssertions ) ); + m_reporter->sectionEnded( SectionStats( info, assertions, _durationInSeconds, missingAssertions ) ); m_messages.clear(); } @@ -260,10 +261,13 @@ namespace Catch { SectionInfo testCaseSection( testCaseInfo.name, testCaseInfo.description, testCaseInfo.lineInfo ); m_reporter->sectionStarting( testCaseSection ); Counts prevAssertions = m_totals.assertions; + double duration = 0; try { m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal ); TestCaseTracker::Guard guard( *m_testCaseTracker ); + Timer timer; + timer.start(); if( m_reporter->getPreferences().shouldRedirectStdOut ) { StreamRedirect coutRedir( std::cout, redirectedCout ); StreamRedirect cerrRedir( std::cerr, redirectedCerr ); @@ -272,6 +276,7 @@ namespace Catch { else { m_activeTestCase->invoke(); } + duration = timer.getElapsedSeconds(); } catch( TestFailureException& ) { // This just means the test was aborted due to failure @@ -287,25 +292,26 @@ namespace Catch { itEnd = m_unfinishedSections.end(); it != itEnd; ++it ) - sectionEnded( it->info, it->prevAssertions ); + sectionEnded( it->info, it->prevAssertions, it->durationInSeconds ); m_unfinishedSections.clear(); m_messages.clear(); Counts assertions = m_totals.assertions - prevAssertions; bool missingAssertions = testForMissingAssertions( assertions ); - SectionStats testCaseSectionStats( testCaseSection, assertions, missingAssertions ); + SectionStats testCaseSectionStats( testCaseSection, assertions, duration, missingAssertions ); m_reporter->sectionEnded( testCaseSectionStats ); } private: struct UnfinishedSections { - UnfinishedSections( SectionInfo const& _info, Counts const& _prevAssertions ) - : info( _info ), prevAssertions( _prevAssertions ) + UnfinishedSections( SectionInfo const& _info, Counts const& _prevAssertions, double _durationInSeconds ) + : info( _info ), prevAssertions( _prevAssertions ), durationInSeconds( _durationInSeconds ) {} SectionInfo info; Counts prevAssertions; + double durationInSeconds; }; TestRunInfo m_runInfo; diff --git a/include/internal/catch_section.hpp b/include/internal/catch_section.hpp index ddf7a1a2..e58e72a8 100644 --- a/include/internal/catch_section.hpp +++ b/include/internal/catch_section.hpp @@ -11,6 +11,7 @@ #include "catch_capture.hpp" #include "catch_totals.hpp" #include "catch_compiler_capabilities.h" +#include "catch_timer.h" #include @@ -23,11 +24,13 @@ namespace Catch { std::string const& description = "" ) : m_info( name, description, lineInfo ), m_sectionIncluded( getCurrentContext().getResultCapture().sectionStarted( m_info, m_assertions ) ) - {} + { + m_timer.start(); + } ~Section() { if( m_sectionIncluded ) - getCurrentContext().getResultCapture().sectionEnded( m_info, m_assertions ); + getCurrentContext().getResultCapture().sectionEnded( m_info, m_assertions, m_timer.getElapsedSeconds() ); } // This indicates whether the section should be executed or not @@ -41,6 +44,7 @@ namespace Catch { std::string m_name; Counts m_assertions; bool m_sectionIncluded; + Timer m_timer; }; } // end namespace Catch diff --git a/include/internal/catch_timer.h b/include/internal/catch_timer.h new file mode 100644 index 00000000..ad24883f --- /dev/null +++ b/include/internal/catch_timer.h @@ -0,0 +1,33 @@ +/* + * Created by Phil on 05/08/2013. + * Copyright 2013 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_TIMER_H_INCLUDED +#define TWOBLUECUBES_CATCH_TIMER_H_INCLUDED + +#ifdef WIN32 +typedef unsigned long long uint64_t; +#else +#include +#endif + +namespace Catch { + + class Timer { + public: + Timer() : m_ticks( 0 ) {} + void start(); + unsigned int getElapsedNanoseconds() const; + unsigned int getElapsedMilliseconds() const; + double getElapsedSeconds() const; + + private: + uint64_t m_ticks; + }; + +} // namespace Catch + +#endif // TWOBLUECUBES_CATCH_TIMER_H_INCLUDED diff --git a/include/internal/catch_timer.hpp b/include/internal/catch_timer.hpp new file mode 100644 index 00000000..6abbf3a6 --- /dev/null +++ b/include/internal/catch_timer.hpp @@ -0,0 +1,62 @@ +/* + * Created by Phil on 05/08/2013. + * Copyright 2013 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) + */ + +#include "catch_timer.h" + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wc++11-long-long" +#endif + +#ifdef WIN32 +#include +#else +#include +#endif + +namespace Catch { + + namespace { +#ifdef WIN32 + uint64_t getCurrentTicks() { + static uint64_t hz=0, hzo=0; + if (!hz) { + QueryPerformanceFrequency((LARGE_INTEGER*)&hz); + QueryPerformanceCounter((LARGE_INTEGER*)&hzo); + } + uint64_t t; + QueryPerformanceCounter((LARGE_INTEGER*)&t); + return ((t-hzo)*1000000)/hz; + } +#else + uint64_t getCurrentTicks() { + timeval t; + gettimeofday(&t,NULL); + return (uint64_t)t.tv_sec * 1000000ull + (uint64_t)t.tv_usec; + } +#endif + } + + void Timer::start() { + m_ticks = getCurrentTicks(); + } + unsigned int Timer::getElapsedNanoseconds() const { + return (unsigned int)(getCurrentTicks() - m_ticks); + } + unsigned int Timer::getElapsedMilliseconds() const { + return (unsigned int)((getCurrentTicks() - m_ticks)/1000); + } + double Timer::getElapsedSeconds() const { + return (getCurrentTicks() - m_ticks)/1000000.0; + } + +} // namespace Catch + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp index af596078..d750f3e4 100644 --- a/include/reporters/catch_reporter_console.hpp +++ b/include/reporters/catch_reporter_console.hpp @@ -69,6 +69,8 @@ namespace Catch { stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl; } m_headerPrinted = false; + if( m_config->showDurations() == ShowDurations::Always ) + stream << "Completed in " << _sectionStats.durationInSeconds << "s" << std::endl; StreamingReporterBase::sectionEnded( _sectionStats ); } @@ -263,20 +265,20 @@ namespace Catch { assert( currentSectionInfo ); if( currentSectionInfo ) { Colour colourGuard( Colour::Headers ); - std::vector sections; - for( ThreadedSectionInfo* section = currentSectionInfo.get(); + std::vector*> sections; + for( Node* section = currentSectionInfo.get(); section; section = section->parent ) sections.push_back( section ); // Sections - std::vector::const_reverse_iterator + std::vector*>::const_reverse_iterator it = sections.rbegin(), itEnd = sections.rend(); for( ++it; it != itEnd; ++it ) // Skip first section (test case) - printHeaderString( (*it)->name, 2 ); + printHeaderString( (*it)->value.name, 2 ); } SourceLineInfo lineInfo = currentSectionInfo - ? currentSectionInfo->lineInfo + ? currentSectionInfo->value.lineInfo : unusedTestCaseInfo->lineInfo; if( !lineInfo.empty() ){ diff --git a/include/reporters/catch_reporter_junit.hpp b/include/reporters/catch_reporter_junit.hpp index ecb46c99..f91498aa 100644 --- a/include/reporters/catch_reporter_junit.hpp +++ b/include/reporters/catch_reporter_junit.hpp @@ -82,7 +82,7 @@ namespace Catch { return true; } - virtual void StartTesting(){} + virtual void StartTesting() {} virtual void StartGroup( const std::string& groupName ) { if( groupName.empty() ) @@ -189,7 +189,10 @@ namespace Catch { xml.writeAttribute( "failures", it->m_failuresCount ); xml.writeAttribute( "tests", it->m_testsCount ); xml.writeAttribute( "hostname", "tbd" ); - xml.writeAttribute( "time", "tbd" ); + if( m_config.fullConfig()->showDurations() == ShowDurations::Never ) + xml.writeAttribute( "time", it->m_timeInSeconds ); + else + xml.writeAttribute( "time", "" ); xml.writeAttribute( "timestamp", "tbd" ); OutputTestCases( xml, *it ); @@ -207,7 +210,10 @@ namespace Catch { XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); xml.writeAttribute( "classname", it->m_className ); xml.writeAttribute( "name", it->m_name ); - xml.writeAttribute( "time", "tbd" ); + if( m_config.fullConfig()->showDurations() == ShowDurations::Never ) + xml.writeAttribute( "time", "" ); + else + xml.writeAttribute( "time", stats.m_timeInSeconds ); OutputTestResult( xml, *it ); diff --git a/projects/SelfTest/Baselines/approvedResults.txt b/projects/SelfTest/Baselines/approvedResults.txt index a1b3bd99..280a04e6 100644 --- a/projects/SelfTest/Baselines/approvedResults.txt +++ b/projects/SelfTest/Baselines/approvedResults.txt @@ -670,6 +670,8 @@ MiscTests.cpp: FAILED: explicitly with message: to infinity and beyond +starting... +finished in 0.322593 Message from section one Message from section two Some information @@ -708,7 +710,7 @@ with expansion: "first" == "second" =============================================================================== -121 test cases - 35 failed (737 assertions - 90 failed) +122 test cases - 35 failed (738 assertions - 90 failed) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -4316,6 +4318,19 @@ MiscTests.cpp: FAILED: explicitly with message: to infinity and beyond +starting... +finished in 0.323247 +------------------------------------------------------------------------------- +Timer +------------------------------------------------------------------------------- +MiscTests.cpp +............................................................................... + +MiscTests.cpp: +PASSED: +with message: + yay + ------------------------------------------------------------------------------- selftest/main selftest/expected result @@ -7169,34 +7184,34 @@ with expansion: true =============================================================================== -121 test cases - 50 failed (756 assertions - 109 failed) +122 test cases - 50 failed (757 assertions - 109 failed) No test cases matched '~dummy 4' No tests ran - - - - - - - - - - + + + + + + + + + + ClassTests.cpp - - + + ClassTests.cpp - - + + ConditionTests.cpp @@ -7237,8 +7252,8 @@ ConditionTests.cpp ConditionTests.cpp - - + + ConditionTests.cpp @@ -7255,8 +7270,8 @@ ConditionTests.cpp ConditionTests.cpp - - + + ConditionTests.cpp @@ -7315,14 +7330,14 @@ ConditionTests.cpp ConditionTests.cpp - - - - - - - - + + + + + + + + ConditionTests.cpp @@ -7348,8 +7363,8 @@ ConditionTests.cpp ConditionTests.cpp - - + + ExceptionTests.cpp @@ -7360,51 +7375,51 @@ ExceptionTests.cpp ExceptionTests.cpp - + ExceptionTests.cpp - + ExceptionTests.cpp - + ExceptionTests.cpp - + ExceptionTests.cpp - - + + ExceptionTests.cpp - + ExceptionTests.cpp - + ExceptionTests.cpp - + ExceptionTests.cpp - - - - + + + + MessageTests.cpp @@ -7412,8 +7427,8 @@ MessageTests.cpp MessageTests.cpp - - + + MessageTests.cpp @@ -7424,7 +7439,7 @@ MessageTests.cpp MessageTests.cpp - + MessageTests.cpp @@ -7438,12 +7453,12 @@ MessageTests.cpp MessageTests.cpp - + MessageTests.cpp - + MessageTests.cpp @@ -7451,13 +7466,13 @@ MessageTests.cpp MessageTests.cpp - + Message from section one Message from section two - + MessageTests.cpp @@ -7468,31 +7483,31 @@ MessageTests.cpp MessageTests.cpp - + MessageTests.cpp - - + + MessageTests.cpp - - - + + + MiscTests.cpp - - + + MiscTests.cpp - + MiscTests.cpp @@ -7530,7 +7545,7 @@ MiscTests.cpp MiscTests.cpp - + Some information @@ -7538,8 +7553,8 @@ Some information An error - - + + MiscTests.cpp @@ -7550,8 +7565,8 @@ MiscTests.cpp MiscTests.cpp - - + + MiscTests.cpp @@ -7559,8 +7574,8 @@ MiscTests.cpp MiscTests.cpp - - + + MiscTests.cpp @@ -7568,8 +7583,8 @@ MiscTests.cpp MiscTests.cpp - - + + MiscTests.cpp @@ -7577,43 +7592,43 @@ MiscTests.cpp MiscTests.cpp - - - + + + MiscTests.cpp - + MiscTests.cpp - + MiscTests.cpp - + MiscTests.cpp - - - - - - - + + + + + + + MiscTests.cpp - - - - + + + + MiscTests.cpp @@ -7624,7 +7639,13 @@ MiscTests.cpp MiscTests.cpp - + + +starting... +finished in 0.322247 + + + Message from section one Message from section two @@ -7638,33 +7659,33 @@ An error An error - - - - - - - - - + + + + + + + + + hello hello - - - + + + TrickyTests.cpp - + TrickyTests.cpp - + TrickyTests.cpp @@ -7672,34 +7693,34 @@ TrickyTests.cpp TrickyTests.cpp - + TrickyTests.cpp - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + Message from section one @@ -7707,6 +7728,9 @@ Message from section two Some information +starting... +finished in 0.322247 + Message from section one Message from section two Some information @@ -11414,6 +11438,9 @@ An error + + +
@@ -14069,7 +14096,7 @@ there"
- + - + diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp index 8b134f2e..3f8f9cc2 100644 --- a/projects/SelfTest/MiscTests.cpp +++ b/projects/SelfTest/MiscTests.cpp @@ -341,3 +341,26 @@ TEST_CASE("./failing/CatchSectionInfiniteLoop", "") FAIL("to infinity and beyond"); } + + +#include "internal/catch_timer.h" + +TEST_CASE( "Timer", "[work-in-progress]" ) +{ + Catch::Timer t; + t.start(); + + std::cout << "starting..." << std::endl; + + double d = 0; + for( int i = 0; i < 100000; ++i ) + for( int j = 0; j < 1000; ++j ) + d += (double)i*(double)j; + + double duration = t.getElapsedSeconds(); + + std::cout << "finished in " << duration << std::endl; + + SUCCEED("yay"); + +} diff --git a/projects/VS2008/TestCatch/TestCatch/TestCatch.vcproj b/projects/VS2008/TestCatch/TestCatch/TestCatch.vcproj index c094bb38..2a9d091a 100644 --- a/projects/VS2008/TestCatch/TestCatch/TestCatch.vcproj +++ b/projects/VS2008/TestCatch/TestCatch/TestCatch.vcproj @@ -359,6 +359,10 @@ RelativePath="..\..\..\SelfTest\ClassTests.cpp" > + + @@ -379,6 +383,10 @@ RelativePath="..\..\..\SelfTest\MiscTests.cpp" > + + diff --git a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj index 0e2cb47c..f3d06d75 100644 --- a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj +++ b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj @@ -57,6 +57,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 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 = ""; }; 266B06B616F3A60A004ED264 /* VariadicMacrosTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VariadicMacrosTests.cpp; path = ../../../SelfTest/VariadicMacrosTests.cpp; sourceTree = ""; }; 266E9AD117230ACF0061DAB2 /* catch_text.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_text.hpp; sourceTree = ""; }; 266E9AD417290E8E0061DAB2 /* CmdLineTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CmdLineTests.cpp; path = ../../../SelfTest/CmdLineTests.cpp; sourceTree = ""; }; @@ -318,6 +320,7 @@ 4AC91CB4155B9EBF00DC5117 /* impl */ = { isa = PBXGroup; children = ( + 263FD06017AF8DF200988A20 /* catch_timer.hpp */, 266E9AD117230ACF0061DAB2 /* catch_text.hpp */, 4A4B0F9C15CEFA8300AE2392 /* catch_impl.hpp */, 4A4B0F9715CE6CFB00AE2392 /* catch_registry_hub.hpp */, @@ -423,6 +426,7 @@ 26759472171C72A400A84BD1 /* catch_sfinae.hpp */, 26759473171C74C200A84BD1 /* catch_compiler_capabilities.h */, 26DACF2F17206D3400A21326 /* catch_text.h */, + 263FD06117AF8DF200988A20 /* catch_timer.h */, ); name = Infrastructure; sourceTree = "";