Merge from mainline

This commit is contained in:
Malcolm Noyes 2013-12-09 16:01:23 +00:00
commit cc2f4ba981
71 changed files with 4125 additions and 4921 deletions

View File

@ -1,6 +1,6 @@
![catch logo](catch-logo-small.png) ![catch logo](catch-logo-small.png)
*v1.0 build 13 (master branch)* *v1.0 build 16 (master branch)*
Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch)

36
docs/build-systems.md Normal file
View File

@ -0,0 +1,36 @@
# Integration with build systems
## CMake
You can use the following CMake script to automatically fetch Catch from github and configure it as an external project:
```CMake
cmake_minimum_required(VERSION 2.8.8)
project(catch_builder CXX)
include(ExternalProject)
ExternalProject_Add(
catch
PREFIX ${CMAKE_BINARY_DIR}/catch
GIT_REPOSITORY https://github.com/philsquared/Catch.git
TIMEOUT 10
UPDATE_COMMAND ${GIT_EXECUTABLE} pull
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
)
# Expose required variable (CATCH_INCLUDE_DIR) to parent scope
ExternalProject_Get_Property(catch source_dir)
set(CATCH_INCLUDE_DIR ${source_dir}/include CACHE INTERNAL "Path to include folder for Catch")
```
If you put it in, e.g., `${PROJECT_SRC_DIR}/${EXT_PROJECTS_DIR}/catch/`, you can use it in your project by adding the following to your root CMake file:
```CMake
# Includes Catch in the project:
add_subdirectory(${EXT_PROJECTS_DIR}/catch)
include_directories(${CATCH_INCLUDE_DIR} ${COMMON_INCLUDES})
enable_testing(true) # Enables unit-testing.
```

View File

@ -34,7 +34,7 @@
#include "internal/catch_notimplemented_exception.h" #include "internal/catch_notimplemented_exception.h"
#include "internal/catch_context.h" #include "internal/catch_context.h"
#include "internal/catch_capture.hpp" #include "internal/catch_capture.hpp"
#include "internal/catch_section.hpp" #include "internal/catch_section.h"
#include "internal/catch_generators.hpp" #include "internal/catch_generators.hpp"
#include "internal/catch_interfaces_exception.h" #include "internal/catch_interfaces_exception.h"
#include "internal/catch_approx.hpp" #include "internal/catch_approx.hpp"
@ -67,11 +67,11 @@
#if defined( CATCH_CONFIG_MAIN ) || defined( CATCH_CONFIG_RUNNER ) #if defined( CATCH_CONFIG_MAIN ) || defined( CATCH_CONFIG_RUNNER )
#define INTERNAL_CATCH_INLINE #define INTERNAL_CATCH_INLINE
#include "internal/catch_impl.hpp" #include "internal/catch_impl.hpp"
#endif #endif // CATCH_CONFIG_MAIN || CATCH_CONFIG_RUNNER
#ifdef CATCH_CONFIG_MAIN #ifdef CATCH_CONFIG_MAIN
#include "internal/catch_default_main.hpp" #include "internal/catch_default_main.hpp"
#endif #endif // CATCH_CONFIG_MAIN
#endif // INTERNAL_CATCH_VS_MANAGED or INTERNAL_CATCH_VS_NATIVE defined #endif // INTERNAL_CATCH_VS_MANAGED or INTERNAL_CATCH_VS_NATIVE defined

View File

@ -12,11 +12,13 @@
#include "catch_expressionresult_builder.h" #include "catch_expressionresult_builder.h"
#include "catch_message.h" #include "catch_message.h"
#include "catch_interfaces_capture.h" #include "catch_interfaces_capture.h"
#include "catch_debugger.hpp" #include "catch_debugger.h"
#include "catch_context.h" #include "catch_context.h"
#include "catch_common.h" #include "catch_common.h"
#include "catch_tostring.hpp" #include "catch_tostring.hpp"
#include "catch_interfaces_reporter.h" #include "catch_interfaces_reporter.h"
//#include "catch_interfaces_registry_hub.h"
//#include "catch_interfaces_config.h"
#include "internal/catch_compiler_capabilities.h" #include "internal/catch_compiler_capabilities.h"
#include <ostream> #include <ostream>
@ -117,7 +119,7 @@ struct TestFailureException{};
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_ACCEPT_EXPR( evaluatedExpr, resultDisposition, originalExpr ) \ #define INTERNAL_CATCH_ACCEPT_EXPR( evaluatedExpr, resultDisposition, originalExpr ) \
if( Catch::ResultAction::Value internal_catch_action = Catch::getResultCapture().acceptExpression( evaluatedExpr, INTERNAL_CATCH_ASSERTIONINFO_NAME ) ) { \ if( Catch::ResultAction::Value internal_catch_action = Catch::getResultCapture().acceptExpression( evaluatedExpr, INTERNAL_CATCH_ASSERTIONINFO_NAME ) ) { \
if( internal_catch_action & Catch::ResultAction::Debug ) BreakIntoDebugger(); \ if( internal_catch_action & Catch::ResultAction::Debug ) CATCH_BREAK_INTO_DEBUGGER(); \
if( internal_catch_action & Catch::ResultAction::Abort ) { INTERNAL_CATCH_TEST_THROW_FAILURE } \ if( internal_catch_action & Catch::ResultAction::Abort ) { INTERNAL_CATCH_TEST_THROW_FAILURE } \
if( !Catch::shouldContinueOnFailure( resultDisposition ) ) { INTERNAL_CATCH_TEST_THROW_FAILURE } \ if( !Catch::shouldContinueOnFailure( resultDisposition ) ) { INTERNAL_CATCH_TEST_THROW_FAILURE } \
Catch::isTrue( false && originalExpr ); \ Catch::isTrue( false && originalExpr ); \

View File

@ -12,6 +12,8 @@
#include "catch_common.h" #include "catch_common.h"
#include "clara.h" #include "clara.h"
#include <fstream>
namespace Catch { namespace Catch {
inline void abortAfterFirst( ConfigData& config ) { config.abortAfter = 1; } inline void abortAfterFirst( ConfigData& config ) { config.abortAfter = 1; }
@ -38,7 +40,18 @@ namespace Catch {
? ShowDurations::Always ? ShowDurations::Always
: ShowDurations::Never; : ShowDurations::Never;
} }
inline void loadTestNamesFromFile( ConfigData& config, std::string const& _filename ) {
std::ifstream f( _filename.c_str() );
if( !f.is_open() )
throw std::domain_error( "Unable to load input file: " + _filename );
std::string line;
while( std::getline( f, line ) ) {
line = trim(line);
if( !line.empty() && !startsWith( line, "#" ) )
addTestOrTags( config, line );
}
}
inline Clara::CommandLine<ConfigData> makeCommandLineParser() { inline Clara::CommandLine<ConfigData> makeCommandLineParser() {
@ -53,19 +66,15 @@ namespace Catch {
.longOpt( "help" ); .longOpt( "help" );
cli.bind( &ConfigData::listTests ) cli.bind( &ConfigData::listTests )
.describe( "list all (or matching) test cases" ) .describe( "list all/matching test cases" )
.shortOpt( "l") .shortOpt( "l")
.longOpt( "list-tests" ); .longOpt( "list-tests" );
cli.bind( &ConfigData::listTags ) cli.bind( &ConfigData::listTags )
.describe( "list all (or matching) tags" ) .describe( "list all/matching tags" )
.shortOpt( "t") .shortOpt( "t")
.longOpt( "list-tags" ); .longOpt( "list-tags" );
cli.bind( &ConfigData::listReporters )
.describe( "list all reporters" )
.longOpt( "list-reporters" );
cli.bind( &ConfigData::showSuccessfulTests ) cli.bind( &ConfigData::showSuccessfulTests )
.describe( "include successful tests in output" ) .describe( "include successful tests in output" )
.shortOpt( "s") .shortOpt( "s")
@ -88,7 +97,7 @@ namespace Catch {
.hint( "filename" ); .hint( "filename" );
cli.bind( &ConfigData::reporterName ) cli.bind( &ConfigData::reporterName )
.describe( "reporter to use - defaults to console" ) .describe( "reporter to use (defaults to console)" )
.shortOpt( "r") .shortOpt( "r")
.longOpt( "reporter" ) .longOpt( "reporter" )
// .hint( "name[:filename]" ); // .hint( "name[:filename]" );
@ -133,6 +142,22 @@ namespace Catch {
.longOpt( "durations" ) .longOpt( "durations" )
.hint( "yes/no" ); .hint( "yes/no" );
cli.bind( &loadTestNamesFromFile )
.describe( "load test names to run from a file" )
.shortOpt( "f")
.longOpt( "input-file" )
.hint( "filename" );
// Less common commands which don't have a short form
cli.bind( &ConfigData::listTestNamesOnly )
.describe( "list all/matching test cases names only" )
.longOpt( "list-test-names-only" );
cli.bind( &ConfigData::listReporters )
.describe( "list all reporters" )
.longOpt( "list-reporters" );
return cli; return cli;
} }

View File

@ -67,36 +67,17 @@ namespace Catch {
std::for_each( container.begin(), container.end(), function ); std::for_each( container.begin(), container.end(), function );
} }
inline bool startsWith( std::string const& s, std::string const& prefix ) { bool startsWith( std::string const& s, std::string const& prefix );
return s.size() >= prefix.size() && s.substr( 0, prefix.size() ) == prefix; bool endsWith( std::string const& s, std::string const& suffix );
} bool contains( std::string const& s, std::string const& infix );
inline bool endsWith( std::string const& s, std::string const& suffix ) { void toLowerInPlace( std::string& s );
return s.size() >= suffix.size() && s.substr( s.size()-suffix.size(), suffix.size() ) == suffix; std::string toLower( std::string const& s );
} std::string trim( std::string const& str );
inline bool contains( std::string const& s, std::string const& infix ) {
return s.find( infix ) != std::string::npos;
}
inline void toLowerInPlace( std::string& s ) {
std::transform( s.begin(), s.end(), s.begin(), ::tolower );
}
inline std::string toLower( std::string const& s ) {
std::string lc = s;
toLowerInPlace( lc );
return lc;
}
struct pluralise { struct pluralise {
pluralise( std::size_t count, std::string const& label ) pluralise( std::size_t count, std::string const& label );
: m_count( count ),
m_label( label )
{}
friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) { friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser );
os << pluraliser.m_count << " " << pluraliser.m_label;
if( pluraliser.m_count != 1 )
os << "s";
return os;
}
std::size_t m_count; std::size_t m_count;
std::string m_label; std::string m_label;
@ -104,43 +85,22 @@ namespace Catch {
struct SourceLineInfo { struct SourceLineInfo {
SourceLineInfo() : line( 0 ){} SourceLineInfo();
SourceLineInfo( std::string const& _file, std::size_t _line ) SourceLineInfo( char const* _file, std::size_t _line );
: file( _file ), SourceLineInfo( SourceLineInfo const& other );
line( _line ) bool empty() const;
{} bool operator == ( SourceLineInfo const& other ) const;
SourceLineInfo( SourceLineInfo const& other )
: file( other.file ),
line( other.line )
{}
bool empty() const {
return file.empty();
}
bool operator == ( SourceLineInfo const& other ) const {
return line == other.line && file == other.file;
}
std::string file; std::string file;
std::size_t line; std::size_t line;
}; };
inline std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info );
#ifndef __GNUG__
os << info.file << "(" << info.line << ")";
#else
os << info.file << ":" << info.line;
#endif
return os;
}
// This is just here to avoid compiler warnings with macro constants and boolean literals // This is just here to avoid compiler warnings with macro constants and boolean literals
inline bool isTrue( bool value ){ return value; } inline bool isTrue( bool value ){ return value; }
inline void throwLogicError( std::string const& message, SourceLineInfo const& locationInfo ) { void throwLogicError( std::string const& message, SourceLineInfo const& locationInfo );
std::ostringstream oss;
oss << locationInfo << ": Internal Catch error: '" << message << "'";
if( isTrue( true ))
throw std::logic_error( oss.str() );
}
} }
#define CATCH_INTERNAL_LINEINFO ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) ) #define CATCH_INTERNAL_LINEINFO ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) )

View File

@ -0,0 +1,86 @@
/*
* Created by Phil on 27/11/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_COMMON_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_COMMON_HPP_INCLUDED
#include "catch_common.h"
namespace Catch {
INTERNAL_CATCH_INLINE bool startsWith( std::string const& s, std::string const& prefix ) {
return s.size() >= prefix.size() && s.substr( 0, prefix.size() ) == prefix;
}
INTERNAL_CATCH_INLINE bool endsWith( std::string const& s, std::string const& suffix ) {
return s.size() >= suffix.size() && s.substr( s.size()-suffix.size(), suffix.size() ) == suffix;
}
INTERNAL_CATCH_INLINE bool contains( std::string const& s, std::string const& infix ) {
return s.find( infix ) != std::string::npos;
}
INTERNAL_CATCH_INLINE void toLowerInPlace( std::string& s ) {
std::transform( s.begin(), s.end(), s.begin(), ::tolower );
}
INTERNAL_CATCH_INLINE std::string toLower( std::string const& s ) {
std::string lc = s;
toLowerInPlace( lc );
return lc;
}
INTERNAL_CATCH_INLINE std::string trim( std::string const& str ) {
static char const* whitespaceChars = "\n\r\t ";
std::string::size_type start = str.find_first_not_of( whitespaceChars );
std::string::size_type end = str.find_last_not_of( whitespaceChars );
return start != std::string::npos ? str.substr( start, 1+end-start ) : "";
}
INTERNAL_CATCH_INLINE pluralise::pluralise( std::size_t count, std::string const& label )
: m_count( count ),
m_label( label )
{}
INTERNAL_CATCH_INLINE std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) {
os << pluraliser.m_count << " " << pluraliser.m_label;
if( pluraliser.m_count != 1 )
os << "s";
return os;
}
INTERNAL_CATCH_INLINE SourceLineInfo::SourceLineInfo() : line( 0 ){}
INTERNAL_CATCH_INLINE SourceLineInfo::SourceLineInfo( char const* _file, std::size_t _line )
: file( _file ),
line( _line )
{}
INTERNAL_CATCH_INLINE SourceLineInfo::SourceLineInfo( SourceLineInfo const& other )
: file( other.file ),
line( other.line )
{}
INTERNAL_CATCH_INLINE bool SourceLineInfo::empty() const {
return file.empty();
}
INTERNAL_CATCH_INLINE bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const {
return line == other.line && file == other.file;
}
INTERNAL_CATCH_INLINE std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
#ifndef __GNUG__
os << info.file << "(" << info.line << ")";
#else
os << info.file << ":" << info.line;
#endif
return os;
}
INTERNAL_CATCH_INLINE void throwLogicError( std::string const& message, SourceLineInfo const& locationInfo ) {
std::ostringstream oss;
oss << locationInfo << ": Internal Catch error: '" << message << "'";
if( isTrue( true ))
throw std::logic_error( oss.str() );
}
}
#endif // TWOBLUECUBES_CATCH_COMMON_HPP_INCLUDED

View File

@ -11,7 +11,7 @@
#include "catch_test_spec.h" #include "catch_test_spec.h"
#include "catch_context.h" #include "catch_context.h"
#include "catch_interfaces_config.h" #include "catch_interfaces_config.h"
#include "catch_stream.hpp" #include "catch_stream.h"
#include <memory> #include <memory>
#include <vector> #include <vector>
@ -30,6 +30,7 @@ namespace Catch {
: listTests( false ), : listTests( false ),
listTags( false ), listTags( false ),
listReporters( false ), listReporters( false ),
listTestNamesOnly( false ),
showSuccessfulTests( false ), showSuccessfulTests( false ),
shouldDebugBreak( false ), shouldDebugBreak( false ),
noThrow( false ), noThrow( false ),
@ -43,6 +44,7 @@ namespace Catch {
bool listTests; bool listTests;
bool listTags; bool listTags;
bool listReporters; bool listReporters;
bool listTestNamesOnly;
bool showSuccessfulTests; bool showSuccessfulTests;
bool shouldDebugBreak; bool shouldDebugBreak;
@ -112,6 +114,7 @@ namespace Catch {
} }
bool listTests() const { return m_data.listTests; } bool listTests() const { return m_data.listTests; }
bool listTestNamesOnly() const { return m_data.listTestNamesOnly; }
bool listTags() const { return m_data.listTags; } bool listTags() const { return m_data.listTags; }
bool listReporters() const { return m_data.listReporters; } bool listReporters() const { return m_data.listReporters; }

View File

@ -117,7 +117,7 @@ namespace {
}; };
inline bool shouldUseColourForPlatform() { inline bool shouldUseColourForPlatform() {
return isatty( fileno(stdout) ); return isatty(STDOUT_FILENO);
} }
PosixColourImpl platformColourImpl; PosixColourImpl platformColourImpl;

View File

@ -0,0 +1,49 @@
/*
* Created by Phil on 3/12/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_DEBUGGER_H_INCLUDED
#define TWOBLUECUBES_CATCH_DEBUGGER_H_INCLUDED
#include "catch_platform.h"
#include <string>
namespace Catch{
bool isDebuggerActive();
void writeToDebugConsole( std::string const& text );
}
#ifdef CATCH_PLATFORM_MAC
// The following code snippet based on:
// http://cocoawithlove.com/2008/03/break-into-debugger.html
#ifdef DEBUG
#if defined(__ppc64__) || defined(__ppc__)
#define CATCH_BREAK_INTO_DEBUGGER() \
if( Catch::isDebuggerActive() ) { \
__asm__("li r0, 20\nsc\nnop\nli r0, 37\nli r4, 2\nsc\nnop\n" \
: : : "memory","r0","r3","r4" ); \
}
#else
#define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) {__asm__("int $3\n" : : );}
#endif
#endif
#elif defined(_MSC_VER)
#define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { __debugbreak(); }
#elif defined(__MINGW32__)
extern "C" __declspec(dllimport) void __stdcall DebugBreak();
#define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { DebugBreak(); }
#endif
#ifndef CATCH_BREAK_INTO_DEBUGGER
#define CATCH_BREAK_INTO_DEBUGGER()
#endif
#endif // TWOBLUECUBES_CATCH_DEBUGGER_H_INCLUDED

View File

@ -5,14 +5,13 @@
* Distributed under the Boost Software License, Version 1.0. (See accompanying * 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) * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
* *
* Provides a BreakIntoDebugger() macro for Windows and Mac (so far)
*/ */
#ifndef TWOBLUECUBES_CATCH_DEBUGGER_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_DEBUGGER_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_DEBUGGER_HPP_INCLUDED #define TWOBLUECUBES_CATCH_DEBUGGER_HPP_INCLUDED
#include <iostream> #include "catch_debugger.h"
#include "catch_platform.h" #include <iostream>
#ifdef CATCH_PLATFORM_MAC #ifdef CATCH_PLATFORM_MAC
@ -29,7 +28,7 @@
// Returns true if the current process is being debugged (either // Returns true if the current process is being debugged (either
// running under the debugger or has a debugger attached post facto). // running under the debugger or has a debugger attached post facto).
inline bool isDebuggerActive(){ INTERNAL_CATCH_INLINE bool isDebuggerActive(){
int junk; int junk;
int mib[4]; int mib[4];
@ -59,52 +58,42 @@
return ( (info.kp_proc.p_flag & P_TRACED) != 0 ); return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
} }
} } // namespace Catch
// The following code snippet taken from:
// http://cocoawithlove.com/2008/03/break-into-debugger.html
#ifdef DEBUG
#if defined(__ppc64__) || defined(__ppc__)
#define BreakIntoDebugger() \
if( Catch::isDebuggerActive() ) { \
__asm__("li r0, 20\nsc\nnop\nli r0, 37\nli r4, 2\nsc\nnop\n" \
: : : "memory","r0","r3","r4" ); \
}
#else
#define BreakIntoDebugger() if( Catch::isDebuggerActive() ) {__asm__("int $3\n" : : );}
#endif
#else
inline void BreakIntoDebugger(){}
#endif
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
#define BreakIntoDebugger() if (IsDebuggerPresent() ) { __debugbreak(); } namespace Catch {
inline bool isDebuggerActive() { INTERNAL_CATCH_INLINE bool isDebuggerActive() {
return IsDebuggerPresent() != 0; return IsDebuggerPresent() != 0;
} }
}
#elif defined(__MINGW32__) #elif defined(__MINGW32__)
extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
extern "C" __declspec(dllimport) void __stdcall DebugBreak(); namespace Catch {
#define BreakIntoDebugger() if (IsDebuggerPresent() ) { DebugBreak(); } INTERNAL_CATCH_INLINE bool isDebuggerActive() {
inline bool isDebuggerActive() {
return IsDebuggerPresent() != 0; return IsDebuggerPresent() != 0;
} }
}
#else #else
inline void BreakIntoDebugger(){} namespace Catch {
inline bool isDebuggerActive() { return false; } inline bool isDebuggerActive() { return false; }
#endif }
#endif // Platform
#ifdef CATCH_PLATFORM_WINDOWS #ifdef CATCH_PLATFORM_WINDOWS
extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA( const char* ); extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA( const char* );
inline void writeToDebugConsole( std::string const& text ) { namespace Catch {
INTERNAL_CATCH_INLINE void writeToDebugConsole( std::string const& text ) {
::OutputDebugStringA( text.c_str() ); ::OutputDebugStringA( text.c_str() );
} }
}
#else #else
inline void writeToDebugConsole( std::string const& text ) { namespace Catch {
INTERNAL_CATCH_INLINE void writeToDebugConsole( std::string const& text ) {
// !TBD: Need a version for Mac/ XCode and other IDEs // !TBD: Need a version for Mac/ XCode and other IDEs
std::cout << text; std::cout << text;
} }
#endif // CATCH_PLATFORM_WINDOWS }
#endif // Platform
#endif // TWOBLUECUBES_CATCH_DEBUGGER_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_DEBUGGER_HPP_INCLUDED

View File

@ -26,11 +26,15 @@
#include "catch_expressionresult_builder.hpp" #include "catch_expressionresult_builder.hpp"
#include "catch_test_case_info.hpp" #include "catch_test_case_info.hpp"
#include "catch_tags.hpp" #include "catch_tags.hpp"
#include "catch_test_spec.hpp"
#include "catch_version.hpp" #include "catch_version.hpp"
#include "catch_text.hpp" #include "catch_text.hpp"
#include "catch_message.hpp" #include "catch_message.hpp"
#include "catch_legacy_reporter_adapter.hpp" #include "catch_legacy_reporter_adapter.hpp"
#include "catch_timer.hpp" #include "catch_timer.hpp"
#include "catch_common.hpp"
#include "catch_section.hpp"
#include "catch_debugger.hpp"
#include "../reporters/catch_reporter_xml.hpp" #include "../reporters/catch_reporter_xml.hpp"
#include "../reporters/catch_reporter_junit.hpp" #include "../reporters/catch_reporter_junit.hpp"
@ -71,9 +75,6 @@ namespace Catch {
FreeFunctionTestCase::~FreeFunctionTestCase() {} FreeFunctionTestCase::~FreeFunctionTestCase() {}
IGeneratorInfo::~IGeneratorInfo() {} IGeneratorInfo::~IGeneratorInfo() {}
IGeneratorsForTest::~IGeneratorsForTest() {} IGeneratorsForTest::~IGeneratorsForTest() {}
TagParser::~TagParser() {}
TagExtracter::~TagExtracter() {}
TagExpressionParser::~TagExpressionParser() {}
Matchers::Impl::StdString::Equals::~Equals() {} Matchers::Impl::StdString::Equals::~Equals() {}
Matchers::Impl::StdString::Contains::~Contains() {} Matchers::Impl::StdString::Contains::~Contains() {}

View File

@ -10,7 +10,6 @@
#include <string> #include <string>
#include "catch_result_type.h" #include "catch_result_type.h"
#include "catch_totals.hpp"
#include "catch_common.h" #include "catch_common.h"
namespace Catch { namespace Catch {
@ -22,6 +21,7 @@ namespace Catch {
struct SectionInfo; struct SectionInfo;
struct MessageInfo; struct MessageInfo;
class ScopedMessageBuilder; class ScopedMessageBuilder;
struct Counts;
struct IResultCapture { struct IResultCapture {

View File

@ -8,10 +8,7 @@
#ifndef TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED #ifndef TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED
#define TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED #define TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED
#include "catch_interfaces_reporter.h" #include <string>
#include "catch_interfaces_config.h"
#include <vector>
namespace Catch { namespace Catch {
@ -19,6 +16,8 @@ namespace Catch {
struct ITestCaseRegistry; struct ITestCaseRegistry;
struct IExceptionTranslatorRegistry; struct IExceptionTranslatorRegistry;
struct IExceptionTranslator; struct IExceptionTranslator;
struct IReporterRegistry;
struct IReporterFactory;
struct IRegistryHub { struct IRegistryHub {
virtual ~IRegistryHub(); virtual ~IRegistryHub();

View File

@ -8,6 +8,7 @@
#ifndef TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED #ifndef TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED
#define TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED #define TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED
#include "catch_section_info.h"
#include "catch_common.h" #include "catch_common.h"
#include "catch_totals.hpp" #include "catch_totals.hpp"
#include "catch_ptr.hpp" #include "catch_ptr.hpp"
@ -80,20 +81,6 @@ namespace Catch
std::size_t groupsCounts; std::size_t groupsCounts;
}; };
struct SectionInfo {
SectionInfo( std::string const& _name,
std::string const& _description,
SourceLineInfo const& _lineInfo )
: name( _name ),
description( _description ),
lineInfo( _lineInfo )
{}
std::string name;
std::string description;
SourceLineInfo lineInfo;
};
struct AssertionStats { struct AssertionStats {
AssertionStats( AssertionResult const& _assertionResult, AssertionStats( AssertionResult const& _assertionResult,
std::vector<MessageInfo> const& _infoMessages, std::vector<MessageInfo> const& _infoMessages,
@ -223,201 +210,6 @@ namespace Catch
virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; virtual void testRunEnded( TestRunStats const& testRunStats ) = 0;
}; };
struct StreamingReporterBase : SharedImpl<IStreamingReporter> {
StreamingReporterBase( ReporterConfig const& _config )
: m_config( _config.fullConfig() ),
stream( _config.stream() )
{}
virtual ~StreamingReporterBase();
virtual void noMatchingTestCases( std::string const& ) {}
virtual void testRunStarting( TestRunInfo const& _testRunInfo ) {
currentTestRunInfo = _testRunInfo;
}
virtual void testGroupStarting( GroupInfo const& _groupInfo ) {
currentGroupInfo = _groupInfo;
}
virtual void testCaseStarting( TestCaseInfo const& _testInfo ) {
currentTestCaseInfo = _testInfo;
}
virtual void sectionStarting( SectionInfo const& _sectionInfo ) {
m_sectionStack.push_back( _sectionInfo );
}
virtual void sectionEnded( SectionStats const& /* _sectionStats */ ) {
m_sectionStack.pop_back();
}
virtual void testCaseEnded( TestCaseStats const& /* _testCaseStats */ ) {
currentTestCaseInfo.reset();
assert( m_sectionStack.empty() );
}
virtual void testGroupEnded( TestGroupStats const& /* _testGroupStats */ ) {
currentGroupInfo.reset();
}
virtual void testRunEnded( TestRunStats const& /* _testRunStats */ ) {
currentTestCaseInfo.reset();
currentGroupInfo.reset();
currentTestRunInfo.reset();
}
Ptr<IConfig> m_config;
std::ostream& stream;
LazyStat<TestRunInfo> currentTestRunInfo;
LazyStat<GroupInfo> currentGroupInfo;
LazyStat<TestCaseInfo> currentTestCaseInfo;
std::vector<SectionInfo> m_sectionStack;
};
struct CumulativeReporterBase : SharedImpl<IStreamingReporter> {
template<typename T, typename ChildNodeT>
struct Node : SharedImpl<> {
explicit Node( T const& _value ) : value( _value ) {}
virtual ~Node() {}
typedef std::vector<Ptr<ChildNodeT> > ChildNodes;
T value;
ChildNodes children;
};
struct SectionNode : SharedImpl<> {
explicit SectionNode( SectionStats const& _stats ) : stats( _stats ) {}
virtual ~SectionNode();
bool operator == ( SectionNode const& other ) const {
return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo;
}
bool operator == ( Ptr<SectionNode> const& other ) const {
return operator==( *other );
}
SectionStats stats;
typedef std::vector<Ptr<SectionNode> > ChildSections;
typedef std::vector<AssertionStats> Assertions;
ChildSections childSections;
Assertions assertions;
std::string stdOut;
std::string stdErr;
};
friend bool operator == ( Ptr<SectionNode> const& node, SectionInfo const& other ) {
return node->stats.sectionInfo.lineInfo == other.lineInfo;
}
typedef Node<TestCaseStats, SectionNode> TestCaseNode;
typedef Node<TestGroupStats, TestCaseNode> TestGroupNode;
typedef Node<TestRunStats, TestGroupNode> TestRunNode;
CumulativeReporterBase( ReporterConfig const& _config )
: m_config( _config.fullConfig() ),
stream( _config.stream() )
{}
~CumulativeReporterBase();
virtual void testRunStarting( TestRunInfo const& ) {}
virtual void testGroupStarting( GroupInfo const& ) {}
virtual void testCaseStarting( TestCaseInfo const& ) {}
virtual void sectionStarting( SectionInfo const& sectionInfo ) {
SectionStats incompleteStats( sectionInfo, Counts(), 0, false );
Ptr<SectionNode> node;
if( m_sectionStack.empty() ) {
if( !m_rootSection )
m_rootSection = new SectionNode( incompleteStats );
node = m_rootSection;
}
else {
SectionNode& parentNode = *m_sectionStack.back();
SectionNode::ChildSections::const_iterator it =
std::find( parentNode.childSections.begin(), parentNode.childSections.end(), sectionInfo );
if( it == parentNode.childSections.end() ) {
node = new SectionNode( incompleteStats );
parentNode.childSections.push_back( node );
}
else
node = *it;
}
m_sectionStack.push_back( node );
m_deepestSection = node;
}
virtual void assertionStarting( AssertionInfo const& ) {}
virtual bool assertionEnded( AssertionStats const& assertionStats ) {
assert( !m_sectionStack.empty() );
SectionNode& sectionNode = *m_sectionStack.back();
sectionNode.assertions.push_back( assertionStats );
return true;
}
virtual void sectionEnded( SectionStats const& sectionStats ) {
assert( !m_sectionStack.empty() );
SectionNode& node = *m_sectionStack.back();
node.stats = sectionStats;
m_sectionStack.pop_back();
}
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) {
Ptr<TestCaseNode> node = new TestCaseNode( testCaseStats );
assert( m_sectionStack.size() == 0 );
node->children.push_back( m_rootSection );
m_testCases.push_back( node );
m_rootSection.reset();
assert( m_deepestSection );
m_deepestSection->stdOut = testCaseStats.stdOut;
m_deepestSection->stdErr = testCaseStats.stdErr;
}
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) {
Ptr<TestGroupNode> node = new TestGroupNode( testGroupStats );
node->children.swap( m_testCases );
m_testGroups.push_back( node );
}
virtual void testRunEnded( TestRunStats const& testRunStats ) {
Ptr<TestRunNode> node = new TestRunNode( testRunStats );
node->children.swap( m_testGroups );
m_testRuns.push_back( node );
testRunEnded();
}
virtual void testRunEnded() = 0;
Ptr<IConfig> m_config;
std::ostream& stream;
std::vector<AssertionStats> m_assertions;
std::vector<std::vector<Ptr<SectionNode> > > m_sections;
std::vector<Ptr<TestCaseNode> > m_testCases;
std::vector<Ptr<TestGroupNode> > m_testGroups;
std::vector<Ptr<TestRunNode> > m_testRuns;
Ptr<SectionNode> m_rootSection;
Ptr<SectionNode> m_deepestSection;
std::vector<Ptr<SectionNode> > m_sectionStack;
};
// Deprecated
struct IReporter : IShared {
virtual ~IReporter();
virtual bool shouldRedirectStdout() const = 0;
virtual void StartTesting() = 0;
virtual void EndTesting( Totals const& totals ) = 0;
virtual void StartGroup( std::string const& groupName ) = 0;
virtual void EndGroup( std::string const& groupName, Totals const& totals ) = 0;
virtual void StartTestCase( TestCaseInfo const& testInfo ) = 0;
virtual void EndTestCase( TestCaseInfo const& testInfo, Totals const& totals, std::string const& stdOut, std::string const& stdErr ) = 0;
virtual void StartSection( std::string const& sectionName, std::string const& description ) = 0;
virtual void EndSection( std::string const& sectionName, Counts const& assertions ) = 0;
virtual void NoAssertionsInSection( std::string const& sectionName ) = 0;
virtual void NoAssertionsInTestCase( std::string const& testName ) = 0;
virtual void Aborted() = 0;
virtual void Result( AssertionResult const& result ) = 0;
};
struct IReporterFactory { struct IReporterFactory {
virtual ~IReporterFactory(); virtual ~IReporterFactory();
@ -433,13 +225,6 @@ namespace Catch
virtual FactoryMap const& getFactories() const = 0; virtual FactoryMap const& getFactories() const = 0;
}; };
inline std::string trim( std::string const& str ) {
static char const* whitespaceChars = "\n\r\t ";
std::string::size_type start = str.find_first_not_of( whitespaceChars );
std::string::size_type end = str.find_last_not_of( whitespaceChars );
return start != std::string::npos ? str.substr( start, 1+end-start ) : "";
}
} }
#endif // TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED #endif // TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED

View File

@ -8,10 +8,6 @@
#ifndef TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED #ifndef TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
#define TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED #define TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
#include "catch_totals.hpp"
#include <string>
namespace Catch { namespace Catch {
class TestCase; class TestCase;

View File

@ -12,6 +12,26 @@
namespace Catch namespace Catch
{ {
// Deprecated
struct IReporter : IShared {
virtual ~IReporter();
virtual bool shouldRedirectStdout() const = 0;
virtual void StartTesting() = 0;
virtual void EndTesting( Totals const& totals ) = 0;
virtual void StartGroup( std::string const& groupName ) = 0;
virtual void EndGroup( std::string const& groupName, Totals const& totals ) = 0;
virtual void StartTestCase( TestCaseInfo const& testInfo ) = 0;
virtual void EndTestCase( TestCaseInfo const& testInfo, Totals const& totals, std::string const& stdOut, std::string const& stdErr ) = 0;
virtual void StartSection( std::string const& sectionName, std::string const& description ) = 0;
virtual void EndSection( std::string const& sectionName, Counts const& assertions ) = 0;
virtual void NoAssertionsInSection( std::string const& sectionName ) = 0;
virtual void NoAssertionsInTestCase( std::string const& testName ) = 0;
virtual void Aborted() = 0;
virtual void Result( AssertionResult const& result ) = 0;
};
class LegacyReporterAdapter : public SharedImpl<IStreamingReporter> class LegacyReporterAdapter : public SharedImpl<IStreamingReporter>
{ {
public: public:

View File

@ -11,6 +11,7 @@
#include "catch_commandline.hpp" #include "catch_commandline.hpp"
#include "catch_text.h" #include "catch_text.h"
#include "catch_console_colour.hpp" #include "catch_console_colour.hpp"
#include "catch_interfaces_reporter.h"
#include <limits> #include <limits>
#include <algorithm> #include <algorithm>
@ -60,6 +61,20 @@ namespace Catch {
return matchedTests; return matchedTests;
} }
inline std::size_t listTestsNamesOnly( Config const& config ) {
std::size_t matchedTests = 0;
std::vector<TestCase> const& allTests = getRegistryHub().getTestCaseRegistry().getAllTests();
for( std::vector<TestCase>::const_iterator it = allTests.begin(), itEnd = allTests.end();
it != itEnd;
++it )
if( matchesFilters( config.filters(), *it ) ) {
matchedTests++;
TestCaseInfo const& testCaseInfo = it->getTestCaseInfo();
std::cout << testCaseInfo.name << std::endl;
}
return matchedTests;
}
inline std::size_t listTags( Config const& config ) { inline std::size_t listTags( Config const& config ) {
if( config.filters().empty() ) if( config.filters().empty() )
std::cout << "All available tags:\n"; std::cout << "All available tags:\n";
@ -131,6 +146,8 @@ namespace Catch {
Option<std::size_t> listedCount; Option<std::size_t> listedCount;
if( config.listTests() ) if( config.listTests() )
listedCount = listedCount.valueOr(0) + listTests( config ); listedCount = listedCount.valueOr(0) + listTests( config );
if( config.listTestNamesOnly() )
listedCount = listedCount.valueOr(0) + listTestsNamesOnly( config );
if( config.listTags() ) if( config.listTags() )
listedCount = listedCount.valueOr(0) + listTags( config ); listedCount = listedCount.valueOr(0) + listTags( config );
if( config.listReporters() ) if( config.listReporters() )

View File

@ -56,9 +56,6 @@ namespace Catch {
namespace Detail{ namespace Detail{
inline bool startsWith( std::string const& str, std::string const& sub ) {
return str.length() > sub.length() && str.substr( 0, sub.length() ) == sub;
}
inline std::string getAnnotation( Class cls, inline std::string getAnnotation( Class cls,
std::string const& annotationName, std::string const& annotationName,
@ -88,7 +85,7 @@ namespace Catch {
for( u_int m = 0; m < count ; m++ ) { for( u_int m = 0; m < count ; m++ ) {
SEL selector = method_getName(methods[m]); SEL selector = method_getName(methods[m]);
std::string methodName = sel_getName(selector); std::string methodName = sel_getName(selector);
if( Detail::startsWith( methodName, "Catch_TestCase_" ) ) { if( startsWith( methodName, "Catch_TestCase_" ) ) {
std::string testCaseName = methodName.substr( 15 ); std::string testCaseName = methodName.substr( 15 );
std::string name = Detail::getAnnotation( cls, "Name", testCaseName ); std::string name = Detail::getAnnotation( cls, "Name", testCaseName );
std::string desc = Detail::getAnnotation( cls, "Description", testCaseName ); std::string desc = Detail::getAnnotation( cls, "Description", testCaseName );

View File

@ -0,0 +1,49 @@
/*
* Created by Phil on 03/12/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_SECTION_H_INCLUDED
#define TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
#include "catch_section_info.h"
#include "catch_totals.hpp"
#include "catch_timer.h"
#include <string>
namespace Catch {
class Section {
public:
Section( SourceLineInfo const& lineInfo,
std::string const& name,
std::string const& description = "" );
~Section();
// This indicates whether the section should be executed or not
operator bool();
private:
SectionInfo m_info;
std::string m_name;
Counts m_assertions;
bool m_sectionIncluded;
Timer m_timer;
};
} // end namespace Catch
#ifdef CATCH_CONFIG_VARIADIC_MACROS
#define INTERNAL_CATCH_SECTION( ... ) \
if( Catch::Section INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::Section( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) )
#else
#define INTERNAL_CATCH_SECTION( name, desc ) \
if( Catch::Section INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::Section( CATCH_INTERNAL_LINEINFO, name, desc ) )
#endif
#endif // TWOBLUECUBES_CATCH_SECTION_H_INCLUDED

View File

@ -8,53 +8,33 @@
#ifndef TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED #define TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED
#include "catch_section.h"
#include "catch_capture.hpp" #include "catch_capture.hpp"
#include "catch_totals.hpp"
#include "catch_compiler_capabilities.h" #include "catch_compiler_capabilities.h"
#include "catch_timer.h" #include "catch_timer.h"
#include <string>
namespace Catch { namespace Catch {
class Section { INTERNAL_CATCH_INLINE Section::Section( SourceLineInfo const& lineInfo,
public:
Section( SourceLineInfo const& lineInfo,
std::string const& name, std::string const& name,
std::string const& description = "" ) std::string const& description )
: m_info( name, description, lineInfo ), : m_info( name, description, lineInfo ),
m_sectionIncluded( getCurrentContext().getResultCapture().sectionStarted( m_info, m_assertions ) ) m_sectionIncluded( getCurrentContext().getResultCapture().sectionStarted( m_info, m_assertions ) )
{ {
m_timer.start(); m_timer.start();
} }
~Section() { INTERNAL_CATCH_INLINE Section::~Section() {
if( m_sectionIncluded ) if( m_sectionIncluded )
getCurrentContext().getResultCapture().sectionEnded( m_info, m_assertions, m_timer.getElapsedSeconds() ); getCurrentContext().getResultCapture().sectionEnded( m_info, m_assertions, m_timer.getElapsedSeconds() );
} }
// This indicates whether the section should be executed or not // This indicates whether the section should be executed or not
operator bool() { INTERNAL_CATCH_INLINE Section::operator bool() {
return m_sectionIncluded; return m_sectionIncluded;
} }
private:
SectionInfo m_info;
std::string m_name;
Counts m_assertions;
bool m_sectionIncluded;
Timer m_timer;
};
} // end namespace Catch } // end namespace Catch
#ifdef CATCH_CONFIG_VARIADIC_MACROS
#define INTERNAL_CATCH_SECTION( ... ) \
if( Catch::Section INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::Section( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) )
#else
#define INTERNAL_CATCH_SECTION( name, desc ) \
if( Catch::Section INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::Section( CATCH_INTERNAL_LINEINFO, name, desc ) )
#endif
#endif // TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED

View File

@ -0,0 +1,31 @@
/*
* Created by Phil on 03/11/2010.
* Copyright 2010 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_SECTION_INFO_H_INCLUDED
#define TWOBLUECUBES_CATCH_SECTION_INFO_H_INCLUDED
#include "catch_common.h"
namespace Catch {
struct SectionInfo {
SectionInfo( std::string const& _name,
std::string const& _description,
SourceLineInfo const& _lineInfo )
: name( _name ),
description( _description ),
lineInfo( _lineInfo )
{}
std::string name;
std::string description;
SourceLineInfo lineInfo;
};
} // end namespace Catch
#endif // TWOBLUECUBES_CATCH_SECTION_INFO_H_INCLUDED

View File

@ -0,0 +1,33 @@
/*
* Created by Phil on 2/12/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_STREAM_H_INCLUDED
#define TWOBLUECUBES_CATCH_STREAM_H_INCLUDED
#include <streambuf>
#ifdef __clang__
#pragma clang diagnostic ignored "-Wpadded"
#endif
namespace Catch {
class Stream {
public:
Stream();
Stream( std::streambuf* _streamBuf, bool _isOwned );
void release();
std::streambuf* streamBuf;
private:
bool isOwned;
};
}
#endif // TWOBLUECUBES_CATCH_STREAM_H_INCLUDED

View File

@ -9,8 +9,9 @@
#ifndef TWOBLUECUBES_CATCH_STREAM_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_STREAM_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_STREAM_HPP_INCLUDED #define TWOBLUECUBES_CATCH_STREAM_HPP_INCLUDED
#include "catch_stream.h"
#include "catch_streambuf.h" #include "catch_streambuf.h"
#include "catch_debugger.hpp" #include "catch_debugger.h"
#include <stdexcept> #include <stdexcept>
#include <cstdio> #include <cstdio>
@ -62,29 +63,21 @@ namespace Catch {
} }
}; };
class Stream { INTERNAL_CATCH_INLINE Stream::Stream()
public:
Stream()
: streamBuf( NULL ), isOwned( false ) : streamBuf( NULL ), isOwned( false )
{} {}
Stream( std::streambuf* _streamBuf, bool _isOwned ) INTERNAL_CATCH_INLINE Stream::Stream( std::streambuf* _streamBuf, bool _isOwned )
: streamBuf( _streamBuf ), isOwned( _isOwned ) : streamBuf( _streamBuf ), isOwned( _isOwned )
{} {}
void release() { INTERNAL_CATCH_INLINE void Stream::release() {
if( isOwned ) { if( isOwned ) {
delete streamBuf; delete streamBuf;
streamBuf = NULL; streamBuf = NULL;
isOwned = false; isOwned = false;
} }
} }
std::streambuf* streamBuf;
private:
bool isOwned;
};
} }
#endif // TWOBLUECUBES_CATCH_STREAM_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_STREAM_HPP_INCLUDED

View File

@ -0,0 +1,109 @@
/*
* Created by Phil on 2/12/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_TAGS_H_INCLUDED
#define TWOBLUECUBES_CATCH_TAGS_H_INCLUDED
#include "catch_common.h"
#include <string>
#include <set>
#include <map>
#include <vector>
#ifdef __clang__
#pragma clang diagnostic ignored "-Wpadded"
#endif
namespace Catch {
class TagParser {
public:
virtual ~TagParser();
void parse( std::string const& str );
protected:
virtual void acceptTag( std::string const& tag ) = 0;
virtual void acceptChar( char c ) = 0;
virtual void endParse() {}
private:
};
class TagExtracter : public TagParser {
public:
TagExtracter( std::set<std::string>& tags );
virtual ~TagExtracter();
void parse( std::string& description );
private:
virtual void acceptTag( std::string const& tag );
virtual void acceptChar( char c );
TagExtracter& operator=(TagExtracter const&);
std::set<std::string>& m_tags;
std::string m_remainder;
};
class Tag {
public:
Tag();
Tag( std::string const& name, bool isNegated );
std::string getName() const;
bool isNegated() const;
bool operator ! () const;
private:
std::string m_name;
bool m_isNegated;
};
class TagSet {
typedef std::map<std::string, Tag> TagMap;
public:
void add( Tag const& tag );
bool empty() const;
bool matches( std::set<std::string> const& tags ) const;
private:
TagMap m_tags;
};
class TagExpression {
public:
bool matches( std::set<std::string> const& tags ) const;
private:
friend class TagExpressionParser;
std::vector<TagSet> m_tagSets;
};
class TagExpressionParser : public TagParser {
public:
TagExpressionParser( TagExpression& exp );
~TagExpressionParser();
private:
virtual void acceptTag( std::string const& tag );
virtual void acceptChar( char c );
virtual void endParse();
TagExpressionParser& operator=(TagExpressionParser const&);
bool m_isNegated;
TagSet m_currentTagSet;
TagExpression& m_exp;
};
} // end namespace Catch
#endif // TWOBLUECUBES_CATCH_TAGS_HPP_INCLUDED

View File

@ -8,23 +8,12 @@
#ifndef TWOBLUECUBES_CATCH_TAGS_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_TAGS_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_TAGS_HPP_INCLUDED #define TWOBLUECUBES_CATCH_TAGS_HPP_INCLUDED
#include "catch_common.h" #include "catch_tags.h"
#include <string>
#include <set>
#include <map>
#include <vector>
#ifdef __clang__
#pragma clang diagnostic ignored "-Wpadded"
#endif
namespace Catch { namespace Catch {
class TagParser { INTERNAL_CATCH_INLINE TagParser::~TagParser() {}
public:
virtual ~TagParser();
void parse( std::string const& str ) { INTERNAL_CATCH_INLINE void TagParser::parse( std::string const& str ) {
std::size_t pos = 0; std::size_t pos = 0;
while( pos < str.size() ) { while( pos < str.size() ) {
char c = str[pos]; char c = str[pos];
@ -47,80 +36,51 @@ namespace Catch {
endParse(); endParse();
} }
protected: INTERNAL_CATCH_INLINE TagExtracter::TagExtracter( std::set<std::string>& tags )
virtual void acceptTag( std::string const& tag ) = 0;
virtual void acceptChar( char c ) = 0;
virtual void endParse() {}
private:
};
class TagExtracter : public TagParser {
public:
TagExtracter( std::set<std::string>& tags )
: m_tags( tags ) : m_tags( tags )
{} {}
virtual ~TagExtracter();
void parse( std::string& description ) { INTERNAL_CATCH_INLINE TagExtracter::~TagExtracter() {}
INTERNAL_CATCH_INLINE void TagExtracter::parse( std::string& description ) {
TagParser::parse( description ); TagParser::parse( description );
description = m_remainder; description = m_remainder;
} }
private: INTERNAL_CATCH_INLINE void TagExtracter::acceptTag( std::string const& tag ) {
virtual void acceptTag( std::string const& tag ) {
m_tags.insert( toLower( tag ) ); m_tags.insert( toLower( tag ) );
} }
virtual void acceptChar( char c ) { INTERNAL_CATCH_INLINE void TagExtracter::acceptChar( char c ) {
m_remainder += c; m_remainder += c;
} }
TagExtracter& operator=(TagExtracter const&); INTERNAL_CATCH_INLINE Tag::Tag() : m_isNegated( false ) {}
INTERNAL_CATCH_INLINE Tag::Tag( std::string const& name, bool isNegated )
std::set<std::string>& m_tags;
std::string m_remainder;
};
class Tag {
public:
Tag()
: m_isNegated( false )
{}
Tag( std::string const& name, bool isNegated )
: m_name( name ), : m_name( name ),
m_isNegated( isNegated ) m_isNegated( isNegated )
{} {}
std::string getName() const { INTERNAL_CATCH_INLINE std::string Tag::getName() const {
return m_name; return m_name;
} }
bool isNegated() const { INTERNAL_CATCH_INLINE bool Tag::isNegated() const {
return m_isNegated; return m_isNegated;
} }
bool operator ! () const { INTERNAL_CATCH_INLINE bool Tag::operator ! () const {
return m_name.empty(); return m_name.empty();
} }
private:
std::string m_name;
bool m_isNegated;
};
class TagSet { INTERNAL_CATCH_INLINE void TagSet::add( Tag const& tag ) {
typedef std::map<std::string, Tag> TagMap;
public:
void add( Tag const& tag ) {
m_tags.insert( std::make_pair( toLower( tag.getName() ), tag ) ); m_tags.insert( std::make_pair( toLower( tag.getName() ), tag ) );
} }
bool empty() const { INTERNAL_CATCH_INLINE bool TagSet::empty() const {
return m_tags.empty(); return m_tags.empty();
} }
bool matches( std::set<std::string> const& tags ) const { INTERNAL_CATCH_INLINE bool TagSet::matches( std::set<std::string> const& tags ) const {
for( TagMap::const_iterator for( TagMap::const_iterator
it = m_tags.begin(), itEnd = m_tags.end(); it = m_tags.begin(), itEnd = m_tags.end();
it != itEnd; it != itEnd;
@ -132,13 +92,8 @@ namespace Catch {
return true; return true;
} }
private:
TagMap m_tags;
};
class TagExpression { INTERNAL_CATCH_INLINE bool TagExpression::matches( std::set<std::string> const& tags ) const {
public:
bool matches( std::set<std::string> const& tags ) const {
for( std::vector<TagSet>::const_iterator for( std::vector<TagSet>::const_iterator
it = m_tagSets.begin(), itEnd = m_tagSets.end(); it = m_tagSets.begin(), itEnd = m_tagSets.end();
it != itEnd; it != itEnd;
@ -148,27 +103,19 @@ namespace Catch {
return false; return false;
} }
private: INTERNAL_CATCH_INLINE TagExpressionParser::TagExpressionParser( TagExpression& exp )
friend class TagExpressionParser;
std::vector<TagSet> m_tagSets;
};
class TagExpressionParser : public TagParser {
public:
TagExpressionParser( TagExpression& exp )
: m_isNegated( false ), : m_isNegated( false ),
m_exp( exp ) m_exp( exp )
{} {}
~TagExpressionParser(); INTERNAL_CATCH_INLINE TagExpressionParser::~TagExpressionParser() {}
private: INTERNAL_CATCH_INLINE void TagExpressionParser::acceptTag( std::string const& tag ) {
virtual void acceptTag( std::string const& tag ) {
m_currentTagSet.add( Tag( tag, m_isNegated ) ); m_currentTagSet.add( Tag( tag, m_isNegated ) );
m_isNegated = false; m_isNegated = false;
} }
virtual void acceptChar( char c ) {
INTERNAL_CATCH_INLINE void TagExpressionParser::acceptChar( char c ) {
switch( c ) { switch( c ) {
case '~': case '~':
m_isNegated = true; m_isNegated = true;
@ -179,18 +126,12 @@ namespace Catch {
break; break;
} }
} }
virtual void endParse() {
INTERNAL_CATCH_INLINE void TagExpressionParser::endParse() {
if( !m_currentTagSet.empty() ) if( !m_currentTagSet.empty() )
m_exp.m_tagSets.push_back( m_currentTagSet ); m_exp.m_tagSets.push_back( m_currentTagSet );
} }
TagExpressionParser& operator=(TagExpressionParser const&);
bool m_isNegated;
TagSet m_currentTagSet;
TagExpression& m_exp;
};
} // end namespace Catch } // end namespace Catch
#endif // TWOBLUECUBES_CATCH_TAGS_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_TAGS_HPP_INCLUDED

View File

@ -8,7 +8,7 @@
#ifndef TWOBLUECUBES_CATCH_TEST_CASE_INFO_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_TEST_CASE_INFO_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_TEST_CASE_INFO_HPP_INCLUDED #define TWOBLUECUBES_CATCH_TEST_CASE_INFO_HPP_INCLUDED
#include "catch_tags.hpp" #include "catch_tags.h"
#include "catch_test_case_info.h" #include "catch_test_case_info.h"
#include "catch_interfaces_testcase.h" #include "catch_interfaces_testcase.h"
#include "catch_common.h" #include "catch_common.h"
@ -22,12 +22,16 @@ namespace Catch {
SourceLineInfo const& _lineInfo ) SourceLineInfo const& _lineInfo )
{ {
std::string desc = _descOrTags; std::string desc = _descOrTags;
bool isHidden( startsWith( _name, "./" ) ); bool isHidden( startsWith( _name, "./" ) ); // Legacy support
std::set<std::string> tags; std::set<std::string> tags;
TagExtracter( tags ).parse( desc ); TagExtracter( tags ).parse( desc );
if( tags.find( "hide" ) != tags.end() || tags.find( "." ) != tags.end() ) if( tags.find( "hide" ) != tags.end() || tags.find( "." ) != tags.end() )
isHidden = true; isHidden = true;
if( isHidden ) {
tags.insert( "hide" );
tags.insert( "." );
}
TestCaseInfo info( _name, _className, desc, tags, isHidden, _lineInfo ); TestCaseInfo info( _name, _className, desc, tags, isHidden, _lineInfo );
return TestCase( _testCase, info ); return TestCase( _testCase, info );
} }

View File

@ -42,8 +42,8 @@ namespace Catch {
else { else {
TestCase const& prev = *m_functions.find( testCase ); TestCase const& prev = *m_functions.find( testCase );
std::cerr << "error: TEST_CASE( \"" << name << "\" ) already defined.\n" std::cerr << "error: TEST_CASE( \"" << name << "\" ) already defined.\n"
<< "\tFirst seen at " << SourceLineInfo( prev.getTestCaseInfo().lineInfo ) << "\n" << "\tFirst seen at " << prev.getTestCaseInfo().lineInfo << "\n"
<< "\tRedefined at " << SourceLineInfo( testCase.getTestCaseInfo().lineInfo ) << std::endl; << "\tRedefined at " << testCase.getTestCaseInfo().lineInfo << std::endl;
exit(1); exit(1);
} }
} }

View File

@ -8,15 +8,15 @@
#ifndef TWOBLUECUBES_CATCH_TEST_SPEC_H_INCLUDED #ifndef TWOBLUECUBES_CATCH_TEST_SPEC_H_INCLUDED
#define TWOBLUECUBES_CATCH_TEST_SPEC_H_INCLUDED #define TWOBLUECUBES_CATCH_TEST_SPEC_H_INCLUDED
#include "catch_test_case_info.h" #include "catch_tags.h"
#include "catch_tags.hpp"
#include "catch_common.h"
#include <string> #include <string>
#include <vector> #include <vector>
namespace Catch { namespace Catch {
class TestCase;
struct IfFilterMatches{ enum DoWhat { struct IfFilterMatches{ enum DoWhat {
AutoDetectBehaviour, AutoDetectBehaviour,
IncludeTests, IncludeTests,
@ -32,69 +32,13 @@ namespace Catch {
}; };
public: public:
TestCaseFilter( std::string const& testSpec, IfFilterMatches::DoWhat matchBehaviour = IfFilterMatches::AutoDetectBehaviour ) TestCaseFilter( std::string const& testSpec, IfFilterMatches::DoWhat matchBehaviour = IfFilterMatches::AutoDetectBehaviour );
: m_stringToMatch( toLower( testSpec ) ),
m_filterType( matchBehaviour ),
m_wildcardPosition( NoWildcard )
{
if( m_filterType == IfFilterMatches::AutoDetectBehaviour ) {
if( startsWith( m_stringToMatch, "exclude:" ) ) {
m_stringToMatch = m_stringToMatch.substr( 8 );
m_filterType = IfFilterMatches::ExcludeTests;
}
else if( startsWith( m_stringToMatch, "~" ) ) {
m_stringToMatch = m_stringToMatch.substr( 1 );
m_filterType = IfFilterMatches::ExcludeTests;
}
else {
m_filterType = IfFilterMatches::IncludeTests;
}
}
if( startsWith( m_stringToMatch, "*" ) ) { IfFilterMatches::DoWhat getFilterType() const;
m_stringToMatch = m_stringToMatch.substr( 1 ); bool shouldInclude( TestCase const& testCase ) const;
m_wildcardPosition = (WildcardPosition)( m_wildcardPosition | WildcardAtStart );
}
if( endsWith( m_stringToMatch, "*" ) ) {
m_stringToMatch = m_stringToMatch.substr( 0, m_stringToMatch.size()-1 );
m_wildcardPosition = (WildcardPosition)( m_wildcardPosition | WildcardAtEnd );
}
}
IfFilterMatches::DoWhat getFilterType() const {
return m_filterType;
}
bool shouldInclude( TestCase const& testCase ) const {
return isMatch( testCase ) == (m_filterType == IfFilterMatches::IncludeTests);
}
private: private:
bool isMatch( TestCase const& testCase ) const;
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunreachable-code"
#endif
bool isMatch( TestCase const& testCase ) const {
std::string name = testCase.getTestCaseInfo().name;
toLowerInPlace( name );
switch( m_wildcardPosition ) {
case NoWildcard:
return m_stringToMatch == name;
case WildcardAtStart:
return endsWith( name, m_stringToMatch );
case WildcardAtEnd:
return startsWith( name, m_stringToMatch );
case WildcardAtBothEnds:
return contains( name, m_stringToMatch );
}
throw std::logic_error( "Unhandled wildcard type" );
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
std::string m_stringToMatch; std::string m_stringToMatch;
IfFilterMatches::DoWhat m_filterType; IfFilterMatches::DoWhat m_filterType;
@ -103,57 +47,12 @@ namespace Catch {
class TestCaseFilters { class TestCaseFilters {
public: public:
TestCaseFilters( std::string const& name ) : m_name( name ) {} TestCaseFilters( std::string const& name );
std::string getName() const;
void addFilter( TestCaseFilter const& filter );
void addTags( std::string const& tagPattern );
bool shouldInclude( TestCase const& testCase ) const;
std::string getName() const {
return m_name;
}
void addFilter( TestCaseFilter const& filter ) {
if( filter.getFilterType() == IfFilterMatches::ExcludeTests )
m_exclusionFilters.push_back( filter );
else
m_inclusionFilters.push_back( filter );
}
void addTags( std::string const& tagPattern ) {
TagExpression exp;
TagExpressionParser( exp ).parse( tagPattern );
m_tagExpressions.push_back( exp );
}
bool shouldInclude( TestCase const& testCase ) const {
if( !m_tagExpressions.empty() ) {
std::vector<TagExpression>::const_iterator it = m_tagExpressions.begin();
std::vector<TagExpression>::const_iterator itEnd = m_tagExpressions.end();
for(; it != itEnd; ++it )
if( it->matches( testCase.getTags() ) )
break;
if( it == itEnd )
return false;
}
if( !m_inclusionFilters.empty() ) {
std::vector<TestCaseFilter>::const_iterator it = m_inclusionFilters.begin();
std::vector<TestCaseFilter>::const_iterator itEnd = m_inclusionFilters.end();
for(; it != itEnd; ++it )
if( it->shouldInclude( testCase ) )
break;
if( it == itEnd )
return false;
}
else if( m_exclusionFilters.empty() && m_tagExpressions.empty() ) {
return !testCase.isHidden();
}
std::vector<TestCaseFilter>::const_iterator it = m_exclusionFilters.begin();
std::vector<TestCaseFilter>::const_iterator itEnd = m_exclusionFilters.end();
for(; it != itEnd; ++it )
if( !it->shouldInclude( testCase ) )
return false;
return true;
}
private: private:
std::vector<TagExpression> m_tagExpressions; std::vector<TagExpression> m_tagExpressions;
std::vector<TestCaseFilter> m_inclusionFilters; std::vector<TestCaseFilter> m_inclusionFilters;

View File

@ -0,0 +1,133 @@
/*
* Created by Phil on 2/12/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_TEST_SPEC_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_TEST_SPEC_HPP_INCLUDED
#include "catch_test_spec.hpp"
#include "catch_test_case_info.h"
#include "catch_common.h"
namespace Catch {
INTERNAL_CATCH_INLINE TestCaseFilter::TestCaseFilter( std::string const& testSpec, IfFilterMatches::DoWhat matchBehaviour )
: m_stringToMatch( toLower( testSpec ) ),
m_filterType( matchBehaviour ),
m_wildcardPosition( NoWildcard )
{
if( m_filterType == IfFilterMatches::AutoDetectBehaviour ) {
if( startsWith( m_stringToMatch, "exclude:" ) ) {
m_stringToMatch = m_stringToMatch.substr( 8 );
m_filterType = IfFilterMatches::ExcludeTests;
}
else if( startsWith( m_stringToMatch, "~" ) ) {
m_stringToMatch = m_stringToMatch.substr( 1 );
m_filterType = IfFilterMatches::ExcludeTests;
}
else {
m_filterType = IfFilterMatches::IncludeTests;
}
}
if( startsWith( m_stringToMatch, "*" ) ) {
m_stringToMatch = m_stringToMatch.substr( 1 );
m_wildcardPosition = (WildcardPosition)( m_wildcardPosition | WildcardAtStart );
}
if( endsWith( m_stringToMatch, "*" ) ) {
m_stringToMatch = m_stringToMatch.substr( 0, m_stringToMatch.size()-1 );
m_wildcardPosition = (WildcardPosition)( m_wildcardPosition | WildcardAtEnd );
}
}
INTERNAL_CATCH_INLINE IfFilterMatches::DoWhat TestCaseFilter::getFilterType() const {
return m_filterType;
}
INTERNAL_CATCH_INLINE bool TestCaseFilter::shouldInclude( TestCase const& testCase ) const {
return isMatch( testCase ) == (m_filterType == IfFilterMatches::IncludeTests);
}
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunreachable-code"
#endif
INTERNAL_CATCH_INLINE bool TestCaseFilter::isMatch( TestCase const& testCase ) const {
std::string name = testCase.getTestCaseInfo().name;
toLowerInPlace( name );
switch( m_wildcardPosition ) {
case NoWildcard:
return m_stringToMatch == name;
case WildcardAtStart:
return endsWith( name, m_stringToMatch );
case WildcardAtEnd:
return startsWith( name, m_stringToMatch );
case WildcardAtBothEnds:
return contains( name, m_stringToMatch );
}
throw std::logic_error( "Unhandled wildcard type" );
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
INTERNAL_CATCH_INLINE TestCaseFilters::TestCaseFilters( std::string const& name ) : m_name( name ) {}
INTERNAL_CATCH_INLINE std::string TestCaseFilters::getName() const {
return m_name;
}
INTERNAL_CATCH_INLINE void TestCaseFilters::addFilter( TestCaseFilter const& filter ) {
if( filter.getFilterType() == IfFilterMatches::ExcludeTests )
m_exclusionFilters.push_back( filter );
else
m_inclusionFilters.push_back( filter );
}
INTERNAL_CATCH_INLINE void TestCaseFilters::addTags( std::string const& tagPattern ) {
TagExpression exp;
TagExpressionParser( exp ).parse( tagPattern );
m_tagExpressions.push_back( exp );
}
INTERNAL_CATCH_INLINE bool TestCaseFilters::shouldInclude( TestCase const& testCase ) const {
if( !m_tagExpressions.empty() ) {
std::vector<TagExpression>::const_iterator it = m_tagExpressions.begin();
std::vector<TagExpression>::const_iterator itEnd = m_tagExpressions.end();
for(; it != itEnd; ++it )
if( it->matches( testCase.getTags() ) )
break;
if( it == itEnd )
return false;
}
if( !m_inclusionFilters.empty() ) {
std::vector<TestCaseFilter>::const_iterator it = m_inclusionFilters.begin();
std::vector<TestCaseFilter>::const_iterator itEnd = m_inclusionFilters.end();
for(; it != itEnd; ++it )
if( it->shouldInclude( testCase ) )
break;
if( it == itEnd )
return false;
}
else if( m_exclusionFilters.empty() && m_tagExpressions.empty() ) {
return !testCase.isHidden();
}
std::vector<TestCaseFilter>::const_iterator it = m_exclusionFilters.begin();
std::vector<TestCaseFilter>::const_iterator itEnd = m_exclusionFilters.end();
for(; it != itEnd; ++it )
if( !it->shouldInclude( testCase ) )
return false;
return true;
}
}
#endif // TWOBLUECUBES_CATCH_TEST_SPEC_HPP_INCLUDED

View File

@ -14,7 +14,7 @@ namespace Catch {
// These numbers are maintained by a script // These numbers are maintained by a script
template <typename T> template <typename T>
const T LibraryVersionInfo<T>::value( 1, 0, 13, "master" ); const T LibraryVersionInfo<T>::value( 1, 0, 16, "master" );
} }
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED

View File

@ -26,6 +26,11 @@ namespace Catch {
} }
#include "catch_common.hpp"
#include "catch_debugger.hpp"
#include "catch_tags.hpp"
#include "catch_test_spec.hpp"
#include "catch_section.hpp"
#include "internal/catch_timer.hpp" #include "internal/catch_timer.hpp"
#include "internal/catch_vs_test_registry.hpp" #include "internal/catch_vs_test_registry.hpp"
#include "reporters/catch_vs_reporter.hpp" #include "reporters/catch_vs_reporter.hpp"

View File

@ -21,6 +21,11 @@ using Microsoft::VisualStudio::CppUnitTestFramework::__LineInfo;
#include <cvt/wstring> #include <cvt/wstring>
#include <codecvt> #include <codecvt>
#include "catch_common.hpp"
#include "catch_debugger.hpp"
#include "catch_tags.hpp"
#include "catch_test_spec.hpp"
#include "catch_section.hpp"
#include "internal/catch_timer.hpp" #include "internal/catch_timer.hpp"
#include "internal/catch_vs_test_registry.hpp" #include "internal/catch_vs_test_registry.hpp"
#include "reporters/catch_vs_reporter.hpp" #include "reporters/catch_vs_reporter.hpp"

View File

@ -332,7 +332,6 @@ namespace Catch {
inline IMutableRegistryHub::~IMutableRegistryHub() {} inline IMutableRegistryHub::~IMutableRegistryHub() {}
inline IExceptionTranslator::~IExceptionTranslator() {} inline IExceptionTranslator::~IExceptionTranslator() {}
inline IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() {} inline IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() {}
inline IReporter::~IReporter() {}
inline IReporterFactory::~IReporterFactory() {} inline IReporterFactory::~IReporterFactory() {}
inline IReporterRegistry::~IReporterRegistry() {} inline IReporterRegistry::~IReporterRegistry() {}
inline IStreamingReporter::~IStreamingReporter() {} inline IStreamingReporter::~IStreamingReporter() {}
@ -355,9 +354,6 @@ namespace Catch {
inline FreeFunctionTestCase::~FreeFunctionTestCase() {} inline FreeFunctionTestCase::~FreeFunctionTestCase() {}
inline IGeneratorInfo::~IGeneratorInfo() {} inline IGeneratorInfo::~IGeneratorInfo() {}
inline IGeneratorsForTest::~IGeneratorsForTest() {} inline IGeneratorsForTest::~IGeneratorsForTest() {}
inline TagParser::~TagParser() {}
inline TagExtracter::~TagExtracter() {}
inline TagExpressionParser::~TagExpressionParser() {}
inline Matchers::Impl::StdString::Equals::~Equals() {} inline Matchers::Impl::StdString::Equals::~Equals() {}
inline Matchers::Impl::StdString::Contains::~Contains() {} inline Matchers::Impl::StdString::Contains::~Contains() {}

View File

@ -0,0 +1,192 @@
/*
* Created by Phil on 27/11/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_REPORTER_BASES_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED
#include "../internal/catch_interfaces_reporter.h"
namespace Catch {
struct StreamingReporterBase : SharedImpl<IStreamingReporter> {
StreamingReporterBase( ReporterConfig const& _config )
: m_config( _config.fullConfig() ),
stream( _config.stream() )
{}
virtual ~StreamingReporterBase();
virtual void noMatchingTestCases( std::string const& ) {}
virtual void testRunStarting( TestRunInfo const& _testRunInfo ) {
currentTestRunInfo = _testRunInfo;
}
virtual void testGroupStarting( GroupInfo const& _groupInfo ) {
currentGroupInfo = _groupInfo;
}
virtual void testCaseStarting( TestCaseInfo const& _testInfo ) {
currentTestCaseInfo = _testInfo;
}
virtual void sectionStarting( SectionInfo const& _sectionInfo ) {
m_sectionStack.push_back( _sectionInfo );
}
virtual void sectionEnded( SectionStats const& /* _sectionStats */ ) {
m_sectionStack.pop_back();
}
virtual void testCaseEnded( TestCaseStats const& /* _testCaseStats */ ) {
currentTestCaseInfo.reset();
assert( m_sectionStack.empty() );
}
virtual void testGroupEnded( TestGroupStats const& /* _testGroupStats */ ) {
currentGroupInfo.reset();
}
virtual void testRunEnded( TestRunStats const& /* _testRunStats */ ) {
currentTestCaseInfo.reset();
currentGroupInfo.reset();
currentTestRunInfo.reset();
}
Ptr<IConfig> m_config;
std::ostream& stream;
LazyStat<TestRunInfo> currentTestRunInfo;
LazyStat<GroupInfo> currentGroupInfo;
LazyStat<TestCaseInfo> currentTestCaseInfo;
std::vector<SectionInfo> m_sectionStack;
};
struct CumulativeReporterBase : SharedImpl<IStreamingReporter> {
template<typename T, typename ChildNodeT>
struct Node : SharedImpl<> {
explicit Node( T const& _value ) : value( _value ) {}
virtual ~Node() {}
typedef std::vector<Ptr<ChildNodeT> > ChildNodes;
T value;
ChildNodes children;
};
struct SectionNode : SharedImpl<> {
explicit SectionNode( SectionStats const& _stats ) : stats( _stats ) {}
virtual ~SectionNode();
bool operator == ( SectionNode const& other ) const {
return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo;
}
bool operator == ( Ptr<SectionNode> const& other ) const {
return operator==( *other );
}
SectionStats stats;
typedef std::vector<Ptr<SectionNode> > ChildSections;
typedef std::vector<AssertionStats> Assertions;
ChildSections childSections;
Assertions assertions;
std::string stdOut;
std::string stdErr;
};
friend bool operator == ( Ptr<SectionNode> const& node, SectionInfo const& other ) {
return node->stats.sectionInfo.lineInfo == other.lineInfo;
}
typedef Node<TestCaseStats, SectionNode> TestCaseNode;
typedef Node<TestGroupStats, TestCaseNode> TestGroupNode;
typedef Node<TestRunStats, TestGroupNode> TestRunNode;
CumulativeReporterBase( ReporterConfig const& _config )
: m_config( _config.fullConfig() ),
stream( _config.stream() )
{}
~CumulativeReporterBase();
virtual void testRunStarting( TestRunInfo const& ) {}
virtual void testGroupStarting( GroupInfo const& ) {}
virtual void testCaseStarting( TestCaseInfo const& ) {}
virtual void sectionStarting( SectionInfo const& sectionInfo ) {
SectionStats incompleteStats( sectionInfo, Counts(), 0, false );
Ptr<SectionNode> node;
if( m_sectionStack.empty() ) {
if( !m_rootSection )
m_rootSection = new SectionNode( incompleteStats );
node = m_rootSection;
}
else {
SectionNode& parentNode = *m_sectionStack.back();
SectionNode::ChildSections::const_iterator it =
std::find( parentNode.childSections.begin(), parentNode.childSections.end(), sectionInfo );
if( it == parentNode.childSections.end() ) {
node = new SectionNode( incompleteStats );
parentNode.childSections.push_back( node );
}
else
node = *it;
}
m_sectionStack.push_back( node );
m_deepestSection = node;
}
virtual void assertionStarting( AssertionInfo const& ) {}
virtual bool assertionEnded( AssertionStats const& assertionStats ) {
assert( !m_sectionStack.empty() );
SectionNode& sectionNode = *m_sectionStack.back();
sectionNode.assertions.push_back( assertionStats );
return true;
}
virtual void sectionEnded( SectionStats const& sectionStats ) {
assert( !m_sectionStack.empty() );
SectionNode& node = *m_sectionStack.back();
node.stats = sectionStats;
m_sectionStack.pop_back();
}
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) {
Ptr<TestCaseNode> node = new TestCaseNode( testCaseStats );
assert( m_sectionStack.size() == 0 );
node->children.push_back( m_rootSection );
m_testCases.push_back( node );
m_rootSection.reset();
assert( m_deepestSection );
m_deepestSection->stdOut = testCaseStats.stdOut;
m_deepestSection->stdErr = testCaseStats.stdErr;
}
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) {
Ptr<TestGroupNode> node = new TestGroupNode( testGroupStats );
node->children.swap( m_testCases );
m_testGroups.push_back( node );
}
virtual void testRunEnded( TestRunStats const& testRunStats ) {
Ptr<TestRunNode> node = new TestRunNode( testRunStats );
node->children.swap( m_testGroups );
m_testRuns.push_back( node );
testRunEnded();
}
virtual void testRunEnded() = 0;
Ptr<IConfig> m_config;
std::ostream& stream;
std::vector<AssertionStats> m_assertions;
std::vector<std::vector<Ptr<SectionNode> > > m_sections;
std::vector<Ptr<TestCaseNode> > m_testCases;
std::vector<Ptr<TestGroupNode> > m_testGroups;
std::vector<Ptr<TestRunNode> > m_testRuns;
Ptr<SectionNode> m_rootSection;
Ptr<SectionNode> m_deepestSection;
std::vector<Ptr<SectionNode> > m_sectionStack;
};
} // end namespace Catch
#endif // TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED

View File

@ -8,7 +8,8 @@
#ifndef TWOBLUECUBES_CATCH_REPORTER_CONSOLE_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_REPORTER_CONSOLE_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_REPORTER_CONSOLE_HPP_INCLUDED #define TWOBLUECUBES_CATCH_REPORTER_CONSOLE_HPP_INCLUDED
#include "../internal/catch_interfaces_reporter.h" #include "catch_reporter_bases.hpp"
#include "../internal/catch_reporter_registrars.hpp" #include "../internal/catch_reporter_registrars.hpp"
#include "../internal/catch_console_colour.hpp" #include "../internal/catch_console_colour.hpp"

View File

@ -8,8 +8,9 @@
#ifndef TWOBLUECUBES_CATCH_REPORTER_JUNIT_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_REPORTER_JUNIT_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_REPORTER_JUNIT_HPP_INCLUDED #define TWOBLUECUBES_CATCH_REPORTER_JUNIT_HPP_INCLUDED
#include "catch_reporter_bases.hpp"
#include "../internal/catch_tostring.hpp" #include "../internal/catch_tostring.hpp"
#include "../internal/catch_interfaces_reporter.h"
#include "../internal/catch_reporter_registrars.hpp" #include "../internal/catch_reporter_registrars.hpp"
#include "../internal/catch_xmlwriter.hpp" #include "../internal/catch_xmlwriter.hpp"

View File

@ -8,8 +8,9 @@
#ifndef TWOBLUECUBES_CATCH_REPORTER_XML_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_REPORTER_XML_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_REPORTER_XML_HPP_INCLUDED #define TWOBLUECUBES_CATCH_REPORTER_XML_HPP_INCLUDED
#include "catch_reporter_bases.hpp"
#include "../internal/catch_capture.hpp" #include "../internal/catch_capture.hpp"
#include "../internal/catch_interfaces_reporter.h"
#include "../internal/catch_reporter_registrars.hpp" #include "../internal/catch_reporter_registrars.hpp"
#include "../internal/catch_xmlwriter.hpp" #include "../internal/catch_xmlwriter.hpp"

View File

@ -11,7 +11,6 @@ set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
set(SOURCES set(SOURCES
${SELF_TEST_DIR}/ApproxTests.cpp ${SELF_TEST_DIR}/ApproxTests.cpp
${SELF_TEST_DIR}/BDDTests.cpp ${SELF_TEST_DIR}/BDDTests.cpp
${SELF_TEST_DIR}/catch_self_test.cpp
${SELF_TEST_DIR}/ClassTests.cpp ${SELF_TEST_DIR}/ClassTests.cpp
${SELF_TEST_DIR}/CmdLineTests.cpp ${SELF_TEST_DIR}/CmdLineTests.cpp
${SELF_TEST_DIR}/ConditionTests.cpp ${SELF_TEST_DIR}/ConditionTests.cpp

View File

@ -11,8 +11,8 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
TEST_CASE TEST_CASE
( (
"./succeeding/Approx/simple", "Some simple comparisons between doubles",
"Some simple comparisons between doubles" "[Approx]"
) )
{ {
double d = 1.23; double d = 1.23;
@ -29,8 +29,8 @@ TEST_CASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
TEST_CASE TEST_CASE
( (
"./succeeding/Approx/epsilon", "Approximate comparisons with different epsilons",
"Approximate comparisons with different epsilons" "[Approx]"
) )
{ {
double d = 1.23; double d = 1.23;
@ -42,8 +42,8 @@ TEST_CASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
TEST_CASE TEST_CASE
( (
"./succeeding/Approx/float", "Approximate comparisons with floats",
"Approximate comparisons with floats" "[Approx]"
) )
{ {
REQUIRE( 1.23f == Approx( 1.23f ) ); REQUIRE( 1.23f == Approx( 1.23f ) );
@ -53,8 +53,8 @@ TEST_CASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
TEST_CASE TEST_CASE
( (
"./succeeding/Approx/int", "Approximate comparisons with ints",
"Approximate comparisons with ints" "[Approx]"
) )
{ {
REQUIRE( 1 == Approx( 1 ) ); REQUIRE( 1 == Approx( 1 ) );
@ -64,8 +64,8 @@ TEST_CASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
TEST_CASE TEST_CASE
( (
"./succeeding/Approx/mixed", "Approximate comparisons with mixed numeric types",
"Approximate comparisons with mixed numeric types" "[Approx]"
) )
{ {
const double dZero = 0; const double dZero = 0;
@ -82,8 +82,8 @@ TEST_CASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
TEST_CASE TEST_CASE
( (
"./succeeding/Approx/custom", "Use a custom approx",
"Use a custom approx" "[Approx][custom]"
) )
{ {
double d = 1.23; double d = 1.23;

View File

@ -4,7 +4,7 @@ CatchSelfTest is a <version> host application.
Run with -? for options Run with -? for options
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/TestClass/failingCase A METHOD_AS_TEST_CASE based test run that fails
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ClassTests.cpp:<line number> ClassTests.cpp:<line number>
............................................................................... ...............................................................................
@ -15,7 +15,7 @@ with expansion:
"hello" == "world" "hello" == "world"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/Fixture/failingCase A TEST_CASE_METHOD based test run that fails
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ClassTests.cpp:<line number> ClassTests.cpp:<line number>
............................................................................... ...............................................................................
@ -26,7 +26,7 @@ with expansion:
1 == 2 1 == 2
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/conditions/equality Equality checks that should fail]
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ConditionTests.cpp:<line number> ConditionTests.cpp:<line number>
............................................................................... ...............................................................................
@ -97,7 +97,7 @@ with expansion:
1.3 == Approx( 1.301 ) 1.3 == Approx( 1.301 )
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/conditions/inequality Inequality checks that should fails
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ConditionTests.cpp:<line number> ConditionTests.cpp:<line number>
............................................................................... ...............................................................................
@ -128,7 +128,7 @@ with expansion:
5 != 5 5 != 5
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/conditions/ordered Ordering comparison checks that should fail
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ConditionTests.cpp:<line number> ConditionTests.cpp:<line number>
............................................................................... ...............................................................................
@ -229,7 +229,7 @@ with expansion:
"hello" <= "a" "hello" <= "a"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/conditions/not 'Not' checks that should fail
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ConditionTests.cpp:<line number> ConditionTests.cpp:<line number>
............................................................................... ...............................................................................
@ -269,7 +269,7 @@ with expansion:
!(1 == 1) !(1 == 1)
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/exceptions/explicit Expected exceptions that don't throw or unexpected exceptions fail the test
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
............................................................................... ...............................................................................
@ -289,7 +289,7 @@ due to unexpected exception with message:
expected exception expected exception
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/exceptions/implicit When unchecked exceptions are thrown directly they are always failures
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
............................................................................... ...............................................................................
@ -299,7 +299,7 @@ due to unexpected exception with message:
unexpected exception unexpected exception
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/exceptions/implicit/2 An unchecked exception reports the line of the last assertion
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
............................................................................... ...............................................................................
@ -310,7 +310,7 @@ due to unexpected exception with message:
unexpected exception unexpected exception
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/exceptions/implicit/3 When unchecked exceptions are thrown from sections they are always failures
section name section name
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
@ -321,7 +321,7 @@ due to unexpected exception with message:
unexpected exception unexpected exception
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/exceptions/implicit/4 When unchecked exceptions are thrown from functions they are always failures
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
............................................................................... ...............................................................................
@ -332,7 +332,7 @@ due to unexpected exception with message:
expected exception expected exception
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/exceptions/custom Unexpected custom exceptions can be translated
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
............................................................................... ...............................................................................
@ -342,7 +342,7 @@ due to unexpected exception with message:
custom exception custom exception
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/exceptions/custom/nothrow Custom exceptions can be translated when testing for nothrow
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
............................................................................... ...............................................................................
@ -353,7 +353,7 @@ due to unexpected exception with message:
custom exception - not std custom exception - not std
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/exceptions/custom/throw Custom exceptions can be translated when testing for throwing as something else
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
............................................................................... ...............................................................................
@ -364,7 +364,7 @@ due to unexpected exception with message:
custom exception - not std custom exception - not std
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/exceptions/custom/double Unexpected exceptions can be translated
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
............................................................................... ...............................................................................
@ -374,7 +374,7 @@ due to unexpected exception with message:
3.14 3.14
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./succeeding/message INFO and WARN do not abort tests
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
............................................................................... ...............................................................................
@ -384,7 +384,7 @@ warning:
this is a warning this is a warning
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/message/info/1 INFO gets logged on failure
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
............................................................................... ...............................................................................
@ -398,7 +398,7 @@ with messages:
so should this so should this
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./mixed/message/info/2 INFO gets logged on failure, even if captured before successful assertions
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
............................................................................... ...............................................................................
@ -419,7 +419,7 @@ with message:
and this, but later and this, but later
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/message/fail FAIL aborts the test
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
............................................................................... ...............................................................................
@ -429,7 +429,7 @@ explicitly with message:
This is a failure This is a failure
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/message/sections Output from all sections is reported
one one
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
@ -440,7 +440,7 @@ explicitly with message:
Message from section one Message from section one
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/message/sections Output from all sections is reported
two two
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
@ -453,7 +453,7 @@ explicitly with message:
Message from section one Message from section one
Message from section two Message from section two
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./mixed/message/scoped SCOPED_INFO is reset for each loop
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
............................................................................... ...............................................................................
@ -477,7 +477,19 @@ explicitly with message:
Previous info should not be seen Previous info should not be seen
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./mixed/Misc/Sections/nested2 sends information to INFO
-------------------------------------------------------------------------------
MessageTests.cpp:<line number>
...............................................................................
MessageTests.cpp:<line number>: FAILED:
REQUIRE( false )
with messages:
hi
i := 7
-------------------------------------------------------------------------------
more nested SECTION tests
s1 s1
s2 s2
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -490,7 +502,7 @@ with expansion:
1 == 2 1 == 2
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./mixed/Misc/Sections/loops looped SECTION tests
s1 s1
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
@ -502,7 +514,7 @@ with expansion:
0 > 1 0 > 1
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./mixed/Misc/loops looped tests
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
@ -552,19 +564,7 @@ with message:
Some information Some information
An error An error
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/info checkedIf, failing
-------------------------------------------------------------------------------
MiscTests.cpp:<line number>
...............................................................................
MiscTests.cpp:<line number>: FAILED:
REQUIRE( false )
with messages:
hi
i := 7
-------------------------------------------------------------------------------
./failing/checkedif
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
@ -580,7 +580,7 @@ with expansion:
false false
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/checkedelse checkedElse, failing
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
@ -596,7 +596,7 @@ with expansion:
false false
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./manual/onechar send a single char to INFO
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
@ -607,7 +607,7 @@ with message:
3 3
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/matchers/Contains Contains string matcher
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
@ -618,7 +618,7 @@ with expansion:
"this string contains 'abc' as a substring" contains: "not there" "this string contains 'abc' as a substring" contains: "not there"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/matchers/StartsWith StartsWith string matcher
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
@ -629,7 +629,7 @@ with expansion:
"this string contains 'abc' as a substring" starts with: "string" "this string contains 'abc' as a substring" starts with: "string"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/matchers/EndsWith EndsWith string matcher
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
@ -640,7 +640,7 @@ with expansion:
"this string contains 'abc' as a substring" ends with: "this" "this string contains 'abc' as a substring" ends with: "this"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/matchers/Equals Equals string matcher
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
@ -661,7 +661,7 @@ warning:
This one ran This one ran
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/CatchSectionInfiniteLoop A couple of nested sections followed by a failure
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
@ -671,7 +671,7 @@ explicitly with message:
to infinity and beyond to infinity and beyond
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/CatchSectionInfiniteLoop A couple of nested sections followed by a failure
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
@ -681,7 +681,7 @@ explicitly with message:
to infinity and beyond to infinity and beyond
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/CatchSectionInfiniteLoop A couple of nested sections followed by a failure
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
@ -690,18 +690,10 @@ MiscTests.cpp:<line number>: FAILED:
explicitly with message: explicitly with message:
to infinity and beyond to infinity and beyond
Message from section one
Message from section two
Some information
An error
Message from section one
Message from section two
Some information
An error
hello hello
hello hello
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./inprogress/failing/Tricky/trailing expression Where the is more to the expression after the RHS[failing]
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
TrickyTests.cpp:<line number> TrickyTests.cpp:<line number>
............................................................................... ...............................................................................
@ -712,7 +704,7 @@ warning:
error error
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./inprogress/failing/Tricky/compound lhs Where the LHS is not a simple value[failing]
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
TrickyTests.cpp:<line number> TrickyTests.cpp:<line number>
............................................................................... ...............................................................................
@ -723,7 +715,7 @@ warning:
error error
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/Tricky/non streamable type A failing expression with a non streamable type is still captured[failing]
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
TrickyTests.cpp:<line number> TrickyTests.cpp:<line number>
............................................................................... ...............................................................................
@ -739,7 +731,7 @@ with expansion:
{?} == {?} {?} == {?}
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/string literals string literals of different sizes can be compared[failing]
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
TrickyTests.cpp:<line number> TrickyTests.cpp:<line number>
............................................................................... ...............................................................................
@ -750,5 +742,5 @@ with expansion:
"first" == "second" "first" == "second"
=============================================================================== ===============================================================================
122 test cases - 35 failed (753 assertions - 90 failed) 120 test cases - 35 failed (673 assertions - 90 failed)

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ CatchSelfTest is a <version> host application.
Run with -? for options Run with -? for options
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./succeeding/Approx/simple Some simple comparisons between doubles
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ApproxTests.cpp:<line number> ApproxTests.cpp:<line number>
............................................................................... ...............................................................................
@ -46,7 +46,7 @@ with expansion:
Approx( 1.23 ) != 1.24 Approx( 1.23 ) != 1.24
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./succeeding/Approx/epsilon Approximate comparisons with different epsilons
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ApproxTests.cpp:<line number> ApproxTests.cpp:<line number>
............................................................................... ...............................................................................
@ -64,7 +64,7 @@ with expansion:
1.23 == Approx( 1.231 ) 1.23 == Approx( 1.231 )
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./succeeding/Approx/float Approximate comparisons with floats
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ApproxTests.cpp:<line number> ApproxTests.cpp:<line number>
............................................................................... ...............................................................................
@ -82,7 +82,7 @@ with expansion:
0 == Approx( 0 ) 0 == Approx( 0 )
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./succeeding/Approx/int Approximate comparisons with ints
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ApproxTests.cpp:<line number> ApproxTests.cpp:<line number>
............................................................................... ...............................................................................
@ -96,7 +96,7 @@ PASSED:
REQUIRE( 0 == Approx( 0 ) ) REQUIRE( 0 == Approx( 0 ) )
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./succeeding/Approx/mixed Approximate comparisons with mixed numeric types
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ApproxTests.cpp:<line number> ApproxTests.cpp:<line number>
............................................................................... ...............................................................................
@ -132,7 +132,7 @@ with expansion:
1.234 == Approx( 1.234 ) 1.234 == Approx( 1.234 )
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./succeeding/Approx/custom Use a custom approx
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ApproxTests.cpp:<line number> ApproxTests.cpp:<line number>
............................................................................... ...............................................................................
@ -204,7 +204,7 @@ with expansion:
3.1428571429 != Approx( 3.141 ) 3.1428571429 != Approx( 3.141 )
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./succeeding/TestClass/succeedingCase A METHOD_AS_TEST_CASE based test run that succeeds
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ClassTests.cpp:<line number> ClassTests.cpp:<line number>
............................................................................... ...............................................................................
@ -216,7 +216,7 @@ with expansion:
"hello" == "hello" "hello" == "hello"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/TestClass/failingCase A METHOD_AS_TEST_CASE based test run that fails
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ClassTests.cpp:<line number> ClassTests.cpp:<line number>
............................................................................... ...............................................................................
@ -227,7 +227,7 @@ with expansion:
"hello" == "world" "hello" == "world"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./succeeding/Fixture/succeedingCase A TEST_CASE_METHOD based test run that succeeds
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ClassTests.cpp:<line number> ClassTests.cpp:<line number>
............................................................................... ...............................................................................
@ -239,7 +239,7 @@ with expansion:
1 == 1 1 == 1
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/Fixture/failingCase A TEST_CASE_METHOD based test run that fails
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ClassTests.cpp:<line number> ClassTests.cpp:<line number>
............................................................................... ...............................................................................
@ -250,7 +250,7 @@ with expansion:
1 == 2 1 == 2
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./succeeding/conditions/equality Equality checks that should succeed
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ConditionTests.cpp:<line number> ConditionTests.cpp:<line number>
............................................................................... ...............................................................................
@ -298,7 +298,7 @@ with expansion:
1.3 == Approx( 1.3 ) 1.3 == Approx( 1.3 )
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
./failing/conditions/equality Equality checks that should fail]
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
ConditionTests.cpp:<line number> ConditionTests.cpp:<line number>
............................................................................... ...............................................................................

View File

@ -1,26 +1,26 @@
<testsuites> <testsuites>
<testsuite name="~_" errors="10" failures="99" tests="772" hostname="tbd" time="{duration}" timestamp="tbd"> <testsuite name="~_" errors="10" failures="99" tests="692" hostname="tbd" time="{duration}" timestamp="tbd">
<testcase classname="global" name="./succeeding/Approx/simple" time="{duration}"/> <testcase classname="global" name="Some simple comparisons between doubles" time="{duration}"/>
<testcase classname="global" name="./succeeding/Approx/epsilon" time="{duration}"/> <testcase classname="global" name="Approximate comparisons with different epsilons" time="{duration}"/>
<testcase classname="global" name="./succeeding/Approx/float" time="{duration}"/> <testcase classname="global" name="Approximate comparisons with floats" time="{duration}"/>
<testcase classname="global" name="./succeeding/Approx/int" time="{duration}"/> <testcase classname="global" name="Approximate comparisons with ints" time="{duration}"/>
<testcase classname="global" name="./succeeding/Approx/mixed" time="{duration}"/> <testcase classname="global" name="Approximate comparisons with mixed numeric types" time="{duration}"/>
<testcase classname="global" name="./succeeding/Approx/custom" time="{duration}"/> <testcase classname="global" name="Use a custom approx" time="{duration}"/>
<testcase classname="global" name="Approximate PI" time="{duration}"/> <testcase classname="global" name="Approximate PI" time="{duration}"/>
<testcase classname="TestClass" name="./succeeding/TestClass/succeedingCase" time="{duration}"/> <testcase classname="TestClass" name="A METHOD_AS_TEST_CASE based test run that succeeds" time="{duration}"/>
<testcase classname="TestClass" name="./failing/TestClass/failingCase" time="{duration}"> <testcase classname="TestClass" name="A METHOD_AS_TEST_CASE based test run that fails" time="{duration}">
<failure message="&quot;hello&quot; == &quot;world&quot;" type="REQUIRE"> <failure message="&quot;hello&quot; == &quot;world&quot;" type="REQUIRE">
ClassTests.cpp:<line number> ClassTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="Fixture" name="./succeeding/Fixture/succeedingCase" time="{duration}"/> <testcase classname="Fixture" name="A TEST_CASE_METHOD based test run that succeeds" time="{duration}"/>
<testcase classname="Fixture" name="./failing/Fixture/failingCase" time="{duration}"> <testcase classname="Fixture" name="A TEST_CASE_METHOD based test run that fails" time="{duration}">
<failure message="1 == 2" type="REQUIRE"> <failure message="1 == 2" type="REQUIRE">
ClassTests.cpp:<line number> ClassTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./succeeding/conditions/equality" time="{duration}"/> <testcase classname="global" name="Equality checks that should succeed" time="{duration}"/>
<testcase classname="global" name="./failing/conditions/equality" time="{duration}"> <testcase classname="global" name="Equality checks that should fail]" time="{duration}">
<failure message="7 == 6" type="CHECK"> <failure message="7 == 6" type="CHECK">
ConditionTests.cpp:<line number> ConditionTests.cpp:<line number>
</failure> </failure>
@ -61,8 +61,8 @@ ConditionTests.cpp:<line number>
ConditionTests.cpp:<line number> ConditionTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./succeeding/conditions/inequality" time="{duration}"/> <testcase classname="global" name="Inequality checks that should succeed" time="{duration}"/>
<testcase classname="global" name="./failing/conditions/inequality" time="{duration}"> <testcase classname="global" name="Inequality checks that should fails" time="{duration}">
<failure message="7 != 7" type="CHECK"> <failure message="7 != 7" type="CHECK">
ConditionTests.cpp:<line number> ConditionTests.cpp:<line number>
</failure> </failure>
@ -79,8 +79,8 @@ ConditionTests.cpp:<line number>
ConditionTests.cpp:<line number> ConditionTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./succeeding/conditions/ordered" time="{duration}"/> <testcase classname="global" name="Ordering comparison checks that should succeed" time="{duration}"/>
<testcase classname="global" name="./failing/conditions/ordered" time="{duration}"> <testcase classname="global" name="Ordering comparison checks that should fail" time="{duration}">
<failure message="7 > 7" type="CHECK"> <failure message="7 > 7" type="CHECK">
ConditionTests.cpp:<line number> ConditionTests.cpp:<line number>
</failure> </failure>
@ -139,14 +139,14 @@ ConditionTests.cpp:<line number>
ConditionTests.cpp:<line number> ConditionTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./succeeding/conditions/int literals" time="{duration}"/> <testcase classname="global" name="Comparisons with int literals don't warn when mixing signed/ unsigned" time="{duration}"/>
<testcase classname="global" name="./succeeding/conditions//long_to_unsigned_x" time="{duration}"/> <testcase classname="global" name="comparisons between int variables" time="{duration}"/>
<testcase classname="global" name="./succeeding/conditions/const ints to int literal" time="{duration}"/> <testcase classname="global" name="comparisons between const int variables" time="{duration}"/>
<testcase classname="global" name="./succeeding/conditions/negative ints" time="{duration}"/> <testcase classname="global" name="Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" time="{duration}"/>
<testcase classname="global" name="./succeeding/conditions/computed ints" time="{duration}"/> <testcase classname="global" name="Comparisons between ints where one side is computed" time="{duration}"/>
<testcase classname="global" name="./succeeding/conditions/ptr" time="{duration}"/> <testcase classname="global" name="Pointers can be compared to null" time="{duration}"/>
<testcase classname="global" name="./succeeding/conditions/not" time="{duration}"/> <testcase classname="global" name="'Not' checks that should succeed" time="{duration}"/>
<testcase classname="global" name="./failing/conditions/not" time="{duration}"> <testcase classname="global" name="'Not' checks that should fail" time="{duration}">
<failure message="false != false" type="CHECK"> <failure message="false != false" type="CHECK">
ConditionTests.cpp:<line number> ConditionTests.cpp:<line number>
</failure> </failure>
@ -172,8 +172,8 @@ ConditionTests.cpp:<line number>
ConditionTests.cpp:<line number> ConditionTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./succeeding/exceptions/explicit" time="{duration}"/> <testcase classname="global" name="When checked exceptions are thrown they can be expected or unexpected" time="{duration}"/>
<testcase classname="global" name="./failing/exceptions/explicit" time="{duration}"> <testcase classname="global" name="Expected exceptions that don't throw or unexpected exceptions fail the test" time="{duration}">
<error message="thisThrows()" type="CHECK_THROWS_AS"> <error message="thisThrows()" type="CHECK_THROWS_AS">
expected exception expected exception
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
@ -186,67 +186,67 @@ expected exception
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
</error> </error>
</testcase> </testcase>
<testcase classname="global" name="./failing/exceptions/implicit" time="{duration}"> <testcase classname="global" name="When unchecked exceptions are thrown directly they are always failures" time="{duration}">
<error type="TEST_CASE"> <error type="TEST_CASE">
unexpected exception unexpected exception
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
</error> </error>
</testcase> </testcase>
<testcase classname="global" name="./failing/exceptions/implicit/2" time="{duration}"> <testcase classname="global" name="An unchecked exception reports the line of the last assertion" time="{duration}">
<error message="{Unknown expression after the reported line}"> <error message="{Unknown expression after the reported line}">
unexpected exception unexpected exception
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
</error> </error>
</testcase> </testcase>
<testcase classname="./failing/exceptions/implicit/3" name="section name" time="{duration}"> <testcase classname="When unchecked exceptions are thrown from sections they are always failures" name="section name" time="{duration}">
<error type="TEST_CASE"> <error type="TEST_CASE">
unexpected exception unexpected exception
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
</error> </error>
</testcase> </testcase>
<testcase classname="global" name="./failing/exceptions/implicit/4" time="{duration}"> <testcase classname="global" name="When unchecked exceptions are thrown from functions they are always failures" time="{duration}">
<error message="thisThrows() == 0" type="CHECK"> <error message="thisThrows() == 0" type="CHECK">
expected exception expected exception
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
</error> </error>
</testcase> </testcase>
<testcase classname="global" name="./failing/exceptions/custom" time="{duration}"> <testcase classname="global" name="Unexpected custom exceptions can be translated" time="{duration}">
<error type="TEST_CASE"> <error type="TEST_CASE">
custom exception custom exception
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
</error> </error>
</testcase> </testcase>
<testcase classname="global" name="./failing/exceptions/custom/nothrow" time="{duration}"> <testcase classname="global" name="Custom exceptions can be translated when testing for nothrow" time="{duration}">
<error message="throwCustom()" type="REQUIRE_NOTHROW"> <error message="throwCustom()" type="REQUIRE_NOTHROW">
custom exception - not std custom exception - not std
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
</error> </error>
</testcase> </testcase>
<testcase classname="global" name="./failing/exceptions/custom/throw" time="{duration}"> <testcase classname="global" name="Custom exceptions can be translated when testing for throwing as something else" time="{duration}">
<error message="throwCustom()" type="REQUIRE_THROWS_AS"> <error message="throwCustom()" type="REQUIRE_THROWS_AS">
custom exception - not std custom exception - not std
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
</error> </error>
</testcase> </testcase>
<testcase classname="global" name="./failing/exceptions/custom/double" time="{duration}"> <testcase classname="global" name="Unexpected exceptions can be translated" time="{duration}">
<error type="TEST_CASE"> <error type="TEST_CASE">
3.14 3.14
ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>
</error> </error>
</testcase> </testcase>
<testcase classname="global" name="./succeeding/exceptions/notimplemented" time="{duration}"/> <testcase classname="global" name="NotImplemented exception" time="{duration}"/>
<testcase classname="global" name="./succeeding/generators/1" time="{duration}"/> <testcase classname="global" name="Generators over two ranges" time="{duration}"/>
<testcase classname="global" name="./succeeding/generators/2" time="{duration}"/> <testcase classname="global" name="Generator over a range of pairs" time="{duration}"/>
<testcase classname="global" name="./succeeding/message" time="{duration}"/> <testcase classname="global" name="INFO and WARN do not abort tests" time="{duration}"/>
<testcase classname="global" name="./succeeding/succeed" time="{duration}"/> <testcase classname="global" name="SUCCEED counts as a test pass" time="{duration}"/>
<testcase classname="global" name="./failing/message/info/1" time="{duration}"> <testcase classname="global" name="INFO gets logged on failure" time="{duration}">
<failure message="2 == 1" type="REQUIRE"> <failure message="2 == 1" type="REQUIRE">
this message should be logged this message should be logged
so should this so should this
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./mixed/message/info/2" time="{duration}"> <testcase classname="global" name="INFO gets logged on failure, even if captured before successful assertions" time="{duration}">
<failure message="2 == 1" type="CHECK"> <failure message="2 == 1" type="CHECK">
this message should be logged this message should be logged
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
@ -256,61 +256,68 @@ and this, but later
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./failing/message/fail" time="{duration}"> <testcase classname="global" name="FAIL aborts the test" time="{duration}">
<failure type="FAIL"> <failure type="FAIL">
This is a failure This is a failure
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="./failing/message/sections" name="one" time="{duration}"> <testcase classname="Output from all sections is reported" name="one" time="{duration}">
<failure type="FAIL"> <failure type="FAIL">
Message from section one Message from section one
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="./failing/message/sections" name="two" time="{duration}"> <testcase classname="Output from all sections is reported" name="two" time="{duration}">
<failure type="FAIL"> <failure type="FAIL">
Message from section two Message from section two
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="./succeeding/message/sections/stdout" name="two" time="{duration}"> <testcase classname="Standard output from all sections is reported" name="two" time="{duration}">
<system-out> <system-out>
Message from section one Message from section one
Message from section two Message from section two
</system-out> </system-out>
</testcase> </testcase>
<testcase classname="global" name="./mixed/message/scoped" time="{duration}"> <testcase classname="global" name="SCOPED_INFO is reset for each loop" time="{duration}">
<failure message="10 &lt; 10" type="REQUIRE"> <failure message="10 &lt; 10" type="REQUIRE">
current counter 10 current counter 10
i := 10 i := 10
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./succeeding/nofail" time="{duration}"/> <testcase classname="global" name="The NO_FAIL macro reports a failure but does not fail the test" time="{duration}"/>
<testcase classname="global" name="just failure" time="{duration}"> <testcase classname="global" name="just failure" time="{duration}">
<failure type="FAIL"> <failure type="FAIL">
Previous info should not be seen Previous info should not be seen
MessageTests.cpp:<line number> MessageTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="./succeeding/Misc/Sections" name="s1" time="{duration}"/> <testcase classname="global" name="sends information to INFO" time="{duration}">
<testcase classname="./succeeding/Misc/Sections" name="s2" time="{duration}"/> <failure message="false" type="REQUIRE">
<testcase classname="./succeeding/Misc/Sections/nested" name="s1" time="{duration}"/> hi
<testcase classname="./succeeding/Misc/Sections/nested" name="s1/s2" time="{duration}"/> i := 7
<testcase classname="./mixed/Misc/Sections/nested2" name="s1/s2" time="{duration}"> MessageTests.cpp:<line number>
</failure>
</testcase>
<testcase classname="random SECTION tests" name="s1" time="{duration}"/>
<testcase classname="random SECTION tests" name="s2" time="{duration}"/>
<testcase classname="nested SECTION tests" name="s1" time="{duration}"/>
<testcase classname="nested SECTION tests" name="s1/s2" time="{duration}"/>
<testcase classname="more nested SECTION tests" name="s1/s2" time="{duration}">
<failure message="1 == 2" type="REQUIRE"> <failure message="1 == 2" type="REQUIRE">
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="./mixed/Misc/Sections/nested2" name="s1/s3" time="{duration}"/> <testcase classname="more nested SECTION tests" name="s1/s3" time="{duration}"/>
<testcase classname="./mixed/Misc/Sections/nested2" name="s1/s4" time="{duration}"/> <testcase classname="more nested SECTION tests" name="s1/s4" time="{duration}"/>
<testcase classname="./mixed/Misc/Sections/loops" name="s1" time="{duration}"> <testcase classname="looped SECTION tests" name="s1" time="{duration}">
<failure message="0 > 1" type="CHECK"> <failure message="0 > 1" type="CHECK">
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./mixed/Misc/loops" time="{duration}"> <testcase classname="global" name="looped tests" time="{duration}">
<failure message="1 == 0" type="CHECK"> <failure message="1 == 0" type="CHECK">
Testing if fib[0] (1) is even Testing if fib[0] (1) is even
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
@ -336,7 +343,7 @@ Testing if fib[7] (21) is even
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./succeeding/Misc/stdout,stderr" time="{duration}"> <testcase classname="global" name="Sends stuff to stdout and stderr" time="{duration}">
<system-out> <system-out>
Some information Some information
</system-out> </system-out>
@ -344,16 +351,9 @@ Some information
An error An error
</system-err> </system-err>
</testcase> </testcase>
<testcase classname="global" name="./succeeding/Misc/null strings" time="{duration}"/> <testcase classname="global" name="null strings" time="{duration}"/>
<testcase classname="global" name="./failing/info" time="{duration}"> <testcase classname="global" name="checkedIf" time="{duration}"/>
<failure message="false" type="REQUIRE"> <testcase classname="global" name="checkedIf, failing" time="{duration}">
hi
i := 7
MiscTests.cpp:<line number>
</failure>
</testcase>
<testcase classname="global" name="./succeeding/checkedif" time="{duration}"/>
<testcase classname="global" name="./failing/checkedif" time="{duration}">
<failure message="false" type="CHECKED_IF"> <failure message="false" type="CHECKED_IF">
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
@ -361,8 +361,8 @@ MiscTests.cpp:<line number>
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./succeeding/checkedelse" time="{duration}"/> <testcase classname="global" name="checkedElse" time="{duration}"/>
<testcase classname="global" name="./failing/checkedelse" time="{duration}"> <testcase classname="global" name="checkedElse, failing" time="{duration}">
<failure message="false" type="CHECKED_ELSE"> <failure message="false" type="CHECKED_ELSE">
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
@ -370,38 +370,38 @@ MiscTests.cpp:<line number>
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./manual/onechar" time="{duration}"> <testcase classname="global" name="send a single char to INFO" time="{duration}">
<failure message="false" type="REQUIRE"> <failure message="false" type="REQUIRE">
3 3
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./succeeding/atomic if" time="{duration}"/> <testcase classname="global" name="atomic if" time="{duration}"/>
<testcase classname="global" name="./succeeding/matchers" time="{duration}"/> <testcase classname="global" name="String matchers" time="{duration}"/>
<testcase classname="global" name="./failing/matchers/Contains" time="{duration}"> <testcase classname="global" name="Contains string matcher" time="{duration}">
<failure message="&quot;this string contains 'abc' as a substring&quot; contains: &quot;not there&quot;" type="CHECK_THAT"> <failure message="&quot;this string contains 'abc' as a substring&quot; contains: &quot;not there&quot;" type="CHECK_THAT">
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./failing/matchers/StartsWith" time="{duration}"> <testcase classname="global" name="StartsWith string matcher" time="{duration}">
<failure message="&quot;this string contains 'abc' as a substring&quot; starts with: &quot;string&quot;" type="CHECK_THAT"> <failure message="&quot;this string contains 'abc' as a substring&quot; starts with: &quot;string&quot;" type="CHECK_THAT">
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./failing/matchers/EndsWith" time="{duration}"> <testcase classname="global" name="EndsWith string matcher" time="{duration}">
<failure message="&quot;this string contains 'abc' as a substring&quot; ends with: &quot;this&quot;" type="CHECK_THAT"> <failure message="&quot;this string contains 'abc' as a substring&quot; ends with: &quot;this&quot;" type="CHECK_THAT">
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./failing/matchers/Equals" time="{duration}"> <testcase classname="global" name="Equals string matcher" time="{duration}">
<failure message="&quot;this string contains 'abc' as a substring&quot; equals: &quot;something else&quot;" type="CHECK_THAT"> <failure message="&quot;this string contains 'abc' as a substring&quot; equals: &quot;something else&quot;" type="CHECK_THAT">
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="string" time="{duration}"/> <testcase classname="global" name="Equals string matcher, with NULL" time="{duration}"/>
<testcase classname="global" name="./succeeding/matchers/AllOf" time="{duration}"/> <testcase classname="global" name="AllOf matcher" time="{duration}"/>
<testcase classname="global" name="./succeeding/matchers/AnyOf" time="{duration}"/> <testcase classname="global" name="AnyOf matcher" time="{duration}"/>
<testcase classname="global" name="./succeeding/matchers/Equals" time="{duration}"/> <testcase classname="global" name="Equals" time="{duration}"/>
<testcase classname="global" name="Factorials are computed" time="{duration}"/> <testcase classname="global" name="Factorials are computed" time="{duration}"/>
<testcase classname="global" name="Nice descriptive name" time="{duration}"/> <testcase classname="global" name="Nice descriptive name" time="{duration}"/>
<testcase classname="vectors can be sized and resized" name="root" time="{duration}"/> <testcase classname="vectors can be sized and resized" name="root" time="{duration}"/>
@ -410,7 +410,7 @@ MiscTests.cpp:<line number>
<testcase classname="vectors can be sized and resized" name="resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}"/> <testcase classname="vectors can be sized and resized" name="resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}"/>
<testcase classname="vectors can be sized and resized" name="reserving bigger changes capacity but not size" time="{duration}"/> <testcase classname="vectors can be sized and resized" name="reserving bigger changes capacity but not size" time="{duration}"/>
<testcase classname="vectors can be sized and resized" name="reserving smaller does not change size or capacity" time="{duration}"/> <testcase classname="vectors can be sized and resized" name="reserving smaller does not change size or capacity" time="{duration}"/>
<testcase classname="./failing/CatchSectionInfiniteLoop" name="root" time="{duration}"> <testcase classname="A couple of nested sections followed by a failure" name="root" time="{duration}">
<failure type="FAIL"> <failure type="FAIL">
to infinity and beyond to infinity and beyond
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
@ -424,25 +424,7 @@ to infinity and beyond
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="./failing/CatchSectionInfiniteLoop" name="Outer/Inner" time="{duration}"/> <testcase classname="A couple of nested sections followed by a failure" name="Outer/Inner" time="{duration}"/>
<testcase classname="selftest/main" name="selftest/expected result/selftest/expected result/failing tests" time="{duration}"/>
<testcase classname="selftest/main" name="selftest/expected result/selftest/expected result/succeeding tests" time="{duration}"/>
<testcase classname="selftest/main" name="selftest/test counts/selftest/test counts/succeeding tests" time="{duration}"/>
<testcase classname="selftest/main" name="selftest/test counts/selftest/test counts/failing tests" time="{duration}">
<system-out>
Message from section one
Message from section two
Some information
Message from section one
Message from section two
Some information
</system-out>
<system-err>
An error
An error
</system-err>
</testcase>
<testcase classname="global" name="meta/Misc/Sections" time="{duration}"/>
<testcase classname="Process can be configured on command line" name="default - no arguments" time="{duration}"/> <testcase classname="Process can be configured on command line" name="default - no arguments" time="{duration}"/>
<testcase classname="Process can be configured on command line" name="test lists/1 test" time="{duration}"/> <testcase classname="Process can be configured on command line" name="test lists/1 test" time="{duration}"/>
<testcase classname="Process can be configured on command line" name="test lists/Specify one test case exclusion using exclude:" time="{duration}"/> <testcase classname="Process can be configured on command line" name="test lists/Specify one test case exclusion using exclude:" time="{duration}"/>
@ -493,10 +475,10 @@ hello
</testcase> </testcase>
<testcase classname="global" name="Text can be formatted using the Text class" time="{duration}"/> <testcase classname="global" name="Text can be formatted using the Text class" time="{duration}"/>
<testcase classname="global" name="Long text is truncted" time="{duration}"/> <testcase classname="global" name="Long text is truncted" time="{duration}"/>
<testcase classname="global" name="./succeeding/Tricky/std::pair" time="{duration}"/> <testcase classname="global" name="Parsing a std::pair" time="{duration}"/>
<testcase classname="global" name="./inprogress/failing/Tricky/trailing expression" time="{duration}"/> <testcase classname="global" name="Where the is more to the expression after the RHS[failing]" time="{duration}"/>
<testcase classname="global" name="./inprogress/failing/Tricky/compound lhs" time="{duration}"/> <testcase classname="global" name="Where the LHS is not a simple value[failing]" time="{duration}"/>
<testcase classname="global" name="./failing/Tricky/non streamable type" time="{duration}"> <testcase classname="global" name="A failing expression with a non streamable type is still captured[failing]" time="{duration}">
<failure message="0x<hex digits> == 0x<hex digits>" type="CHECK"> <failure message="0x<hex digits> == 0x<hex digits>" type="CHECK">
TrickyTests.cpp:<line number> TrickyTests.cpp:<line number>
</failure> </failure>
@ -504,22 +486,22 @@ TrickyTests.cpp:<line number>
TrickyTests.cpp:<line number> TrickyTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./failing/string literals" time="{duration}"> <testcase classname="global" name="string literals of different sizes can be compared[failing]" time="{duration}">
<failure message="&quot;first&quot; == &quot;second&quot;" type="REQUIRE"> <failure message="&quot;first&quot; == &quot;second&quot;" type="REQUIRE">
TrickyTests.cpp:<line number> TrickyTests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="global" name="./succeeding/side-effects" time="{duration}"/> <testcase classname="global" name="An expression with side-effects should only be evaluated once" time="{duration}"/>
<testcase classname="global" name="./succeeding/koenig" time="{duration}"/> <testcase classname="global" name="Operators at different namespace levels not hijacked by Koenig lookup" time="{duration}"/>
<testcase classname="global" name="./succeeding/non-const==" time="{duration}"/> <testcase classname="global" name="Demonstrate that a non-const == is not used" time="{duration}"/>
<testcase classname="global" name="./succeeding/enum/bits" time="{duration}"/> <testcase classname="global" name="Test enum bit values" time="{duration}"/>
<testcase classname="global" name="./succeeding/boolean member" time="{duration}"/> <testcase classname="global" name="boolean member" time="{duration}"/>
<testcase classname="./succeeding/unimplemented static bool" name="compare to true" time="{duration}"/> <testcase classname="(unimplemented) static bools can be evaluated" name="compare to true" time="{duration}"/>
<testcase classname="./succeeding/unimplemented static bool" name="compare to false" time="{duration}"/> <testcase classname="(unimplemented) static bools can be evaluated" name="compare to false" time="{duration}"/>
<testcase classname="./succeeding/unimplemented static bool" name="negation" time="{duration}"/> <testcase classname="(unimplemented) static bools can be evaluated" name="negation" time="{duration}"/>
<testcase classname="./succeeding/unimplemented static bool" name="double negation" time="{duration}"/> <testcase classname="(unimplemented) static bools can be evaluated" name="double negation" time="{duration}"/>
<testcase classname="./succeeding/unimplemented static bool" name="direct" time="{duration}"/> <testcase classname="(unimplemented) static bools can be evaluated" name="direct" time="{duration}"/>
<testcase classname="global" name="./succeeding/SafeBool" time="{duration}"/> <testcase classname="global" name="Objects that evaluated in boolean contexts can be checked" time="{duration}"/>
<testcase classname="Assertions then sections" name="root" time="{duration}"/> <testcase classname="Assertions then sections" name="root" time="{duration}"/>
<testcase classname="Assertions then sections" name="A section" time="{duration}"/> <testcase classname="Assertions then sections" name="A section" time="{duration}"/>
<testcase classname="Assertions then sections" name="A section/Another section" time="{duration}"/> <testcase classname="Assertions then sections" name="A section/Another section" time="{duration}"/>
@ -563,18 +545,10 @@ TrickyTests.cpp:<line number>
Message from section one Message from section one
Message from section two Message from section two
Some information Some information
Message from section one
Message from section two
Some information
Message from section one
Message from section two
Some information
hello hello
hello hello
</system-out> </system-out>
<system-err> <system-err>
An error
An error
An error An error
</system-err> </system-err>
</testsuite> </testsuite>

View File

@ -1,6 +1,6 @@
<Catch name="CatchSelfTest"> <Catch name="CatchSelfTest">
<Group name="~_"> <Group name="~_">
<TestCase name="./succeeding/Approx/simple"> <TestCase name="Some simple comparisons between doubles">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
<Original> <Original>
d == Approx( 1.23 ) d == Approx( 1.23 )
@ -51,7 +51,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/Approx/epsilon"> <TestCase name="Approximate comparisons with different epsilons">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
<Original> <Original>
d != Approx( 1.231 ) d != Approx( 1.231 )
@ -70,7 +70,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/Approx/float"> <TestCase name="Approximate comparisons with floats">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
<Original> <Original>
1.23f == Approx( 1.23f ) 1.23f == Approx( 1.23f )
@ -89,7 +89,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/Approx/int"> <TestCase name="Approximate comparisons with ints">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
<Original> <Original>
1 == Approx( 1 ) 1 == Approx( 1 )
@ -108,7 +108,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/Approx/mixed"> <TestCase name="Approximate comparisons with mixed numeric types">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
<Original> <Original>
1.0f == Approx( 1 ) 1.0f == Approx( 1 )
@ -151,7 +151,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/Approx/custom"> <TestCase name="Use a custom approx">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
<Original> <Original>
d == approx( 1.23 ) d == approx( 1.23 )
@ -237,7 +237,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/TestClass/succeedingCase"> <TestCase name="A METHOD_AS_TEST_CASE based test run that succeeds">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ClassTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ClassTests.cpp" >
<Original> <Original>
s == &quot;hello&quot; s == &quot;hello&quot;
@ -248,7 +248,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/TestClass/failingCase"> <TestCase name="A METHOD_AS_TEST_CASE based test run that fails">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ClassTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ClassTests.cpp" >
<Original> <Original>
s == &quot;world&quot; s == &quot;world&quot;
@ -259,7 +259,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/Fixture/succeedingCase"> <TestCase name="A TEST_CASE_METHOD based test run that succeeds">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ClassTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ClassTests.cpp" >
<Original> <Original>
m_a == 1 m_a == 1
@ -270,7 +270,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/Fixture/failingCase"> <TestCase name="A TEST_CASE_METHOD based test run that fails">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ClassTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ClassTests.cpp" >
<Original> <Original>
m_a == 2 m_a == 2
@ -281,7 +281,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/conditions/equality"> <TestCase name="Equality checks that should succeed">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
<Original> <Original>
data.int_seven == 7 data.int_seven == 7
@ -340,7 +340,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/conditions/equality"> <TestCase name="Equality checks that should fail]">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
<Original> <Original>
data.int_seven == 6 data.int_seven == 6
@ -447,7 +447,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/conditions/inequality"> <TestCase name="Inequality checks that should succeed">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
<Original> <Original>
data.int_seven != 6 data.int_seven != 6
@ -538,7 +538,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/conditions/inequality"> <TestCase name="Inequality checks that should fails">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
<Original> <Original>
data.int_seven != 7 data.int_seven != 7
@ -581,7 +581,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/conditions/ordered"> <TestCase name="Ordering comparison checks that should succeed">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
<Original> <Original>
data.int_seven &lt; 8 data.int_seven &lt; 8
@ -720,7 +720,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/conditions/ordered"> <TestCase name="Ordering comparison checks that should fail">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
<Original> <Original>
data.int_seven > 7 data.int_seven > 7
@ -875,7 +875,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/conditions/int literals"> <TestCase name="Comparisons with int literals don't warn when mixing signed/ unsigned">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
<Original> <Original>
i == 1 i == 1
@ -982,7 +982,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/conditions//long_to_unsigned_x"> <TestCase name="comparisons between int variables">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
<Original> <Original>
long_var == unsigned_char_var long_var == unsigned_char_var
@ -1017,7 +1017,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/conditions/const ints to int literal"> <TestCase name="comparisons between const int variables">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
<Original> <Original>
unsigned_char_var == 1 unsigned_char_var == 1
@ -1052,7 +1052,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/conditions/negative ints"> <TestCase name="Comparisons between unsigned ints and negative signed ints match c++ standard behaviour">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
<Original> <Original>
( -1 > 2u ) ( -1 > 2u )
@ -1103,7 +1103,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/conditions/computed ints"> <TestCase name="Comparisons between ints where one side is computed">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
<Original> <Original>
54 == 6*9 54 == 6*9
@ -1114,7 +1114,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/conditions/ptr"> <TestCase name="Pointers can be compared to null">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
<Original> <Original>
p == __null p == __null
@ -1181,7 +1181,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/conditions/not"> <TestCase name="'Not' checks that should succeed">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
<Original> <Original>
false == false false == false
@ -1248,7 +1248,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/conditions/not"> <TestCase name="'Not' checks that should fail">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
<Original> <Original>
false != false false != false
@ -1315,7 +1315,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/exceptions/explicit"> <TestCase name="When checked exceptions are thrown they can be expected or unexpected">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" >
<Original> <Original>
thisThrows() thisThrows()
@ -1342,7 +1342,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/exceptions/explicit"> <TestCase name="Expected exceptions that don't throw or unexpected exceptions fail the test">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" >
<Original> <Original>
thisThrows() thisThrows()
@ -1375,13 +1375,13 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./failing/exceptions/implicit"> <TestCase name="When unchecked exceptions are thrown directly they are always failures">
<Exception filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" > <Exception filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" >
unexpected exception unexpected exception
</Exception> </Exception>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./failing/exceptions/implicit/2"> <TestCase name="An unchecked exception reports the line of the last assertion">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" >
<Original> <Original>
1 == 1 1 == 1
@ -1403,7 +1403,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./failing/exceptions/implicit/3"> <TestCase name="When unchecked exceptions are thrown from sections they are always failures">
<Section name="section name"> <Section name="section name">
<Exception filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" > <Exception filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" >
unexpected exception unexpected exception
@ -1412,7 +1412,7 @@
</Section> </Section>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./failing/exceptions/implicit/4"> <TestCase name="When unchecked exceptions are thrown from functions they are always failures">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" >
<Original> <Original>
thisThrows() == 0 thisThrows() == 0
@ -1426,16 +1426,16 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/exceptions/implicit"> <TestCase name="When unchecked exceptions are thrown, but caught, they do not affect the test">
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/exceptions/custom"> <TestCase name="Unexpected custom exceptions can be translated">
<Exception filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" > <Exception filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" >
custom exception custom exception
</Exception> </Exception>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./failing/exceptions/custom/nothrow"> <TestCase name="Custom exceptions can be translated when testing for nothrow">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" >
<Original> <Original>
throwCustom() throwCustom()
@ -1449,7 +1449,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./failing/exceptions/custom/throw"> <TestCase name="Custom exceptions can be translated when testing for throwing as something else">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" >
<Original> <Original>
throwCustom() throwCustom()
@ -1463,13 +1463,13 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./failing/exceptions/custom/double"> <TestCase name="Unexpected exceptions can be translated">
<Exception filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" > <Exception filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" >
3.14 3.14
</Exception> </Exception>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/exceptions/notimplemented"> <TestCase name="NotImplemented exception">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" >
<Original> <Original>
thisFunctionNotImplemented( 7 ) thisFunctionNotImplemented( 7 )
@ -1480,7 +1480,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/generators/1"> <TestCase name="Generators over two ranges">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/GeneratorTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/GeneratorTests.cpp" >
<Original> <Original>
multiply( i, 2 ) == i*2 multiply( i, 2 ) == i*2
@ -2635,7 +2635,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/generators/2"> <TestCase name="Generator over a range of pairs">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/GeneratorTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/GeneratorTests.cpp" >
<Original> <Original>
i->first == i->second-1 i->first == i->second-1
@ -2654,7 +2654,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/message"> <TestCase name="INFO and WARN do not abort tests">
<Info> <Info>
this is a message this is a message
</Info> </Info>
@ -2663,10 +2663,10 @@
</Warning> </Warning>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/succeed"> <TestCase name="SUCCEED counts as a test pass">
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/message/info/1"> <TestCase name="INFO gets logged on failure">
<Info> <Info>
this message should be logged this message should be logged
</Info> </Info>
@ -2683,7 +2683,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./mixed/message/info/2"> <TestCase name="INFO gets logged on failure, even if captured before successful assertions">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MessageTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MessageTests.cpp" >
<Original> <Original>
a == 2 a == 2
@ -2724,13 +2724,13 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./failing/message/fail"> <TestCase name="FAIL aborts the test">
<Failure> <Failure>
This is a failure This is a failure
</Failure> </Failure>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./failing/message/sections"> <TestCase name="Output from all sections is reported">
<Section name="one"> <Section name="one">
<Failure> <Failure>
Message from section one Message from section one
@ -2745,7 +2745,7 @@
</Section> </Section>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/message/sections/stdout"> <TestCase name="Standard output from all sections is reported">
<Section name="one"> <Section name="one">
<OverallResults successes="0" failures="1"/> <OverallResults successes="0" failures="1"/>
</Section> </Section>
@ -2754,7 +2754,7 @@
</Section> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./mixed/message/scoped"> <TestCase name="SCOPED_INFO is reset for each loop">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MessageTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MessageTests.cpp" >
<Original> <Original>
i &lt; 10 i &lt; 10
@ -2851,7 +2851,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/nofail"> <TestCase name="The NO_FAIL macro reports a failure but does not fail the test">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MessageTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MessageTests.cpp" >
<Original> <Original>
1 == 2 1 == 2
@ -2871,7 +2871,24 @@
</Failure> </Failure>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/Misc/Sections"> <TestCase name="sends information to INFO">
<Info>
hi
</Info>
<Info>
i := 7
</Info>
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MessageTests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false"/>
</TestCase>
<TestCase name="random SECTION tests">
<Section name="s1" description="doesn't equal"> <Section name="s1" description="doesn't equal">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
@ -2904,7 +2921,7 @@
</Section> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/Misc/Sections/nested"> <TestCase name="nested SECTION tests">
<Section name="s1" description="doesn't equal"> <Section name="s1" description="doesn't equal">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
@ -2956,7 +2973,7 @@
</Section> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./mixed/Misc/Sections/nested2"> <TestCase name="more nested SECTION tests">
<Section name="s1" description="doesn't equal"> <Section name="s1" description="doesn't equal">
<OverallResults successes="0" failures="0"/> <OverallResults successes="0" failures="0"/>
</Section> </Section>
@ -3004,7 +3021,7 @@
</Section> </Section>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./Sections/nested/a/b"> <TestCase name="even more nested SECTION tests">
<Section name="c"> <Section name="c">
<OverallResults successes="0" failures="0"/> <OverallResults successes="0" failures="0"/>
</Section> </Section>
@ -3025,7 +3042,7 @@
</Section> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./mixed/Misc/Sections/loops"> <TestCase name="looped SECTION tests">
<Section name="s1" description="b is currently: 0"> <Section name="s1" description="b is currently: 0">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
@ -3039,7 +3056,7 @@
</Section> </Section>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./mixed/Misc/loops"> <TestCase name="looped tests">
<Info> <Info>
Testing if fib[0] (1) is even Testing if fib[0] (1) is even
</Info> </Info>
@ -3124,10 +3141,10 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/Misc/stdout,stderr"> <TestCase name="Sends stuff to stdout and stderr">
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/Misc/null strings"> <TestCase name="null strings">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
makeString( false ) != static_cast&lt;char*>(__null) makeString( false ) != static_cast&lt;char*>(__null)
@ -3146,24 +3163,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/info"> <TestCase name="checkedIf">
<Info>
hi
</Info>
<Info>
i := 7
</Info>
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false"/>
</TestCase>
<TestCase name="./succeeding/checkedif">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
flag flag
@ -3182,7 +3182,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/checkedif"> <TestCase name="checkedIf, failing">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
flag flag
@ -3201,7 +3201,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/checkedelse"> <TestCase name="checkedElse">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
flag flag
@ -3220,7 +3220,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/checkedelse"> <TestCase name="checkedElse, failing">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
flag flag
@ -3239,7 +3239,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./misc/xmlentitycheck"> <TestCase name="xmlentitycheck">
<Section name="embedded xml" description="&lt;test>it should be possible to embed xml characters, such as &lt;, &quot; or &amp;, or even whole &lt;xml>documents&lt;/xml> within an attribute&lt;/test>"> <Section name="embedded xml" description="&lt;test>it should be possible to embed xml characters, such as &lt;, &quot; or &amp;, or even whole &lt;xml>documents&lt;/xml> within an attribute&lt;/test>">
<OverallResults successes="0" failures="1"/> <OverallResults successes="0" failures="1"/>
</Section> </Section>
@ -3248,7 +3248,7 @@
</Section> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./manual/onechar"> <TestCase name="send a single char to INFO">
<Info> <Info>
3 3
</Info> </Info>
@ -3262,7 +3262,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/atomic if"> <TestCase name="atomic if">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
x == 0 x == 0
@ -3273,7 +3273,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/matchers"> <TestCase name="String matchers">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() Contains( &quot;string&quot; ) testStringForMatching() Contains( &quot;string&quot; )
@ -3308,7 +3308,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/matchers/Contains"> <TestCase name="Contains string matcher">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() Contains( &quot;not there&quot; ) testStringForMatching() Contains( &quot;not there&quot; )
@ -3319,7 +3319,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./failing/matchers/StartsWith"> <TestCase name="StartsWith string matcher">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() StartsWith( &quot;string&quot; ) testStringForMatching() StartsWith( &quot;string&quot; )
@ -3330,7 +3330,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./failing/matchers/EndsWith"> <TestCase name="EndsWith string matcher">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() EndsWith( &quot;this&quot; ) testStringForMatching() EndsWith( &quot;this&quot; )
@ -3341,7 +3341,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./failing/matchers/Equals"> <TestCase name="Equals string matcher">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() Equals( &quot;something else&quot; ) testStringForMatching() Equals( &quot;something else&quot; )
@ -3352,7 +3352,7 @@
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="string"> <TestCase name="Equals string matcher, with NULL">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
&quot;&quot; Equals(__null) &quot;&quot; Equals(__null)
@ -3363,7 +3363,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/matchers/AllOf"> <TestCase name="AllOf matcher">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() AllOf( Catch::Contains( &quot;string&quot; ), Catch::Contains( &quot;abc&quot; ) ) testStringForMatching() AllOf( Catch::Contains( &quot;string&quot; ), Catch::Contains( &quot;abc&quot; ) )
@ -3374,7 +3374,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/matchers/AnyOf"> <TestCase name="AnyOf matcher">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() AnyOf( Catch::Contains( &quot;string&quot; ), Catch::Contains( &quot;not there&quot; ) ) testStringForMatching() AnyOf( Catch::Contains( &quot;string&quot; ), Catch::Contains( &quot;not there&quot; ) )
@ -3393,7 +3393,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/matchers/Equals"> <TestCase name="Equals">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() Equals( &quot;this string contains 'abc' as a substring&quot; ) testStringForMatching() Equals( &quot;this string contains 'abc' as a substring&quot; )
@ -3447,7 +3447,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="empty"> <TestCase name="An empty test with no assertions">
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="Nice descriptive name"> <TestCase name="Nice descriptive name">
@ -3667,7 +3667,7 @@
</Section> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/CatchSectionInfiniteLoop"> <TestCase name="A couple of nested sections followed by a failure">
<Failure> <Failure>
to infinity and beyond to infinity and beyond
</Failure> </Failure>
@ -3688,90 +3688,6 @@
</Failure> </Failure>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="selftest/main">
<Section name="selftest/expected result" description="Tests do what they claim">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="selftest/expected result" description="Tests do what they claim">
<Section name="selftest/expected result/failing tests" description="Tests in the 'failing' branch fail">
<OverallResults successes="28" failures="0"/>
</Section>
<OverallResults successes="28" failures="0"/>
</Section>
<Section name="selftest/expected result" description="Tests do what they claim">
<Section name="selftest/expected result/succeeding tests" description="Tests in the 'succeeding' branch succeed">
<OverallResults successes="46" failures="0"/>
</Section>
<OverallResults successes="46" failures="0"/>
</Section>
<Section name="selftest/test counts" description="Number of test cases that run is fixed">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="selftest/test counts" description="Number of test cases that run is fixed">
<Section name="selftest/test counts/succeeding tests" description="Number of 'succeeding' tests is fixed">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
<Original>
totals.assertions.passed == 298
</Original>
<Expanded>
298 == 298
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
<Original>
totals.assertions.failed == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<OverallResults successes="2" failures="0"/>
</Section>
<OverallResults successes="2" failures="0"/>
</Section>
<Section name="selftest/test counts" description="Number of test cases that run is fixed">
<Section name="selftest/test counts/failing tests" description="Number of 'failing' tests is fixed">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
<Original>
totals.assertions.passed == 2
</Original>
<Expanded>
2 == 2
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
<Original>
totals.assertions.failed == 77
</Original>
<Expanded>
77 == 77
</Expanded>
</Expression>
<OverallResults successes="2" failures="0"/>
</Section>
<OverallResults successes="2" failures="0"/>
</Section>
<OverallResult success="true"/>
</TestCase>
<TestCase name="meta/Misc/Sections">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
<Original>
totals.assertions.passed == 2
</Original>
<Expanded>
2 == 2
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
<Original>
totals.assertions.failed == 1
</Original>
<Expanded>
1 == 1
</Expanded>
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="Process can be configured on command line"> <TestCase name="Process can be configured on command line">
<Section name="default - no arguments"> <Section name="default - no arguments">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@ -6374,7 +6290,7 @@ there&quot;
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/Tricky/std::pair"> <TestCase name="Parsing a std::pair">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original> <Original>
(std::pair&lt;int, int>( 1, 2 )) == aNicePair (std::pair&lt;int, int>( 1, 2 )) == aNicePair
@ -6385,19 +6301,19 @@ there&quot;
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./inprogress/failing/Tricky/trailing expression"> <TestCase name="Where the is more to the expression after the RHS[failing]">
<Warning> <Warning>
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
</Warning> </Warning>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./inprogress/failing/Tricky/compound lhs"> <TestCase name="Where the LHS is not a simple value[failing]">
<Warning> <Warning>
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
</Warning> </Warning>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./failing/Tricky/non streamable type"> <TestCase name="A failing expression with a non streamable type is still captured[failing]">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original> <Original>
&amp;o1 == &amp;o2 &amp;o1 == &amp;o2
@ -6416,7 +6332,7 @@ there&quot;
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./failing/string literals"> <TestCase name="string literals of different sizes can be compared[failing]">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" > <Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original> <Original>
std::string( &quot;first&quot; ) == &quot;second&quot; std::string( &quot;first&quot; ) == &quot;second&quot;
@ -6427,7 +6343,7 @@ there&quot;
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/side-effects"> <TestCase name="An expression with side-effects should only be evaluated once">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original> <Original>
i++ == 7 i++ == 7
@ -6446,7 +6362,7 @@ there&quot;
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/koenig"> <TestCase name="Operators at different namespace levels not hijacked by Koenig lookup">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original> <Original>
0x<hex digits> == o 0x<hex digits> == o
@ -6457,7 +6373,7 @@ there&quot;
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/non-const=="> <TestCase name="Demonstrate that a non-const == is not used">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original> <Original>
t == 1u t == 1u
@ -6468,7 +6384,7 @@ there&quot;
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/enum/bits"> <TestCase name="Test enum bit values">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original> <Original>
0x<hex digits> == bit30and31 0x<hex digits> == bit30and31
@ -6479,7 +6395,7 @@ there&quot;
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/boolean member"> <TestCase name="boolean member">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original> <Original>
obj.prop != __null obj.prop != __null
@ -6490,7 +6406,7 @@ there&quot;
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/unimplemented static bool"> <TestCase name="(unimplemented) static bools can be evaluated">
<Section name="compare to true"> <Section name="compare to true">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original> <Original>
@ -6572,7 +6488,7 @@ there&quot;
</Section> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="./succeeding/SafeBool"> <TestCase name="Objects that evaluated in boolean contexts can be checked">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" > <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original> <Original>
True True
@ -7482,7 +7398,7 @@ there&quot;
</Section> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<OverallResults successes="663" failures="109"/> <OverallResults successes="583" failures="109"/>
</Group> </Group>
<OverallResults successes="663" failures="109"/> <OverallResults successes="583" failures="109"/>
</Catch> </Catch>

View File

@ -28,8 +28,8 @@ public:
}; };
// Note: TestClass conflicts with template class with same name in VS2012 native tests // Note: TestClass conflicts with template class with same name in VS2012 native tests
METHOD_AS_TEST_CASE( TestClass::succeedingCase, "./succeeding/TestClass/succeedingCase", "A method based test run that succeeds [class]" ) METHOD_AS_TEST_CASE( ::TestClass::succeedingCase, "A METHOD_AS_TEST_CASE based test run that succeeds", "[class]" )
METHOD_AS_TEST_CASE( TestClass::failingCase, "./failing/TestClass/failingCase", "A method based test run that fails [class]" ) METHOD_AS_TEST_CASE( ::TestClass::failingCase, "A METHOD_AS_TEST_CASE based test run that fails", "[.][class][failing]" )
struct Fixture struct Fixture
{ {
@ -38,7 +38,7 @@ struct Fixture
int m_a; int m_a;
}; };
TEST_CASE_METHOD( Fixture, "./succeeding/Fixture/succeedingCase", "A method based test run that succeeds [class]" ) TEST_CASE_METHOD( Fixture, "A TEST_CASE_METHOD based test run that succeeds", "[class]" )
{ {
REQUIRE( m_a == 1 ); REQUIRE( m_a == 1 );
} }
@ -46,7 +46,7 @@ TEST_CASE_METHOD( Fixture, "./succeeding/Fixture/succeedingCase", "A method base
// We should be able to write our tests within a different namespace // We should be able to write our tests within a different namespace
namespace Inner namespace Inner
{ {
TEST_CASE_METHOD( Fixture, "./failing/Fixture/failingCase", "A method based test run that fails [class]" ) TEST_CASE_METHOD( Fixture, "A TEST_CASE_METHOD based test run that fails", "[.][class][failing]" )
{ {
REQUIRE( m_a == 2 ); REQUIRE( m_a == 2 );
} }

View File

@ -14,7 +14,10 @@
#include <string> #include <string>
#include <limits> #include <limits>
struct TestData { namespace ConditionTests
{
struct TestData {
TestData() TestData()
: int_seven( 7 ), : int_seven( 7 ),
str_hello( "hello" ), str_hello( "hello" ),
@ -26,10 +29,10 @@ struct TestData {
std::string str_hello; std::string str_hello;
float float_nine_point_one; float float_nine_point_one;
double double_pi; double double_pi;
}; };
struct TestDef { struct TestDef {
TestDef& operator + ( const std::string& ) { TestDef& operator + ( const std::string& ) {
return *this; return *this;
} }
@ -37,15 +40,14 @@ struct TestDef {
return *this; return *this;
} }
}; };
// The "failing" tests all use the CHECK macro, which continues if the specific test fails. // The "failing" tests all use the CHECK macro, which continues if the specific test fails.
// This allows us to see all results, even if an earlier check fails // This allows us to see all results, even if an earlier check fails
// Equality tests // Equality tests
TEST_CASE( "./succeeding/conditions/equality", TEST_CASE( "Equality checks that should succeed", "" )
"Equality checks that should succeed" ) {
{
TestDef td; TestDef td;
td + "hello" + "hello"; td + "hello" + "hello";
@ -61,11 +63,10 @@ TEST_CASE( "./succeeding/conditions/equality",
double x = 1.1 + 0.1 + 0.1; double x = 1.1 + 0.1 + 0.1;
REQUIRE( x == Approx( 1.3 ) ); REQUIRE( x == Approx( 1.3 ) );
} }
TEST_CASE( "./failing/conditions/equality", TEST_CASE( "Equality checks that should fail]", "[.][failing]" )
"Equality checks that should fail" ) {
{
TestData data; TestData data;
CHECK( data.int_seven == 6 ); CHECK( data.int_seven == 6 );
@ -83,11 +84,10 @@ TEST_CASE( "./failing/conditions/equality",
double x = 1.1 + 0.1 + 0.1; double x = 1.1 + 0.1 + 0.1;
CHECK( x == Approx( 1.301 ) ); CHECK( x == Approx( 1.301 ) );
} }
TEST_CASE( "./succeeding/conditions/inequality", TEST_CASE( "Inequality checks that should succeed", "" )
"Inequality checks that should succeed" ) {
{
TestData data; TestData data;
REQUIRE( data.int_seven != 6 ); REQUIRE( data.int_seven != 6 );
@ -101,11 +101,10 @@ TEST_CASE( "./succeeding/conditions/inequality",
REQUIRE( data.str_hello != "hell" ); REQUIRE( data.str_hello != "hell" );
REQUIRE( data.str_hello != "hello1" ); REQUIRE( data.str_hello != "hello1" );
REQUIRE( data.str_hello.size() != 6 ); REQUIRE( data.str_hello.size() != 6 );
} }
TEST_CASE( "./failing/conditions/inequality", TEST_CASE( "Inequality checks that should fails", "[.][failing]" )
"Inequality checks that should fails" ) {
{
TestData data; TestData data;
CHECK( data.int_seven != 7 ); CHECK( data.int_seven != 7 );
@ -113,12 +112,11 @@ TEST_CASE( "./failing/conditions/inequality",
CHECK( data.double_pi != Approx( 3.1415926535 ) ); CHECK( data.double_pi != Approx( 3.1415926535 ) );
CHECK( data.str_hello != "hello" ); CHECK( data.str_hello != "hello" );
CHECK( data.str_hello.size() != 5 ); CHECK( data.str_hello.size() != 5 );
} }
// Ordering comparison tests // Ordering comparison tests
TEST_CASE( "./succeeding/conditions/ordered", TEST_CASE( "Ordering comparison checks that should succeed", "" )
"Ordering comparison checks that should succeed" ) {
{
TestData data; TestData data;
REQUIRE( data.int_seven < 8 ); REQUIRE( data.int_seven < 8 );
@ -142,11 +140,10 @@ TEST_CASE( "./succeeding/conditions/ordered",
REQUIRE( data.str_hello < "zebra" ); REQUIRE( data.str_hello < "zebra" );
REQUIRE( data.str_hello > "hellm" ); REQUIRE( data.str_hello > "hellm" );
REQUIRE( data.str_hello > "a" ); REQUIRE( data.str_hello > "a" );
} }
TEST_CASE( "./failing/conditions/ordered", TEST_CASE( "Ordering comparison checks that should fail", "[.][failing]" )
"Ordering comparison checks that should fail" ) {
{
TestData data; TestData data;
CHECK( data.int_seven > 7 ); CHECK( data.int_seven > 7 );
@ -172,12 +169,11 @@ TEST_CASE( "./failing/conditions/ordered",
CHECK( data.str_hello >= "z" ); CHECK( data.str_hello >= "z" );
CHECK( data.str_hello <= "a" ); CHECK( data.str_hello <= "a" );
} }
// Comparisons with int literals // Comparisons with int literals
TEST_CASE( "./succeeding/conditions/int literals", TEST_CASE( "Comparisons with int literals don't warn when mixing signed/ unsigned", "" )
"Comparisons with int literals don't warn when mixing signed/ unsigned" ) {
{
int i = 1; int i = 1;
unsigned int ui = 2; unsigned int ui = 2;
long l = 3; long l = 3;
@ -200,7 +196,7 @@ TEST_CASE( "./succeeding/conditions/int literals",
REQUIRE( 6 == uc ); REQUIRE( 6 == uc );
REQUIRE( (std::numeric_limits<unsigned long>::max)() > ul ); REQUIRE( (std::numeric_limits<unsigned long>::max)() > ul );
} }
// Disable warnings about sign conversions for the next two tests // Disable warnings about sign conversions for the next two tests
// (as we are deliberately invoking them) // (as we are deliberately invoking them)
@ -214,9 +210,8 @@ TEST_CASE( "./succeeding/conditions/int literals",
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch #pragma warning(disable:4389) // '==' : signed/unsigned mismatch
#endif #endif
TEST_CASE( "./succeeding/conditions//long_to_unsigned_x", TEST_CASE( "comparisons between int variables", "" )
"comparisons between int variables" ) {
{
long long_var = 1L; long long_var = 1L;
unsigned char unsigned_char_var = 1; unsigned char unsigned_char_var = 1;
unsigned short unsigned_short_var = 1; unsigned short unsigned_short_var = 1;
@ -227,11 +222,10 @@ TEST_CASE( "./succeeding/conditions//long_to_unsigned_x",
REQUIRE( long_var == unsigned_short_var ); REQUIRE( long_var == unsigned_short_var );
REQUIRE( long_var == unsigned_int_var ); REQUIRE( long_var == unsigned_int_var );
REQUIRE( long_var == unsigned_long_var ); REQUIRE( long_var == unsigned_long_var );
} }
TEST_CASE( "./succeeding/conditions/const ints to int literal", TEST_CASE( "comparisons between const int variables", "" )
"comparisons between const int variables" ) {
{
const unsigned char unsigned_char_var = 1; const unsigned char unsigned_char_var = 1;
const unsigned short unsigned_short_var = 1; const unsigned short unsigned_short_var = 1;
const unsigned int unsigned_int_var = 1; const unsigned int unsigned_int_var = 1;
@ -241,11 +235,10 @@ TEST_CASE( "./succeeding/conditions/const ints to int literal",
REQUIRE( unsigned_short_var == 1 ); REQUIRE( unsigned_short_var == 1 );
REQUIRE( unsigned_int_var == 1 ); REQUIRE( unsigned_int_var == 1 );
REQUIRE( unsigned_long_var == 1 ); REQUIRE( unsigned_long_var == 1 );
} }
TEST_CASE( "./succeeding/conditions/negative ints", TEST_CASE( "Comparisons between unsigned ints and negative signed ints match c++ standard behaviour", "" )
"Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" ) {
{
CHECK( ( -1 > 2u ) ); CHECK( ( -1 > 2u ) );
CHECK( -1 > 2u ); CHECK( -1 > 2u );
@ -255,22 +248,21 @@ TEST_CASE( "./succeeding/conditions/negative ints",
const int minInt = (std::numeric_limits<int>::min)(); const int minInt = (std::numeric_limits<int>::min)();
CHECK( ( minInt > 2u ) ); CHECK( ( minInt > 2u ) );
CHECK( minInt > 2u ); CHECK( minInt > 2u );
} }
template<typename T> template<typename T>
struct Ex struct Ex
{ {
Ex( T ){} Ex( T ){}
bool operator == ( const T& ) const { return true; } bool operator == ( const T& ) const { return true; }
T operator * ( const T& ) const { return T(); } T operator * ( const T& ) const { return T(); }
}; };
TEST_CASE( "./succeeding/conditions/computed ints", TEST_CASE( "Comparisons between ints where one side is computed", "" )
"Comparisons between ints where one side is computed" ) {
{
CHECK( 54 == 6*9 ); CHECK( 54 == 6*9 );
} }
#ifdef __GNUC__ #ifdef __GNUC__
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
@ -279,9 +271,8 @@ TEST_CASE( "./succeeding/conditions/computed ints",
inline const char* returnsConstNull(){ return NULL; } inline const char* returnsConstNull(){ return NULL; }
inline char* returnsNull(){ return NULL; } inline char* returnsNull(){ return NULL; }
TEST_CASE( "./succeeding/conditions/ptr", TEST_CASE( "Pointers can be compared to null", "" )
"Pointers can be compared to null" ) {
{
TestData* p = NULL; TestData* p = NULL;
TestData* pNULL = NULL; TestData* pNULL = NULL;
@ -303,18 +294,17 @@ TEST_CASE( "./succeeding/conditions/ptr",
REQUIRE( returnsConstNull() == NULL ); REQUIRE( returnsConstNull() == NULL );
REQUIRE( NULL != p ); REQUIRE( NULL != p );
} }
// Not (!) tests // Not (!) tests
// The problem with the ! operator is that it has right-to-left associativity. // The problem with the ! operator is that it has right-to-left associativity.
// This means we can't isolate it when we decompose. The simple REQUIRE( !false ) form, therefore, // This means we can't isolate it when we decompose. The simple REQUIRE( !false ) form, therefore,
// cannot have the operand value extracted. The test will work correctly, and the situation // cannot have the operand value extracted. The test will work correctly, and the situation
// is detected and a warning issued. // is detected and a warning issued.
// An alternative form of the macros (CHECK_FALSE and REQUIRE_FALSE) can be used instead to capture // An alternative form of the macros (CHECK_FALSE and REQUIRE_FALSE) can be used instead to capture
// the operand value. // the operand value.
TEST_CASE( "./succeeding/conditions/not", TEST_CASE( "'Not' checks that should succeed", "" )
"'Not' checks that should succeed" ) {
{
bool falseValue = false; bool falseValue = false;
REQUIRE( false == false ); REQUIRE( false == false );
@ -327,11 +317,10 @@ TEST_CASE( "./succeeding/conditions/not",
REQUIRE( !(1 == 2) ); REQUIRE( !(1 == 2) );
REQUIRE_FALSE( 1 == 2 ); REQUIRE_FALSE( 1 == 2 );
} }
TEST_CASE( "./failing/conditions/not", TEST_CASE( "'Not' checks that should fail", "[.][failing]" )
"'Not' checks that should fail" ) {
{
bool trueValue = true; bool trueValue = true;
CHECK( false != false ); CHECK( false != false );
@ -344,4 +333,5 @@ TEST_CASE( "./failing/conditions/not",
CHECK( !(1 == 1) ); CHECK( !(1 == 1) );
CHECK_FALSE( 1 == 1 ); CHECK_FALSE( 1 == 1 );
}
} }

View File

@ -11,8 +11,6 @@
#include <string> #include <string>
#include <stdexcept> #include <stdexcept>
#include "catch_self_test.hpp"
namespace namespace
{ {
inline int thisThrows() inline int thisThrows()
@ -28,48 +26,50 @@ namespace
} }
} }
TEST_CASE( "./succeeding/exceptions/explicit", "When checked exceptions are thrown they can be expected or unexpected" ) namespace ExceptionTests
{ {
TEST_CASE( "When checked exceptions are thrown they can be expected or unexpected", "" )
{
REQUIRE_THROWS_AS( thisThrows(), std::domain_error ); REQUIRE_THROWS_AS( thisThrows(), std::domain_error );
REQUIRE_NOTHROW( thisDoesntThrow() ); REQUIRE_NOTHROW( thisDoesntThrow() );
REQUIRE_THROWS( thisThrows() ); REQUIRE_THROWS( thisThrows() );
} }
TEST_CASE( "./failing/exceptions/explicit", "When checked exceptions are thrown they can be expected or unexpected" ) TEST_CASE( "Expected exceptions that don't throw or unexpected exceptions fail the test", "[.][failing]" )
{ {
CHECK_THROWS_AS( thisThrows(), std::string ); CHECK_THROWS_AS( thisThrows(), std::string );
CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error ); CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error );
CHECK_NOTHROW( thisThrows() ); CHECK_NOTHROW( thisThrows() );
} }
TEST_CASE( "./failing/exceptions/implicit", "When unchecked exceptions are thrown they are always failures" ) TEST_CASE( "When unchecked exceptions are thrown directly they are always failures", "[.][failing]" )
{ {
if( Catch::isTrue( true ) ) if( Catch::isTrue( true ) )
throw std::domain_error( "unexpected exception" ); throw std::domain_error( "unexpected exception" );
} }
TEST_CASE( "./failing/exceptions/implicit/2", "An unchecked exception reports the line of the last assertion" ) TEST_CASE( "An unchecked exception reports the line of the last assertion", "[.][failing]" )
{ {
CHECK( 1 == 1 ); CHECK( 1 == 1 );
if( Catch::isTrue( true ) ) if( Catch::isTrue( true ) )
throw std::domain_error( "unexpected exception" ); throw std::domain_error( "unexpected exception" );
} }
TEST_CASE( "./failing/exceptions/implicit/3", "When unchecked exceptions are thrown they are always failures" ) TEST_CASE( "When unchecked exceptions are thrown from sections they are always failures", "[.][failing]" )
{ {
SECTION( "section name", "" ) SECTION( "section name", "" )
{ {
if( Catch::isTrue( true ) ) if( Catch::isTrue( true ) )
throw std::domain_error( "unexpected exception" ); throw std::domain_error( "unexpected exception" );
} }
} }
TEST_CASE( "./failing/exceptions/implicit/4", "When unchecked exceptions are thrown they are always failures" ) TEST_CASE( "When unchecked exceptions are thrown from functions they are always failures", "[.][failing]" )
{ {
CHECK( thisThrows() == 0 ); CHECK( thisThrows() == 0 );
} }
TEST_CASE( "./succeeding/exceptions/implicit", "When unchecked exceptions are thrown, but caught, they do not affect the test" ) TEST_CASE( "When unchecked exceptions are thrown, but caught, they do not affect the test", "" )
{ {
try try
{ {
throw std::domain_error( "unexpected exception" ); throw std::domain_error( "unexpected exception" );
@ -77,11 +77,11 @@ TEST_CASE( "./succeeding/exceptions/implicit", "When unchecked exceptions are th
catch(...) catch(...)
{ {
} }
} }
class CustomException class CustomException
{ {
public: public:
CustomException( const std::string& msg ) CustomException( const std::string& msg )
: m_msg( msg ) : m_msg( msg )
{} {}
@ -91,53 +91,54 @@ public:
return m_msg; return m_msg;
} }
private: private:
std::string m_msg; std::string m_msg;
}; };
CATCH_TRANSLATE_EXCEPTION( CustomException& ex ) CATCH_TRANSLATE_EXCEPTION( CustomException& ex )
{ {
return ex.getMessage(); return ex.getMessage();
} }
CATCH_TRANSLATE_EXCEPTION( double& ex ) CATCH_TRANSLATE_EXCEPTION( double& ex )
{ {
return Catch::toString( ex ); return Catch::toString( ex );
} }
TEST_CASE( "./failing/exceptions/custom", "Unexpected custom exceptions can be translated" ) TEST_CASE("Unexpected custom exceptions can be translated", "[.][failing]" )
{ {
if( Catch::isTrue( true ) ) if( Catch::isTrue( true ) )
throw CustomException( "custom exception" ); throw CustomException( "custom exception" );
} }
inline void throwCustom() { inline void throwCustom() {
if( Catch::isTrue( true ) ) if( Catch::isTrue( true ) )
throw CustomException( "custom exception - not std" ); throw CustomException( "custom exception - not std" );
} }
TEST_CASE( "./failing/exceptions/custom/nothrow", "Custom exceptions can be translated when testing for nothrow" ) TEST_CASE( "Custom exceptions can be translated when testing for nothrow", "[.][failing]" )
{ {
REQUIRE_NOTHROW( throwCustom() ); REQUIRE_NOTHROW( throwCustom() );
} }
TEST_CASE( "./failing/exceptions/custom/throw", "Custom exceptions can be translated when testing for throwing as something else" ) TEST_CASE( "Custom exceptions can be translated when testing for throwing as something else", "[.][failing]" )
{ {
REQUIRE_THROWS_AS( throwCustom(), std::exception ); REQUIRE_THROWS_AS( throwCustom(), std::exception );
} }
TEST_CASE( "./failing/exceptions/custom/double", "Unexpected custom exceptions can be translated" ) TEST_CASE( "Unexpected exceptions can be translated", "[.][failing]" )
{ {
if( Catch::isTrue( true ) ) if( Catch::isTrue( true ) )
throw double( 3.14 ); throw double( 3.14 );
} }
inline int thisFunctionNotImplemented( int ) { inline int thisFunctionNotImplemented( int ) {
CATCH_NOT_IMPLEMENTED; CATCH_NOT_IMPLEMENTED;
} }
TEST_CASE( "./succeeding/exceptions/notimplemented", "" ) TEST_CASE( "NotImplemented exception", "" )
{ {
REQUIRE_THROWS( thisFunctionNotImplemented( 7 ) ); REQUIRE_THROWS( thisFunctionNotImplemented( 7 ) );
}
} }

View File

@ -11,13 +11,15 @@
#define CATCH_CONFIG_PREFIX_ALL #define CATCH_CONFIG_PREFIX_ALL
#include "catch.hpp" #include "catch.hpp"
inline int multiply( int a, int b ) namespace GeneratorTests
{ {
inline int multiply( int a, int b )
{
return a*b; return a*b;
} }
CATCH_TEST_CASE( "./succeeding/generators/1", "Generators over two ranges" ) CATCH_TEST_CASE( "Generators over two ranges", "[generators]" )
{ {
using namespace Catch::Generators; using namespace Catch::Generators;
int i = CATCH_GENERATE( between( 1, 5 ).then( values( 15, 20, 21 ).then( 36 ) ) ); int i = CATCH_GENERATE( between( 1, 5 ).then( values( 15, 20, 21 ).then( 36 ) ) );
@ -25,12 +27,12 @@ CATCH_TEST_CASE( "./succeeding/generators/1", "Generators over two ranges" )
CATCH_REQUIRE( multiply( i, 2 ) == i*2 ); CATCH_REQUIRE( multiply( i, 2 ) == i*2 );
CATCH_REQUIRE( multiply( j, 2 ) == j*2 ); CATCH_REQUIRE( multiply( j, 2 ) == j*2 );
} }
struct IntPair { int first, second; }; struct IntPair { int first, second; };
CATCH_TEST_CASE( "./succeeding/generators/2", "Generator over a range of pairs" ) CATCH_TEST_CASE( "Generator over a range of pairs", "[generators]" )
{ {
using namespace Catch::Generators; using namespace Catch::Generators;
IntPair p[] = { { 0, 1 }, { 2, 3 } }; IntPair p[] = { { 0, 1 }, { 2, 3 } };
@ -39,4 +41,5 @@ CATCH_TEST_CASE( "./succeeding/generators/2", "Generator over a range of pairs"
CATCH_REQUIRE( i->first == i->second-1 ); CATCH_REQUIRE( i->first == i->second-1 );
}
} }

View File

@ -8,26 +8,29 @@
#include "catch.hpp" #include "catch.hpp"
TEST_CASE( "./succeeding/message", "INFO and WARN do not abort tests" ) namespace MessageTests
{ {
TEST_CASE( "INFO and WARN do not abort tests", "[messages]" )
{
INFO( "this is a " << "message" ); // This should output the message if a failure occurs INFO( "this is a " << "message" ); // This should output the message if a failure occurs
WARN( "this is a " << "warning" ); // This should always output the message but then continue WARN( "this is a " << "warning" ); // This should always output the message but then continue
} }
TEST_CASE( "./succeeding/succeed", "SUCCEED counts as a test pass" ) TEST_CASE( "SUCCEED counts as a test pass", "[messages]" )
{ {
SUCCEED( "this is a " << "success" ); SUCCEED( "this is a " << "success" );
} }
TEST_CASE( "./failing/message/info/1", "INFO gets logged on failure" ) TEST_CASE( "INFO gets logged on failure", "[failing][messages][.]" )
{ {
INFO( "this message should be logged" ); INFO( "this message should be logged" );
INFO( "so should this" ); INFO( "so should this" );
int a = 2; int a = 2;
REQUIRE( a == 1 ); REQUIRE( a == 1 );
} }
TEST_CASE( "./mixed/message/info/2", "INFO gets logged on failure" ) TEST_CASE( "INFO gets logged on failure, even if captured before successful assertions", "[failing][messages][.]" )
{ {
INFO( "this message may be logged later" ); INFO( "this message may be logged later" );
int a = 2; int a = 2;
CHECK( a == 2 ); CHECK( a == 2 );
@ -43,16 +46,16 @@ TEST_CASE( "./mixed/message/info/2", "INFO gets logged on failure" )
INFO( "but not this" ); INFO( "but not this" );
CHECK( a == 2 ); CHECK( a == 2 );
} }
TEST_CASE( "./failing/message/fail", "FAIL aborts the test" ) TEST_CASE( "FAIL aborts the test", "[failing][messages][.]" )
{ {
if( Catch::isTrue( true ) ) if( Catch::isTrue( true ) )
FAIL( "This is a " << "failure" ); // This should output the message and abort FAIL( "This is a " << "failure" ); // This should output the message and abort
} }
TEST_CASE( "./failing/message/sections", "Output from all sections is reported" ) TEST_CASE( "Output from all sections is reported", "[failing][messages][.]" )
{ {
SECTION( "one", "" ) SECTION( "one", "" )
{ {
FAIL( "Message from section one" ); FAIL( "Message from section one" );
@ -62,10 +65,10 @@ TEST_CASE( "./failing/message/sections", "Output from all sections is reported"
{ {
FAIL( "Message from section two" ); FAIL( "Message from section two" );
} }
} }
TEST_CASE( "./succeeding/message/sections/stdout", "Output from all sections is reported" ) TEST_CASE( "Standard output from all sections is reported", "[messages]" )
{ {
SECTION( "one", "" ) SECTION( "one", "" )
{ {
std::cout << "Message from section one" << std::endl; std::cout << "Message from section one" << std::endl;
@ -75,28 +78,38 @@ TEST_CASE( "./succeeding/message/sections/stdout", "Output from all sections is
{ {
std::cout << "Message from section two" << std::endl; std::cout << "Message from section two" << std::endl;
} }
} }
TEST_CASE( "./mixed/message/scoped", "" ) TEST_CASE( "SCOPED_INFO is reset for each loop", "[messages][failing][.]" )
{ {
for( int i=0; i<100; i++ ) for( int i=0; i<100; i++ )
{ {
SCOPED_INFO( "current counter " << i ); SCOPED_INFO( "current counter " << i );
SCOPED_CAPTURE( i ); SCOPED_CAPTURE( i );
REQUIRE( i < 10 ); REQUIRE( i < 10 );
} }
} }
TEST_CASE( "./succeeding/nofail", "The NO_FAIL macro reports a failure but does not fail the test" ) TEST_CASE( "The NO_FAIL macro reports a failure but does not fail the test", "[messages]" )
{ {
CHECK_NOFAIL( 1 == 2 ); CHECK_NOFAIL( 1 == 2 );
} }
TEST_CASE( "just info", "[info][isolated info][.]" ) TEST_CASE( "just info", "[info][isolated info][messages]" )
{ {
INFO( "this should never be seen" ); INFO( "this should never be seen" );
} }
TEST_CASE( "just failure", "[fail][isolated info][.]" ) TEST_CASE( "just failure", "[fail][isolated info][.][messages]" )
{ {
FAIL( "Previous info should not be seen" ); FAIL( "Previous info should not be seen" );
}
TEST_CASE( "sends information to INFO", "[.][failing]" )
{
INFO( "hi" );
int i = 7;
CAPTURE( i );
REQUIRE( false );
}
} }

View File

@ -7,12 +7,14 @@
*/ */
#include "catch.hpp" #include "catch.hpp"
#include "catch_self_test.hpp"
#include <iostream> #include <iostream>
TEST_CASE( "./succeeding/Misc/Sections", "random SECTION tests" ) namespace MiscTests
{ {
TEST_CASE( "random SECTION tests", "[.][sections][failing]" )
{
int a = 1; int a = 1;
int b = 2; int b = 2;
@ -26,10 +28,10 @@ TEST_CASE( "./succeeding/Misc/Sections", "random SECTION tests" )
{ {
REQUIRE( a != b); REQUIRE( a != b);
} }
} }
TEST_CASE( "./succeeding/Misc/Sections/nested", "nested SECTION tests" ) TEST_CASE( "nested SECTION tests", "[.][sections][failing]" )
{ {
int a = 1; int a = 1;
int b = 2; int b = 2;
@ -43,10 +45,10 @@ TEST_CASE( "./succeeding/Misc/Sections/nested", "nested SECTION tests" )
REQUIRE( a != b); REQUIRE( a != b);
} }
} }
} }
TEST_CASE( "./mixed/Misc/Sections/nested2", "nested SECTION tests" ) TEST_CASE( "more nested SECTION tests", "[sections][failing][.]" )
{ {
int a = 1; int a = 1;
int b = 2; int b = 2;
@ -66,10 +68,10 @@ TEST_CASE( "./mixed/Misc/Sections/nested2", "nested SECTION tests" )
REQUIRE( a < b ); REQUIRE( a < b );
} }
} }
} }
TEST_CASE( "./Sections/nested/a/b", "nested SECTION tests" ) TEST_CASE( "even more nested SECTION tests", "[sections]" )
{ {
SECTION( "c", "" ) SECTION( "c", "" )
{ {
SECTION( "d (leaf)", "" ) SECTION( "d (leaf)", "" )
@ -84,10 +86,10 @@ TEST_CASE( "./Sections/nested/a/b", "nested SECTION tests" )
SECTION( "f (leaf)", "" ) SECTION( "f (leaf)", "" )
{ {
} }
} }
TEST_CASE( "./mixed/Misc/Sections/loops", "looped SECTION tests" ) TEST_CASE( "looped SECTION tests", "[.][failing][sections]" )
{ {
int a = 1; int a = 1;
for( int b = 0; b < 10; ++b ) for( int b = 0; b < 10; ++b )
@ -99,10 +101,10 @@ TEST_CASE( "./mixed/Misc/Sections/loops", "looped SECTION tests" )
CHECK( b > a ); CHECK( b > a );
} }
} }
} }
TEST_CASE( "./mixed/Misc/loops", "looped tests" ) TEST_CASE( "looped tests", "[.][failing]" )
{ {
static const int fib[] = { 1, 1, 2, 3, 5, 8, 13, 21 }; static const int fib[] = { 1, 1, 2, 3, 5, 8, 13, 21 };
for( size_t i=0; i < sizeof(fib)/sizeof(int); ++i ) for( size_t i=0; i < sizeof(fib)/sizeof(int); ++i )
@ -110,72 +112,65 @@ TEST_CASE( "./mixed/Misc/loops", "looped tests" )
INFO( "Testing if fib[" << i << "] (" << fib[i] << ") is even" ); INFO( "Testing if fib[" << i << "] (" << fib[i] << ") is even" );
CHECK( ( fib[i] % 2 ) == 0 ); CHECK( ( fib[i] % 2 ) == 0 );
} }
} }
TEST_CASE( "./succeeding/Misc/stdout,stderr", "Sends stuff to stdout and stderr" ) TEST_CASE( "Sends stuff to stdout and stderr", "" )
{ {
std::cout << "Some information" << std::endl; std::cout << "Some information" << std::endl;
std::cerr << "An error" << std::endl; std::cerr << "An error" << std::endl;
} }
inline const char* makeString( bool makeNull ) inline const char* makeString( bool makeNull )
{ {
return makeNull ? NULL : "valid string"; return makeNull ? NULL : "valid string";
} }
TEST_CASE( "./succeeding/Misc/null strings", "" ) TEST_CASE( "null strings", "" )
{ {
REQUIRE( makeString( false ) != static_cast<char*>(NULL)); REQUIRE( makeString( false ) != static_cast<char*>(NULL));
REQUIRE( makeString( true ) == static_cast<char*>(NULL)); REQUIRE( makeString( true ) == static_cast<char*>(NULL));
} }
TEST_CASE( "./failing/info", "sends information to INFO" )
{
INFO( "hi" );
int i = 7;
CAPTURE( i );
REQUIRE( false );
}
inline bool testCheckedIf( bool flag ) inline bool testCheckedIf( bool flag )
{ {
CHECKED_IF( flag ) CHECKED_IF( flag )
return true; return true;
else else
return false; return false;
} }
TEST_CASE( "./succeeding/checkedif", "" ) TEST_CASE( "checkedIf", "" )
{ {
REQUIRE( testCheckedIf( true ) ); REQUIRE( testCheckedIf( true ) );
} }
TEST_CASE( "./failing/checkedif", "" ) TEST_CASE( "checkedIf, failing", "[failing][.]" )
{ {
REQUIRE( testCheckedIf( false ) ); REQUIRE( testCheckedIf( false ) );
} }
inline bool testCheckedElse( bool flag ) inline bool testCheckedElse( bool flag )
{ {
CHECKED_ELSE( flag ) CHECKED_ELSE( flag )
return false; return false;
return true; return true;
} }
TEST_CASE( "./succeeding/checkedelse", "" ) TEST_CASE( "checkedElse", "" )
{ {
REQUIRE( testCheckedElse( true ) ); REQUIRE( testCheckedElse( true ) );
} }
TEST_CASE( "./failing/checkedelse", "" ) TEST_CASE( "checkedElse, failing", "[failing][.]" )
{ {
REQUIRE( testCheckedElse( false ) ); REQUIRE( testCheckedElse( false ) );
} }
TEST_CASE( "./misc/xmlentitycheck", "" ) TEST_CASE( "xmlentitycheck", "" )
{ {
SECTION( "embedded xml", "<test>it should be possible to embed xml characters, such as <, \" or &, or even whole <xml>documents</xml> within an attribute</test>" ) SECTION( "embedded xml", "<test>it should be possible to embed xml characters, such as <, \" or &, or even whole <xml>documents</xml> within an attribute</test>" )
{ {
// No test // No test
@ -184,115 +179,115 @@ TEST_CASE( "./misc/xmlentitycheck", "" )
{ {
// No test // No test
} }
} }
TEST_CASE( "./manual/onechar", "send a single char to INFO" ) TEST_CASE( "send a single char to INFO", "[failing][.]" )
{ {
INFO(3); INFO(3);
REQUIRE(false); REQUIRE(false);
} }
TEST_CASE("./succeeding/atomic if", "") TEST_CASE( "atomic if", "[failing][0]")
{ {
size_t x = 0; size_t x = 0;
if( x ) if( x )
REQUIRE(x > 0); REQUIRE(x > 0);
else else
REQUIRE(x == 0); REQUIRE(x == 0);
} }
inline const char* testStringForMatching() inline const char* testStringForMatching()
{ {
return "this string contains 'abc' as a substring"; return "this string contains 'abc' as a substring";
} }
TEST_CASE("./succeeding/matchers", "") TEST_CASE("String matchers", "[matchers]" )
{ {
REQUIRE_THAT( testStringForMatching(), Contains( "string" ) ); REQUIRE_THAT( testStringForMatching(), Contains( "string" ) );
CHECK_THAT( testStringForMatching(), Contains( "abc" ) ); CHECK_THAT( testStringForMatching(), Contains( "abc" ) );
CHECK_THAT( testStringForMatching(), StartsWith( "this" ) ); CHECK_THAT( testStringForMatching(), StartsWith( "this" ) );
CHECK_THAT( testStringForMatching(), EndsWith( "substring" ) ); CHECK_THAT( testStringForMatching(), EndsWith( "substring" ) );
} }
TEST_CASE("./failing/matchers/Contains", "") TEST_CASE("Contains string matcher", "[.][failing][matchers]")
{ {
CHECK_THAT( testStringForMatching(), Contains( "not there" ) ); CHECK_THAT( testStringForMatching(), Contains( "not there" ) );
} }
TEST_CASE("./failing/matchers/StartsWith", "") TEST_CASE("StartsWith string matcher", "[.][failing][matchers]")
{ {
CHECK_THAT( testStringForMatching(), StartsWith( "string" ) ); CHECK_THAT( testStringForMatching(), StartsWith( "string" ) );
} }
TEST_CASE("./failing/matchers/EndsWith", "") TEST_CASE("EndsWith string matcher", "[.][failing][matchers]")
{ {
CHECK_THAT( testStringForMatching(), EndsWith( "this" ) ); CHECK_THAT( testStringForMatching(), EndsWith( "this" ) );
} }
TEST_CASE("./failing/matchers/Equals", "") TEST_CASE("Equals string matcher", "[.][failing][matchers]")
{ {
CHECK_THAT( testStringForMatching(), Equals( "something else" ) ); CHECK_THAT( testStringForMatching(), Equals( "something else" ) );
} }
TEST_CASE("string", "Equals with NULL") TEST_CASE("Equals string matcher, with NULL", "[matchers]")
{ {
REQUIRE_THAT("", Equals(NULL)); REQUIRE_THAT("", Equals(NULL));
} }
TEST_CASE("./succeeding/matchers/AllOf", "") TEST_CASE("AllOf matcher", "[matchers]")
{ {
CHECK_THAT( testStringForMatching(), AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) ) ); CHECK_THAT( testStringForMatching(), AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) ) );
} }
TEST_CASE("./succeeding/matchers/AnyOf", "") TEST_CASE("AnyOf matcher", "[matchers]")
{ {
CHECK_THAT( testStringForMatching(), AnyOf( Catch::Contains( "string" ), Catch::Contains( "not there" ) ) ); CHECK_THAT( testStringForMatching(), AnyOf( Catch::Contains( "string" ), Catch::Contains( "not there" ) ) );
CHECK_THAT( testStringForMatching(), AnyOf( Catch::Contains( "not there" ), Catch::Contains( "string" ) ) ); CHECK_THAT( testStringForMatching(), AnyOf( Catch::Contains( "not there" ), Catch::Contains( "string" ) ) );
} }
TEST_CASE("./succeeding/matchers/Equals", "") TEST_CASE("Equals", "[matchers]")
{ {
CHECK_THAT( testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) ); CHECK_THAT( testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) );
} }
inline unsigned int Factorial( unsigned int number ) inline unsigned int Factorial( unsigned int number )
{ {
// return number <= 1 ? number : Factorial(number-1)*number; // return number <= 1 ? number : Factorial(number-1)*number;
return number > 1 ? Factorial(number-1)*number : 1; return number > 1 ? Factorial(number-1)*number : 1;
} }
TEST_CASE( "Factorials are computed", "[factorial]" ) { TEST_CASE( "Factorials are computed", "[factorial]" ) {
REQUIRE( Factorial(0) == 1 ); REQUIRE( Factorial(0) == 1 );
REQUIRE( Factorial(1) == 1 ); REQUIRE( Factorial(1) == 1 );
REQUIRE( Factorial(2) == 2 ); REQUIRE( Factorial(2) == 2 );
REQUIRE( Factorial(3) == 6 ); REQUIRE( Factorial(3) == 6 );
REQUIRE( Factorial(10) == 3628800 ); REQUIRE( Factorial(10) == 3628800 );
} }
TEST_CASE( "empty", "An empty test with no assertions" ) TEST_CASE( "An empty test with no assertions", "[empty]" )
{ {
} }
TEST_CASE( "Nice descriptive name", "[tag1][tag2][tag3][.]" ) TEST_CASE( "Nice descriptive name", "[tag1][tag2][tag3][.]" )
{ {
WARN( "This one ran" ); WARN( "This one ran" );
} }
TEST_CASE( "first tag", "[tag1]" ) TEST_CASE( "first tag", "[tag1]" )
{ {
} }
TEST_CASE( "second tag", "[tag2]" ) TEST_CASE( "second tag", "[tag2]" )
{ {
} }
// //
//TEST_CASE( "spawn a new process", "[.]" ) //TEST_CASE( "spawn a new process", "[.]" )
//{ //{
// // !TBD Work in progress // // !TBD Work in progress
// char line[200]; // char line[200];
// FILE* output = popen("./CatchSelfTest ./failing/matchers/StartsWith", "r"); // FILE* output = popen("./CatchSelfTest ./failing/matchers/StartsWith", "r");
// while ( fgets(line, 199, output) ) // while ( fgets(line, 199, output) )
// std::cout << line; // std::cout << line;
//} //}
TEST_CASE( "vectors can be sized and resized", "[vector]" ) { TEST_CASE( "vectors can be sized and resized", "[vector]" ) {
std::vector<int> v( 5 ); std::vector<int> v( 5 );
@ -330,37 +325,15 @@ TEST_CASE( "vectors can be sized and resized", "[vector]" ) {
REQUIRE( v.size() == 5 ); REQUIRE( v.size() == 5 );
REQUIRE( v.capacity() >= 5 ); REQUIRE( v.capacity() >= 5 );
} }
} }
// https://github.com/philsquared/Catch/issues/166 // https://github.com/philsquared/Catch/issues/166
TEST_CASE("./failing/CatchSectionInfiniteLoop", "") TEST_CASE("A couple of nested sections followed by a failure", "[failing][.]")
{ {
SECTION("Outer", "") SECTION("Outer", "")
SECTION("Inner", "") SECTION("Inner", "")
SUCCEED("that's not flying - that's failing in style"); SUCCEED("that's not flying - that's failing in style");
FAIL("to infinity and beyond"); 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");
//
//}

View File

@ -1,2 +1,2 @@
// This file is only here to verify (to the extent possible) the self sufficiency of the header // This file is only here to verify (to the extent possible) the self sufficiency of the header
#include "catch_debugger.hpp" #include "catch_debugger.h"

View File

@ -1,2 +1,2 @@
// This file is only here to verify (to the extent possible) the self sufficiency of the header // This file is only here to verify (to the extent possible) the self sufficiency of the header
#include "catch_stream.hpp" #include "catch_stream.h"

View File

@ -1,2 +1,2 @@
// This file is only here to verify (to the extent possible) the self sufficiency of the header // This file is only here to verify (to the extent possible) the self sufficiency of the header
#include "catch_tags.hpp" #include "catch_tags.h"

View File

@ -5,69 +5,17 @@
* Distributed under the Boost Software License, Version 1.0. (See accompanying * 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) * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/ */
#if !defined(_WINDLL)
#define CATCH_CONFIG_MAIN
#endif
#include "catch.hpp"
#ifdef __clang__ #ifdef __clang__
#pragma clang diagnostic ignored "-Wpadded" #pragma clang diagnostic ignored "-Wpadded"
#endif
#include "catch_self_test.hpp"
#include "internal/catch_text.h"
#include "internal/catch_console_colour.hpp"
TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results" ) {
using namespace Catch;
///////////////////////////////////////////////////////////////////////////
SECTION( "selftest/expected result",
"Tests do what they claim" ) {
SECTION( "selftest/expected result/failing tests",
"Tests in the 'failing' branch fail" ) {
MetaTestRunner::runMatching( "./failing/*", MetaTestRunner::Expected::ToFail, 0, 2 );
}
SECTION( "selftest/expected result/succeeding tests",
"Tests in the 'succeeding' branch succeed" ) {
MetaTestRunner::runMatching( "./succeeding/*", MetaTestRunner::Expected::ToSucceed, 1, 2 );
}
}
///////////////////////////////////////////////////////////////////////////
SECTION( "selftest/test counts",
"Number of test cases that run is fixed" ) {
EmbeddedRunner runner;
SECTION( "selftest/test counts/succeeding tests",
"Number of 'succeeding' tests is fixed" ) {
Totals totals = runner.runMatching( "./succeeding/*", 0, 2 );
CHECK( totals.assertions.passed == 298 );
CHECK( totals.assertions.failed == 0 );
}
SECTION( "selftest/test counts/failing tests",
"Number of 'failing' tests is fixed" ) {
Totals totals = runner.runMatching( "./failing/*", 1, 2 );
CHECK( totals.assertions.passed == 2 );
CHECK( totals.assertions.failed == 77 );
}
}
}
TEST_CASE( "meta/Misc/Sections", "looped tests" ) {
Catch::EmbeddedRunner runner;
Catch::Totals totals = runner.runMatching( "./mixed/Misc/Sections/nested2", 0, 1 );
CHECK( totals.assertions.passed == 2 );
CHECK( totals.assertions.failed == 1 );
}
#ifdef __clang__
#pragma clang diagnostic ignored "-Wweak-vtables" #pragma clang diagnostic ignored "-Wweak-vtables"
#endif #endif
#include "../../include/internal/catch_commandline.hpp"
#include "../../include/internal/catch_test_spec.h"
#include "../../include/reporters/catch_reporter_xml.hpp"
template<size_t size> template<size_t size>
void parseIntoConfig( const char * (&argv)[size], Catch::ConfigData& config ) { void parseIntoConfig( const char * (&argv)[size], Catch::ConfigData& config ) {
Clara::CommandLine<Catch::ConfigData> parser = Catch::makeCommandLineParser(); Clara::CommandLine<Catch::ConfigData> parser = Catch::makeCommandLineParser();

View File

@ -24,36 +24,38 @@ namespace Catch
} }
} }
/////////////////////////////////////////////////////////////////////////////// namespace TrickTests
TEST_CASE
(
"./succeeding/Tricky/std::pair",
"Parsing a std::pair"
)
{ {
///////////////////////////////////////////////////////////////////////////////
TEST_CASE
(
"Parsing a std::pair",
"[Tricky][std::pair]"
)
{
std::pair<int, int> aNicePair( 1, 2 ); std::pair<int, int> aNicePair( 1, 2 );
REQUIRE( (std::pair<int, int>( 1, 2 )) == aNicePair ); REQUIRE( (std::pair<int, int>( 1, 2 )) == aNicePair );
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
TEST_CASE TEST_CASE
( (
"./inprogress/failing/Tricky/trailing expression", "Where the is more to the expression after the RHS[failing]",
"Where the is more to the expression after the RHS" "[Tricky][failing][.]"
) )
{ {
// int a = 1, b = 2; // int a = 1, b = 2;
// REQUIRE( a == 2 || b == 2 ); // REQUIRE( a == 2 || b == 2 );
WARN( "Uncomment the code in this test to check that it gives a sensible compiler error" ); WARN( "Uncomment the code in this test to check that it gives a sensible compiler error" );
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
TEST_CASE TEST_CASE
( (
"./inprogress/failing/Tricky/compound lhs", "Where the LHS is not a simple value[failing]",
"Where the LHS is not a simple value" "[Tricky][failing][.]"
) )
{ {
/* /*
int a = 1; int a = 1;
int b = 2; int b = 2;
@ -62,24 +64,24 @@ TEST_CASE
REQUIRE( a+1 == b-1 ); REQUIRE( a+1 == b-1 );
*/ */
WARN( "Uncomment the code in this test to check that it gives a sensible compiler error" ); WARN( "Uncomment the code in this test to check that it gives a sensible compiler error" );
} }
struct Opaque struct Opaque
{ {
int val; int val;
bool operator ==( const Opaque& o ) const bool operator ==( const Opaque& o ) const
{ {
return val == o.val; return val == o.val;
} }
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
TEST_CASE TEST_CASE
( (
"./failing/Tricky/non streamable type", "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][.]"
) )
{ {
Opaque o1, o2; Opaque o1, o2;
o1.val = 7; o1.val = 7;
@ -87,31 +89,32 @@ TEST_CASE
CHECK( &o1 == &o2 ); CHECK( &o1 == &o2 );
CHECK( o1 == o2 ); CHECK( o1 == o2 );
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
TEST_CASE TEST_CASE
( (
"./failing/string literals", "string literals of different sizes can be compared[failing]",
"string literals of different sizes can be compared" "[Tricky][failing][.]"
) )
{ {
REQUIRE( std::string( "first" ) == "second" ); REQUIRE( std::string( "first" ) == "second" );
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
TEST_CASE TEST_CASE
( (
"./succeeding/side-effects", "An expression with side-effects should only be evaluated once",
"An expression with side-effects should only be evaluated once" "[Tricky]"
) )
{ {
int i = 7; int i = 7;
REQUIRE( i++ == 7 ); REQUIRE( i++ == 7 );
REQUIRE( i++ == 8 ); REQUIRE( i++ == 8 );
}
} }
namespace A { namespace A {
@ -151,8 +154,8 @@ inline bool operator==(const B::Y& lhs, const A::X& rhs)
/* This, currently, does not compile with LLVM /* This, currently, does not compile with LLVM
TEST_CASE TEST_CASE
( (
"./succeeding/koenig",
"Operators at different namespace levels not hijacked by Koenig lookup" "Operators at different namespace levels not hijacked by Koenig lookup"
"[Tricky]"
) )
{ {
A::X x; A::X x;
@ -171,8 +174,8 @@ namespace ObjectWithConversions
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
TEST_CASE TEST_CASE
( (
"./succeeding/koenig", "Operators at different namespace levels not hijacked by Koenig lookup",
"Operators at different namespace levels not hijacked by Koenig lookup" "[Tricky]"
) )
{ {
Object o; Object o;
@ -199,7 +202,7 @@ namespace ObjectWithNonConstEqualityOperator
unsigned int m_value; unsigned int m_value;
}; };
TEST_CASE("./succeeding/non-const==", "Demonstrate that a non-const == is not used") TEST_CASE("Demonstrate that a non-const == is not used", "[Tricky]" )
{ {
Test t( 1 ); Test t( 1 );
REQUIRE( t == 1u ); REQUIRE( t == 1u );
@ -212,7 +215,7 @@ namespace EnumBitFieldTests
bit30 = 0x40000000, bit31 = 0x80000000, bit30 = 0x40000000, bit31 = 0x80000000,
bit30and31 = 0xc0000000}; bit30and31 = 0xc0000000};
TEST_CASE("./succeeding/enum/bits", "Test enum bit values") TEST_CASE( "Test enum bit values", "[Tricky]" )
{ {
REQUIRE( 0xc0000000 == bit30and31 ); REQUIRE( 0xc0000000 == bit30and31 );
} }
@ -226,7 +229,7 @@ struct Obj
int* prop; int* prop;
}; };
TEST_CASE("./succeeding/boolean member", "") TEST_CASE("boolean member", "[Tricky]")
{ {
Obj obj; Obj obj;
REQUIRE( obj.prop != NULL ); REQUIRE( obj.prop != NULL );
@ -238,14 +241,14 @@ TEST_CASE("./succeeding/boolean member", "")
// struct it is declared in - but when evaluating it in a deduced // struct it is declared in - but when evaluating it in a deduced
// context it appears to require the extra definition. // context it appears to require the extra definition.
// The issue was fixed by adding bool overloads to bypass the // The issue was fixed by adding bool overloads to bypass the
// templates that were deduce it. // templates that were there to deduce it.
template <bool B> template <bool B>
struct is_true struct is_true
{ {
static const bool value = B; static const bool value = B;
}; };
TEST_CASE( "./succeeding/unimplemented static bool", "static bools can be evaluated" ) TEST_CASE( "(unimplemented) static bools can be evaluated", "[Tricky]" )
{ {
SECTION("compare to true","") SECTION("compare to true","")
{ {
@ -277,11 +280,11 @@ TEST_CASE( "./succeeding/unimplemented static bool", "static bools can be evalua
// Uncomment these tests to produce an error at test registration time // Uncomment these tests to produce an error at test registration time
/* /*
TEST_CASE( "./sameName", "Tests with the same name are not allowed" ) TEST_CASE( "Tests with the same name are not allowed", "[Tricky]" )
{ {
} }
TEST_CASE( "./sameName", "Tests with the same name are not allowed" ) TEST_CASE( "Tests with the same name are not allowed", "[Tricky]" )
{ {
} }
@ -298,7 +301,7 @@ struct Boolable
bool m_value; bool m_value;
}; };
TEST_CASE( "./succeeding/SafeBool", "Objects that evaluated in boolean contexts can be checked") TEST_CASE( "Objects that evaluated in boolean contexts can be checked", "[Tricky][SafeBool]" )
{ {
Boolable True( true ); Boolable True( true );
Boolable False( false ); Boolable False( false );
@ -308,7 +311,7 @@ TEST_CASE( "./succeeding/SafeBool", "Objects that evaluated in boolean contexts
CHECK_FALSE( False ); CHECK_FALSE( False );
} }
TEST_CASE( "Assertions then sections", "" ) TEST_CASE( "Assertions then sections", "[Tricky]" )
{ {
// This was causing a failure due to the way the console reporter was handling // This was causing a failure due to the way the console reporter was handling
// the current section // the current section
@ -335,7 +338,7 @@ struct Awkward
operator int() const { return 7; } operator int() const { return 7; }
}; };
TEST_CASE( "non streamable - with conv. op", "" ) TEST_CASE( "non streamable - with conv. op", "[Tricky]" )
{ {
Awkward awkward; Awkward awkward;
std::string s = Catch::toString( awkward ); std::string s = Catch::toString( awkward );
@ -346,7 +349,7 @@ inline void foo() {}
typedef void (*fooptr_t)(); typedef void (*fooptr_t)();
TEST_CASE( "Comparing function pointers", "[function pointer]" ) TEST_CASE( "Comparing function pointers", "[Tricky][function pointer]" )
{ {
// This was giving a warning in VS2010 // This was giving a warning in VS2010
// #179 // #179
@ -358,7 +361,7 @@ TEST_CASE( "Comparing function pointers", "[function pointer]" )
class ClassName {}; class ClassName {};
TEST_CASE( "pointer to class", "" ) TEST_CASE( "pointer to class", "[Tricky]" )
{ {
ClassName *p = 0; ClassName *p = 0;
REQUIRE( p == 0 ); REQUIRE( p == 0 );
@ -368,7 +371,7 @@ TEST_CASE( "pointer to class", "" )
#include <memory> #include <memory>
TEST_CASE( "null_ptr", "" ) TEST_CASE( "null_ptr", "[Tricky]" )
{ {
std::unique_ptr<int> ptr; std::unique_ptr<int> ptr;
REQUIRE(ptr.get() == nullptr); REQUIRE(ptr.get() == nullptr);
@ -376,7 +379,7 @@ TEST_CASE( "null_ptr", "" )
#endif #endif
TEST_CASE( "X/level/0/a", "" ) { SUCCEED(""); } TEST_CASE( "X/level/0/a", "[Tricky]" ) { SUCCEED(""); }
TEST_CASE( "X/level/0/b", "[fizz]" ) { SUCCEED(""); } TEST_CASE( "X/level/0/b", "[Tricky][fizz]" ){ SUCCEED(""); }
TEST_CASE( "X/level/1/a", "" ) { SUCCEED(""); } TEST_CASE( "X/level/1/a", "[Tricky]" ) { SUCCEED(""); }
TEST_CASE( "X/level/1/b", "" ) { SUCCEED("");} TEST_CASE( "X/level/1/b", "[Tricky]" ) { SUCCEED(""); }

View File

@ -1,31 +0,0 @@
/*
* Created by Phil on 14/02/2012.
* Copyright 2012 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)
*/
#define CATCH_CONFIG_MAIN
#include "catch_self_test.hpp"
namespace Catch{
NullStreamingReporter::~NullStreamingReporter() {}
Totals EmbeddedRunner::runMatching( const std::string& rawTestSpec, std::size_t groupIndex, std::size_t groupsCount, const std::string& ) {
std::ostringstream oss;
Ptr<Config> config = new Config();
config->setStreamBuf( oss.rdbuf() );
Totals totals;
// Scoped because RunContext doesn't report EndTesting until its destructor
{
RunContext runner( config.get(), m_reporter.get() );
totals = runner.runMatching( rawTestSpec, groupIndex, groupsCount );
}
return totals;
}
}

View File

@ -1,177 +0,0 @@
/*
* Created by Phil on 14/01/2011.
* Copyright 2011 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_SELF_TEST_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_SELF_TEST_HPP_INCLUDED
#include "catch.hpp"
// Use this external guard here as if we're using the single header version
// this will already be defined
#ifndef TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED
#include "catch_interfaces_registry_hub.h"
#endif
#include "set"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
#endif
namespace Catch {
class NullStreamingReporter : public SharedImpl<IStreamingReporter> {
public:
virtual ~NullStreamingReporter();
static std::string getDescription() {
return "null reporter";
}
private: // IStreamingReporter
virtual ReporterPreferences getPreferences() const {
return ReporterPreferences();
}
virtual void noMatchingTestCases( std::string const& ) {}
virtual void testRunStarting( TestRunInfo const& ) {}
virtual void testGroupStarting( GroupInfo const& ) {}
virtual void testCaseStarting( TestCaseInfo const& ) {}
virtual void sectionStarting( SectionInfo const& ) {}
virtual void assertionStarting( AssertionInfo const& ) {}
virtual bool assertionEnded( AssertionStats const& ) { return false; }
virtual void sectionEnded( SectionStats const& ) {}
virtual void testCaseEnded( TestCaseStats const& ) {}
virtual void testGroupEnded( TestGroupStats const& ) {}
virtual void testRunEnded( TestRunStats const& ) {}
};
class EmbeddedRunner {
public:
EmbeddedRunner() : m_reporter( new NullStreamingReporter() ) {}
Totals runMatching( const std::string& rawTestSpec,
std::size_t groupIndex,
std::size_t groupsCount,
const std::string& reporter = "console" );
private:
Ptr<IStreamingReporter> m_reporter;
};
class MetaTestRunner {
public:
struct Expected { enum Result {
ToSucceed,
ToFail
}; };
MetaTestRunner( Expected::Result expectedResult, std::size_t groupIndex, std::size_t groupsCount )
: m_expectedResult( expectedResult ),
m_groupIndex( groupIndex ),
m_groupsCount( groupsCount )
{}
static void runMatching( const std::string& testSpec,
Expected::Result expectedResult,
std::size_t groupIndex,
std::size_t groupsCount ) {
forEach( getRegistryHub().getTestCaseRegistry().getMatchingTestCases( testSpec ),
MetaTestRunner( expectedResult, groupIndex, groupsCount ) );
}
void operator()( const TestCase& testCase ) {
std::string name;
Totals totals;
{
EmbeddedRunner runner;
name = testCase.getTestCaseInfo().name;
totals = runner.runMatching( name, m_groupIndex, m_groupsCount );
}
switch( m_expectedResult ) {
case Expected::ToSucceed:
if( totals.assertions.failed > 0 ) {
FAIL( "Expected test case '"
<< name
<< "' to succeed but there was/ were "
<< totals.assertions.failed << " failure(s)" );
}
else {
SUCCEED( "Tests passed, as expected" );
}
break;
case Expected::ToFail:
if( totals.assertions.failed == 0 ) {
FAIL( "Expected test case '"
<< name
<< "' to fail but there was/ were "
<< totals.assertions.passed << " success(es)" );
}
else {
SUCCEED( "Tests failed, as expected" );
}
break;
}
}
private:
Expected::Result m_expectedResult;
std::size_t m_groupIndex;
std::size_t m_groupsCount;
};
struct LineInfoRegistry {
static LineInfoRegistry& get() {
static LineInfoRegistry s_instance;
return s_instance;
}
void registerLineInfo( const std::string& name,
const SourceLineInfo& info ) {
m_registry.insert( std::make_pair( name, info ) );
}
const SourceLineInfo* find( const std::string& name ) const {
std::map<std::string, SourceLineInfo>::const_iterator it = m_registry.find( name );
return it == m_registry.end() ? NULL : &(it->second);
}
const std::string infoForName( const std::string& name ) const {
std::map<std::string, SourceLineInfo>::const_iterator it = m_registry.find( name );
if( it == m_registry.end() )
return "";
std::ostringstream oss;
oss << it->second;
return oss.str();
}
std::map<std::string, SourceLineInfo> m_registry;
};
struct LineInfoRegistrar {
LineInfoRegistrar( const char* name, const SourceLineInfo& lineInfo ) {
LineInfoRegistry::get().registerLineInfo( name, lineInfo );
}
};
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#define CATCH_REGISTER_LINE_INFO( name ) ::Catch::LineInfoRegistrar INTERNAL_CATCH_UNIQUE_NAME( lineRegistrar )( name, ::Catch::SourceLineInfo( __FILE__, __LINE__ ) );
#define CATCH_GET_LINE_INFO( name ) ::Catch::LineInfoRegistry::get().infoForName( name )
#endif // TWOBLUECUBES_CATCH_SELF_TEST_HPP_INCLUDED

View File

@ -1,33 +0,0 @@
========================================================================
CONSOLE APPLICATION : TestCatch Project Overview
========================================================================
AppWizard has created this TestCatch application for you.
This file contains a summary of what you will find in each of the files that
make up your TestCatch application.
TestCatch.vcproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
TestCatch.cpp
This is the main application source file.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named TestCatch.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////

View File

@ -296,10 +296,6 @@
RelativePath="..\..\..\..\include\internal\catch_section.hpp" RelativePath="..\..\..\..\include\internal\catch_section.hpp"
> >
</File> </File>
<File
RelativePath="..\..\..\..\include\internal\catch_self_test.hpp"
>
</File>
<File <File
RelativePath="..\..\..\..\include\internal\catch_stream.hpp" RelativePath="..\..\..\..\include\internal\catch_stream.hpp"
> >
@ -351,10 +347,6 @@
RelativePath="..\..\..\SelfTest\BDDTests.cpp" RelativePath="..\..\..\SelfTest\BDDTests.cpp"
> >
</File> </File>
<File
RelativePath="..\..\..\SelfTest\catch_self_test.cpp"
>
</File>
<File <File
RelativePath="..\..\..\SelfTest\ClassTests.cpp" RelativePath="..\..\..\SelfTest\ClassTests.cpp"
> >
@ -396,10 +388,6 @@
> >
</File> </File>
</Filter> </Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type='text/xsl' href='_UpgradeReport_Files/UpgradeReport.xslt'?><UpgradeLog>
<Properties><Property Name="Solution" Value="TestCatch">
</Property><Property Name="Solution File" Value="\\psf\Home\Dev\TwoBlueCubes\Dev\GitHub\CatchBugFix\projects\VisualStudio\TestCatch\TestCatch.sln">
</Property><Property Name="Date" Value="Friday, March 02, 2012">
</Property><Property Name="Time" Value="7:43 AM">
</Property></Properties><Event ErrorLevel="0" Project="TestCatch" Source="TestCatch\TestCatch.vcproj" Description="Converting project file '\\psf\Home\Dev\TwoBlueCubes\Dev\GitHub\CatchBugFix\projects\VisualStudio\TestCatch\TestCatch\TestCatch.vcproj'.">
</Event><Event ErrorLevel="1" Project="TestCatch" Source="TestCatch\TestCatch.vcproj" Description="VCWebServiceProxyGeneratorTool is no longer supported. The tool has been removed from your project settings.">
</Event><Event ErrorLevel="0" Project="TestCatch" Source="TestCatch\TestCatch.vcproj" Description="Done converting to new project file '\\psf\Home\Dev\TwoBlueCubes\Dev\GitHub\CatchBugFix\projects\VisualStudio\TestCatch\TestCatch\TestCatch.vcxproj'.">
</Event><Event ErrorLevel="3" Project="TestCatch" Source="TestCatch\TestCatch.vcproj" Description="Converted">
</Event><Event ErrorLevel="0" Project="" Source="TestCatch.sln" Description="Solution converted successfully">
</Event><Event ErrorLevel="3" Project="" Source="TestCatch.sln" Description="Converted">
</Event></UpgradeLog>

View File

@ -1,207 +0,0 @@
BODY
{
BACKGROUND-COLOR: white;
FONT-FAMILY: "Verdana", sans-serif;
FONT-SIZE: 100%;
MARGIN-LEFT: 0px;
MARGIN-TOP: 0px
}
P
{
FONT-FAMILY: "Verdana", sans-serif;
FONT-SIZE: 70%;
LINE-HEIGHT: 12pt;
MARGIN-BOTTOM: 0px;
MARGIN-LEFT: 10px;
MARGIN-TOP: 10px
}
.note
{
BACKGROUND-COLOR: #ffffff;
COLOR: #336699;
FONT-FAMILY: "Verdana", sans-serif;
FONT-SIZE: 100%;
MARGIN-BOTTOM: 0px;
MARGIN-LEFT: 0px;
MARGIN-TOP: 0px;
PADDING-RIGHT: 10px
}
.infotable
{
BACKGROUND-COLOR: #f0f0e0;
BORDER-BOTTOM: #ffffff 0px solid;
BORDER-COLLAPSE: collapse;
BORDER-LEFT: #ffffff 0px solid;
BORDER-RIGHT: #ffffff 0px solid;
BORDER-TOP: #ffffff 0px solid;
FONT-SIZE: 70%;
MARGIN-LEFT: 10px
}
.issuetable
{
BACKGROUND-COLOR: #ffffe8;
BORDER-COLLAPSE: collapse;
COLOR: #000000;
FONT-SIZE: 100%;
MARGIN-BOTTOM: 10px;
MARGIN-LEFT: 13px;
MARGIN-TOP: 0px
}
.issuetitle
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: #dcdcdc 1px solid;
BORDER-TOP: #dcdcdc 1px;
COLOR: #003366;
FONT-WEIGHT: normal
}
.header
{
BACKGROUND-COLOR: #cecf9c;
BORDER-BOTTOM: #ffffff 1px solid;
BORDER-LEFT: #ffffff 1px solid;
BORDER-RIGHT: #ffffff 1px solid;
BORDER-TOP: #ffffff 1px solid;
COLOR: #000000;
FONT-WEIGHT: bold
}
.issuehdr
{
BACKGROUND-COLOR: #E0EBF5;
BORDER-BOTTOM: #dcdcdc 1px solid;
BORDER-TOP: #dcdcdc 1px solid;
COLOR: #000000;
FONT-WEIGHT: normal
}
.issuenone
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: 0px;
BORDER-LEFT: 0px;
BORDER-RIGHT: 0px;
BORDER-TOP: 0px;
COLOR: #000000;
FONT-WEIGHT: normal
}
.content
{
BACKGROUND-COLOR: #e7e7ce;
BORDER-BOTTOM: #ffffff 1px solid;
BORDER-LEFT: #ffffff 1px solid;
BORDER-RIGHT: #ffffff 1px solid;
BORDER-TOP: #ffffff 1px solid;
PADDING-LEFT: 3px
}
.issuecontent
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: #dcdcdc 1px solid;
BORDER-TOP: #dcdcdc 1px solid;
PADDING-LEFT: 3px
}
A:link
{
COLOR: #cc6633;
TEXT-DECORATION: underline
}
A:visited
{
COLOR: #cc6633;
}
A:active
{
COLOR: #cc6633;
}
A:hover
{
COLOR: #cc3300;
TEXT-DECORATION: underline
}
H1
{
BACKGROUND-COLOR: #003366;
BORDER-BOTTOM: #336699 6px solid;
COLOR: #ffffff;
FONT-SIZE: 130%;
FONT-WEIGHT: normal;
MARGIN: 0em 0em 0em -20px;
PADDING-BOTTOM: 8px;
PADDING-LEFT: 30px;
PADDING-TOP: 16px
}
H2
{
COLOR: #000000;
FONT-SIZE: 80%;
FONT-WEIGHT: bold;
MARGIN-BOTTOM: 3px;
MARGIN-LEFT: 10px;
MARGIN-TOP: 20px;
PADDING-LEFT: 0px
}
H3
{
COLOR: #000000;
FONT-SIZE: 80%;
FONT-WEIGHT: bold;
MARGIN-BOTTOM: -5px;
MARGIN-LEFT: 10px;
MARGIN-TOP: 20px
}
H4
{
COLOR: #000000;
FONT-SIZE: 70%;
FONT-WEIGHT: bold;
MARGIN-BOTTOM: 0px;
MARGIN-TOP: 15px;
PADDING-BOTTOM: 0px
}
UL
{
COLOR: #000000;
FONT-SIZE: 70%;
LIST-STYLE: square;
MARGIN-BOTTOM: 0pt;
MARGIN-TOP: 0pt
}
OL
{
COLOR: #000000;
FONT-SIZE: 70%;
LIST-STYLE: square;
MARGIN-BOTTOM: 0pt;
MARGIN-TOP: 0pt
}
LI
{
LIST-STYLE: square;
MARGIN-LEFT: 0px
}
.expandable
{
CURSOR: hand
}
.expanded
{
color: black
}
.collapsed
{
DISPLAY: none
}
.foot
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: #cecf9c 1px solid;
BORDER-TOP: #cecf9c 2px solid
}
.settings
{
MARGIN-LEFT: 25PX;
}
.help
{
TEXT-ALIGN: right;
margin-right: 10px;
}

View File

@ -1,232 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl='urn:schemas-microsoft-com:xslt'>
<xsl:key name="ProjectKey" match="Event" use="@Project" />
<xsl:template match="Events" mode="createProjects">
<projects>
<xsl:for-each select="Event">
<!--xsl:sort select="@Project" order="descending"/-->
<xsl:if test="(1=position()) or (preceding-sibling::*[1]/@Project != @Project)">
<xsl:variable name="ProjectName" select="@Project"/>
<project>
<xsl:attribute name="name">
<xsl:value-of select="@Project"/>
</xsl:attribute>
<xsl:if test="@Project=''">
<xsl:attribute name="solution">
<xsl:value-of select="@Solution"/>
</xsl:attribute>
</xsl:if>
<xsl:for-each select="key('ProjectKey', $ProjectName)">
<!--xsl:sort select="@Source" /-->
<xsl:if test="(1=position()) or (preceding-sibling::*[1]/@Source != @Source)">
<source>
<xsl:attribute name="name">
<xsl:value-of select="@Source"/>
</xsl:attribute>
<xsl:variable name="Source">
<xsl:value-of select="@Source"/>
</xsl:variable>
<xsl:for-each select="key('ProjectKey', $ProjectName)[ @Source = $Source ]">
<event>
<xsl:attribute name="error-level">
<xsl:value-of select="@ErrorLevel"/>
</xsl:attribute>
<xsl:attribute name="description">
<xsl:value-of select="@Description"/>
</xsl:attribute>
</event>
</xsl:for-each>
</source>
</xsl:if>
</xsl:for-each>
</project>
</xsl:if>
</xsl:for-each>
</projects>
</xsl:template>
<xsl:template match="projects">
<xsl:for-each select="project">
<xsl:sort select="@Name" order="ascending"/>
<h2>
<xsl:if test="@solution"><a _locID="Solution">Solution</a>: <xsl:value-of select="@solution"/></xsl:if>
<xsl:if test="not(@solution)"><a _locID="Project">Project</a>: <xsl:value-of select="@name"/>
<xsl:for-each select="source">
<xsl:variable name="Hyperlink" select="@name"/>
<xsl:for-each select="event[@error-level='4']">
&#32;<A class="note"><xsl:attribute name="HREF"><xsl:value-of select="$Hyperlink"/></xsl:attribute><xsl:value-of select="@description"/></A>
</xsl:for-each>
</xsl:for-each>
</xsl:if>
</h2>
<table cellpadding="2" cellspacing="0" width="98%" border="1" bordercolor="white" class="infotable">
<tr>
<td nowrap="1" class="header" _locID="Filename">Filename</td>
<td nowrap="1" class="header" _locID="Status">Status</td>
<td nowrap="1" class="header" _locID="Errors">Errors</td>
<td nowrap="1" class="header" _locID="Warnings">Warnings</td>
</tr>
<xsl:for-each select="source">
<xsl:sort select="@name" order="ascending"/>
<xsl:variable name="source-id" select="generate-id(.)"/>
<xsl:if test="count(event)!=count(event[@error-level='4'])">
<tr class="row">
<td class="content">
<A HREF="javascript:"><xsl:attribute name="onClick">javascript:document.images['<xsl:value-of select="$source-id"/>'].click()</xsl:attribute><IMG border="0" _locID="IMG.alt" _locAttrData="alt" alt="expand/collapse section" class="expandable" height="11" onclick="changepic()" src="_UpgradeReport_Files/UpgradeReport_Plus.gif" width="9" ><xsl:attribute name="name"><xsl:value-of select="$source-id"/></xsl:attribute><xsl:attribute name="child">src<xsl:value-of select="$source-id"/></xsl:attribute></IMG></A>&#32;<xsl:value-of select="@name"/>
</td>
<td class="content">
<xsl:if test="count(event[@error-level='3'])=1">
<xsl:for-each select="event[@error-level='3']">
<xsl:if test="@description='Converted'"><a _locID="Converted1">Converted</a></xsl:if>
<xsl:if test="@description!='Converted'"><xsl:value-of select="@description"/></xsl:if>
</xsl:for-each>
</xsl:if>
<xsl:if test="count(event[@error-level='3'])!=1 and count(event[@error-level='3' and @description='Converted'])!=0"><a _locID="Converted2">Converted</a>
</xsl:if>
</td>
<td class="content"><xsl:value-of select="count(event[@error-level='2'])"/></td>
<td class="content"><xsl:value-of select="count(event[@error-level='1'])"/></td>
</tr>
<tr class="collapsed" bgcolor="#ffffff">
<xsl:attribute name="id">src<xsl:value-of select="$source-id"/></xsl:attribute>
<td colspan="7">
<table width="97%" border="1" bordercolor="#dcdcdc" rules="cols" class="issuetable">
<tr>
<td colspan="7" class="issuetitle" _locID="ConversionIssues">Conversion Report - <xsl:value-of select="@name"/>:</td>
</tr>
<xsl:for-each select="event[@error-level!='3']">
<xsl:if test="@error-level!='4'">
<tr>
<td class="issuenone" style="border-bottom:solid 1 lightgray">
<xsl:value-of select="@description"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td class="foot">
<xsl:if test="count(source)!=1">
<xsl:value-of select="count(source)"/><a _locID="file1"> files</a>
</xsl:if>
<xsl:if test="count(source)=1">
<a _locID="file2">1 file</a>
</xsl:if>
</td>
<td class="foot">
<a _locID="Converted3">Converted</a>:&#32;<xsl:value-of select="count(source/event[@error-level='3' and @description='Converted'])"/><BR />
<a _locID="NotConverted">Not converted</a>:&#32;<xsl:value-of select="count(source) - count(source/event[@error-level='3' and @description='Converted'])"/>
</td>
<td class="foot"><xsl:value-of select="count(source/event[@error-level='2'])"/></td>
<td class="foot"><xsl:value-of select="count(source/event[@error-level='1'])"/></td>
</tr>
</table>
</xsl:for-each>
</xsl:template>
<xsl:template match="Property">
<xsl:if test="@Name!='Date' and @Name!='Time' and @Name!='LogNumber' and @Name!='Solution'">
<tr><td nowrap="1"><b><xsl:value-of select="@Name"/>: </b><xsl:value-of select="@Value"/></td></tr>
</xsl:if>
</xsl:template>
<xsl:template match="UpgradeLog">
<html>
<head>
<META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="_UpgradeReport_Files\UpgradeReport.css" />
<title _locID="ConversionReport0">Conversion Report&#32;
<xsl:if test="Properties/Property[@Name='LogNumber']">
<xsl:value-of select="Properties/Property[@Name='LogNumber']/@Value"/>
</xsl:if>
</title>
<script language="javascript">
function outliner () {
oMe = window.event.srcElement
//get child element
var child = document.all[event.srcElement.getAttribute("child",false)];
//if child element exists, expand or collapse it.
if (null != child)
child.className = child.className == "collapsed" ? "expanded" : "collapsed";
}
function changepic() {
uMe = window.event.srcElement;
var check = uMe.src.toLowerCase();
if (check.lastIndexOf("upgradereport_plus.gif") != -1)
{
uMe.src = "_UpgradeReport_Files/UpgradeReport_Minus.gif"
}
else
{
uMe.src = "_UpgradeReport_Files/UpgradeReport_Plus.gif"
}
}
</script>
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" onclick="outliner();">
<h1 _locID="ConversionReport">Conversion Report - <xsl:value-of select="Properties/Property[@Name='Solution']/@Value"/></h1>
<p><span class="note">
<b _locID="TimeOfConversion">Time of Conversion:</b>&#32;&#32;<xsl:value-of select="Properties/Property[@Name='Date']/@Value"/>&#32;&#32;<xsl:value-of select="Properties/Property[@Name='Time']/@Value"/><br/>
</span></p>
<xsl:variable name="SortedEvents">
<Events>
<xsl:for-each select="Event">
<xsl:sort select="@Project" order="ascending"/>
<xsl:sort select="@Source" order="ascending"/>
<xsl:sort select="@ErrorLevel" order="ascending"/>
<Event>
<xsl:attribute name="Project"><xsl:value-of select="@Project"/> </xsl:attribute>
<xsl:attribute name="Solution"><xsl:value-of select="/UpgradeLog/Properties/Property[@Name='Solution']/@Value"/> </xsl:attribute>
<xsl:attribute name="Source"><xsl:value-of select="@Source"/> </xsl:attribute>
<xsl:attribute name="ErrorLevel"><xsl:value-of select="@ErrorLevel"/> </xsl:attribute>
<xsl:attribute name="Description"><xsl:value-of select="@Description"/> </xsl:attribute>
</Event>
</xsl:for-each>
</Events>
</xsl:variable>
<xsl:variable name="Projects">
<xsl:apply-templates select="msxsl:node-set($SortedEvents)/*" mode="createProjects"/>
</xsl:variable>
<xsl:apply-templates select="msxsl:node-set($Projects)/*"/>
<p></p><p>
<table class="note">
<tr>
<td nowrap="1">
<b _locID="ConversionSettings">Conversion Settings</b>
</td>
</tr>
<xsl:apply-templates select="Properties"/>
</table></p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 B

View File

@ -1,33 +0,0 @@
========================================================================
CONSOLE APPLICATION : TestCatch Project Overview
========================================================================
AppWizard has created this TestCatch application for you.
This file contains a summary of what you will find in each of the files that
make up your TestCatch application.
TestCatch.vcproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
TestCatch.cpp
This is the main application source file.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named TestCatch.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////

View File

@ -1,8 +0,0 @@
// TestCatch.cpp : Defines the entry point for the console application.
//
int main(int argc, char* argv[])
{
return 0;
}

View File

@ -36,7 +36,6 @@
4AB3D9A01616219100C9A0F8 /* catch_interfaces_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AB3D99F1616219100C9A0F8 /* catch_interfaces_config.cpp */; }; 4AB3D9A01616219100C9A0F8 /* catch_interfaces_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AB3D99F1616219100C9A0F8 /* catch_interfaces_config.cpp */; };
4AB3D9A2161621B500C9A0F8 /* catch_interfaces_generators.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AB3D9A1161621B500C9A0F8 /* catch_interfaces_generators.cpp */; }; 4AB3D9A2161621B500C9A0F8 /* catch_interfaces_generators.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AB3D9A1161621B500C9A0F8 /* catch_interfaces_generators.cpp */; };
4ACE21CC166CA1B300FB5509 /* catch_option.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ACE21CA166CA1B300FB5509 /* catch_option.cpp */; }; 4ACE21CC166CA1B300FB5509 /* catch_option.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ACE21CA166CA1B300FB5509 /* catch_option.cpp */; };
4AE1840B14EE4F230066340D /* catch_self_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AE1840A14EE4F230066340D /* catch_self_test.cpp */; };
4AEE032016142F910071E950 /* catch_common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AEE031F16142F910071E950 /* catch_common.cpp */; }; 4AEE032016142F910071E950 /* catch_common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AEE031F16142F910071E950 /* catch_common.cpp */; };
4AEE032316142FC70071E950 /* catch_debugger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AEE032216142FC70071E950 /* catch_debugger.cpp */; }; 4AEE032316142FC70071E950 /* catch_debugger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AEE032216142FC70071E950 /* catch_debugger.cpp */; };
4AEE032516142FF10071E950 /* catch_stream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AEE032416142FF10071E950 /* catch_stream.cpp */; }; 4AEE032516142FF10071E950 /* catch_stream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AEE032416142FF10071E950 /* catch_stream.cpp */; };
@ -57,6 +56,14 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
261488FA184C81130041FBEB /* catch_test_spec.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_test_spec.hpp; sourceTree = "<group>"; };
261488FB184C83EA0041FBEB /* catch_tags.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_tags.h; sourceTree = "<group>"; };
261488FC184D1DC10041FBEB /* catch_stream.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_stream.h; sourceTree = "<group>"; };
261488FD184D21290041FBEB /* catch_section_info.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_section_info.h; sourceTree = "<group>"; };
261488FE184DC32F0041FBEB /* catch_section.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_section.h; sourceTree = "<group>"; };
261488FF184DC4A20041FBEB /* catch_debugger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_debugger.h; sourceTree = "<group>"; };
262E7399184673A800CAC268 /* catch_reporter_bases.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_reporter_bases.hpp; sourceTree = "<group>"; };
262E739A1846759000CAC268 /* catch_common.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_common.hpp; sourceTree = "<group>"; };
263FD06017AF8DF200988A20 /* catch_timer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_timer.hpp; sourceTree = "<group>"; }; 263FD06017AF8DF200988A20 /* catch_timer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_timer.hpp; sourceTree = "<group>"; };
263FD06117AF8DF200988A20 /* catch_timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_timer.h; sourceTree = "<group>"; }; 263FD06117AF8DF200988A20 /* catch_timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_timer.h; sourceTree = "<group>"; };
266B06B616F3A60A004ED264 /* VariadicMacrosTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VariadicMacrosTests.cpp; path = ../../../SelfTest/VariadicMacrosTests.cpp; sourceTree = "<group>"; }; 266B06B616F3A60A004ED264 /* VariadicMacrosTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VariadicMacrosTests.cpp; path = ../../../SelfTest/VariadicMacrosTests.cpp; sourceTree = "<group>"; };
@ -95,7 +102,6 @@
4A6D0C20149B3D3B00DB3EAA /* CatchSelfTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CatchSelfTest; sourceTree = BUILT_PRODUCTS_DIR; }; 4A6D0C20149B3D3B00DB3EAA /* CatchSelfTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CatchSelfTest; sourceTree = BUILT_PRODUCTS_DIR; };
4A6D0C26149B3D3B00DB3EAA /* CatchSelfTest.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = CatchSelfTest.1; sourceTree = "<group>"; }; 4A6D0C26149B3D3B00DB3EAA /* CatchSelfTest.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = CatchSelfTest.1; sourceTree = "<group>"; };
4A6D0C2D149B3D9E00DB3EAA /* ApproxTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ApproxTests.cpp; path = ../../../SelfTest/ApproxTests.cpp; sourceTree = "<group>"; }; 4A6D0C2D149B3D9E00DB3EAA /* ApproxTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ApproxTests.cpp; path = ../../../SelfTest/ApproxTests.cpp; sourceTree = "<group>"; };
4A6D0C2E149B3D9E00DB3EAA /* catch_self_test.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; name = catch_self_test.hpp; path = ../../../SelfTest/catch_self_test.hpp; sourceTree = "<group>"; };
4A6D0C2F149B3D9E00DB3EAA /* ClassTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClassTests.cpp; path = ../../../SelfTest/ClassTests.cpp; sourceTree = "<group>"; }; 4A6D0C2F149B3D9E00DB3EAA /* ClassTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClassTests.cpp; path = ../../../SelfTest/ClassTests.cpp; sourceTree = "<group>"; };
4A6D0C30149B3D9E00DB3EAA /* ConditionTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ConditionTests.cpp; path = ../../../SelfTest/ConditionTests.cpp; sourceTree = "<group>"; }; 4A6D0C30149B3D9E00DB3EAA /* ConditionTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ConditionTests.cpp; path = ../../../SelfTest/ConditionTests.cpp; sourceTree = "<group>"; };
4A6D0C31149B3D9E00DB3EAA /* ExceptionTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ExceptionTests.cpp; path = ../../../SelfTest/ExceptionTests.cpp; sourceTree = "<group>"; }; 4A6D0C31149B3D9E00DB3EAA /* ExceptionTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ExceptionTests.cpp; path = ../../../SelfTest/ExceptionTests.cpp; sourceTree = "<group>"; };
@ -163,7 +169,6 @@
4AC91CD0155D8DA600DC5117 /* catch_expression_decomposer.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_expression_decomposer.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 4AC91CD0155D8DA600DC5117 /* catch_expression_decomposer.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_expression_decomposer.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
4ACE21C8166CA19700FB5509 /* catch_option.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_option.hpp; sourceTree = "<group>"; }; 4ACE21C8166CA19700FB5509 /* catch_option.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_option.hpp; sourceTree = "<group>"; };
4ACE21CA166CA1B300FB5509 /* catch_option.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_option.cpp; path = ../../../SelfTest/SurrogateCpps/catch_option.cpp; sourceTree = "<group>"; }; 4ACE21CA166CA1B300FB5509 /* catch_option.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_option.cpp; path = ../../../SelfTest/SurrogateCpps/catch_option.cpp; sourceTree = "<group>"; };
4AE1840A14EE4F230066340D /* catch_self_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_self_test.cpp; path = ../../../SelfTest/catch_self_test.cpp; sourceTree = "<group>"; };
4AEE031F16142F910071E950 /* catch_common.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_common.cpp; path = ../../../SelfTest/SurrogateCpps/catch_common.cpp; sourceTree = "<group>"; }; 4AEE031F16142F910071E950 /* catch_common.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_common.cpp; path = ../../../SelfTest/SurrogateCpps/catch_common.cpp; sourceTree = "<group>"; };
4AEE032216142FC70071E950 /* catch_debugger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_debugger.cpp; path = ../../../SelfTest/SurrogateCpps/catch_debugger.cpp; sourceTree = "<group>"; }; 4AEE032216142FC70071E950 /* catch_debugger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_debugger.cpp; path = ../../../SelfTest/SurrogateCpps/catch_debugger.cpp; sourceTree = "<group>"; };
4AEE032416142FF10071E950 /* catch_stream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_stream.cpp; path = ../../../SelfTest/SurrogateCpps/catch_stream.cpp; sourceTree = "<group>"; }; 4AEE032416142FF10071E950 /* catch_stream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_stream.cpp; path = ../../../SelfTest/SurrogateCpps/catch_stream.cpp; sourceTree = "<group>"; };
@ -220,8 +225,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
4A6D0C35149B3D9E00DB3EAA /* TestMain.cpp */, 4A6D0C35149B3D9E00DB3EAA /* TestMain.cpp */,
4A6D0C2E149B3D9E00DB3EAA /* catch_self_test.hpp */,
4AE1840A14EE4F230066340D /* catch_self_test.cpp */,
266E9AD317290E710061DAB2 /* Introspective Tests */, 266E9AD317290E710061DAB2 /* Introspective Tests */,
4A6D0C40149B3DAB00DB3EAA /* Tests */, 4A6D0C40149B3DAB00DB3EAA /* Tests */,
4A6D0C41149B3DE900DB3EAA /* Catch */, 4A6D0C41149B3DE900DB3EAA /* Catch */,
@ -282,6 +285,7 @@
4A6D0C65149B3E3D00DB3EAA /* reporters */ = { 4A6D0C65149B3E3D00DB3EAA /* reporters */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
262E7399184673A800CAC268 /* catch_reporter_bases.hpp */,
4A6D0C67149B3E3D00DB3EAA /* catch_reporter_junit.hpp */, 4A6D0C67149B3E3D00DB3EAA /* catch_reporter_junit.hpp */,
4A6D0C68149B3E3D00DB3EAA /* catch_reporter_xml.hpp */, 4A6D0C68149B3E3D00DB3EAA /* catch_reporter_xml.hpp */,
4AB42F84166F3E1A0099F2C8 /* catch_reporter_console.hpp */, 4AB42F84166F3E1A0099F2C8 /* catch_reporter_console.hpp */,
@ -319,6 +323,8 @@
4AC91CB4155B9EBF00DC5117 /* impl */ = { 4AC91CB4155B9EBF00DC5117 /* impl */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
4A6D0C5F149B3E3D00DB3EAA /* catch_section.hpp */,
261488FA184C81130041FBEB /* catch_test_spec.hpp */,
263FD06017AF8DF200988A20 /* catch_timer.hpp */, 263FD06017AF8DF200988A20 /* catch_timer.hpp */,
266E9AD117230ACF0061DAB2 /* catch_text.hpp */, 266E9AD117230ACF0061DAB2 /* catch_text.hpp */,
4A4B0F9C15CEFA8300AE2392 /* catch_impl.hpp */, 4A4B0F9C15CEFA8300AE2392 /* catch_impl.hpp */,
@ -345,7 +351,7 @@
4A6D0C5C149B3E3D00DB3EAA /* catch_result_type.h */, 4A6D0C5C149B3E3D00DB3EAA /* catch_result_type.h */,
4A6D0C5D149B3E3D00DB3EAA /* catch_assertionresult.h */, 4A6D0C5D149B3E3D00DB3EAA /* catch_assertionresult.h */,
4A9D84B315599AC900FBB209 /* catch_expressionresult_builder.h */, 4A9D84B315599AC900FBB209 /* catch_expressionresult_builder.h */,
4A6D0C5F149B3E3D00DB3EAA /* catch_section.hpp */, 261488FE184DC32F0041FBEB /* catch_section.h */,
4A3D7DD01503869D005F9203 /* catch_matchers.hpp */, 4A3D7DD01503869D005F9203 /* catch_matchers.hpp */,
4A9D84B11558FC0400FBB209 /* catch_tostring.hpp */, 4A9D84B11558FC0400FBB209 /* catch_tostring.hpp */,
4A6D0C46149B3E3D00DB3EAA /* catch_approx.hpp */, 4A6D0C46149B3E3D00DB3EAA /* catch_approx.hpp */,
@ -354,6 +360,7 @@
4AC91CD0155D8DA600DC5117 /* catch_expression_decomposer.hpp */, 4AC91CD0155D8DA600DC5117 /* catch_expression_decomposer.hpp */,
4A4B0F9A15CEF84800AE2392 /* catch_notimplemented_exception.h */, 4A4B0F9A15CEF84800AE2392 /* catch_notimplemented_exception.h */,
26847E5B16BBAB790043B9C1 /* catch_message.h */, 26847E5B16BBAB790043B9C1 /* catch_message.h */,
261488FD184D21290041FBEB /* catch_section_info.h */,
); );
name = Assertions; name = Assertions;
sourceTree = "<group>"; sourceTree = "<group>";
@ -380,6 +387,7 @@
4A084F1D15DAD15F0027E631 /* catch_test_spec.h */, 4A084F1D15DAD15F0027E631 /* catch_test_spec.h */,
4A8E4DCC160A344100194CBD /* catch_tags.hpp */, 4A8E4DCC160A344100194CBD /* catch_tags.hpp */,
26948287179EF7F900ED166E /* catch_test_case_tracker.hpp */, 26948287179EF7F900ED166E /* catch_test_case_tracker.hpp */,
261488FB184C83EA0041FBEB /* catch_tags.h */,
); );
name = "Test execution"; name = "Test execution";
sourceTree = "<group>"; sourceTree = "<group>";
@ -416,6 +424,7 @@
266ECD8D1713614B0030D735 /* catch_legacy_reporter_adapter.h */, 266ECD8D1713614B0030D735 /* catch_legacy_reporter_adapter.h */,
4A6D0C49149B3E3D00DB3EAA /* catch_common.h */, 4A6D0C49149B3E3D00DB3EAA /* catch_common.h */,
4A6D0C4B149B3E3D00DB3EAA /* catch_debugger.hpp */, 4A6D0C4B149B3E3D00DB3EAA /* catch_debugger.hpp */,
261488FF184DC4A20041FBEB /* catch_debugger.h */,
4A6D0C60149B3E3D00DB3EAA /* catch_stream.hpp */, 4A6D0C60149B3E3D00DB3EAA /* catch_stream.hpp */,
4A6D0C64149B3E3D00DB3EAA /* catch_xmlwriter.hpp */, 4A6D0C64149B3E3D00DB3EAA /* catch_xmlwriter.hpp */,
4AB1C73714F97C1300F31DF7 /* catch_console_colour.hpp */, 4AB1C73714F97C1300F31DF7 /* catch_console_colour.hpp */,
@ -427,6 +436,8 @@
26DACF2F17206D3400A21326 /* catch_text.h */, 26DACF2F17206D3400A21326 /* catch_text.h */,
263FD06117AF8DF200988A20 /* catch_timer.h */, 263FD06117AF8DF200988A20 /* catch_timer.h */,
26AEAF1617BEA18E009E32C9 /* catch_platform.h */, 26AEAF1617BEA18E009E32C9 /* catch_platform.h */,
262E739A1846759000CAC268 /* catch_common.hpp */,
261488FC184D1DC10041FBEB /* catch_stream.h */,
); );
name = Infrastructure; name = Infrastructure;
sourceTree = "<group>"; sourceTree = "<group>";
@ -499,7 +510,6 @@
4A6D0C3D149B3D9E00DB3EAA /* MiscTests.cpp in Sources */, 4A6D0C3D149B3D9E00DB3EAA /* MiscTests.cpp in Sources */,
4A6D0C3E149B3D9E00DB3EAA /* TestMain.cpp in Sources */, 4A6D0C3E149B3D9E00DB3EAA /* TestMain.cpp in Sources */,
4A6D0C3F149B3D9E00DB3EAA /* TrickyTests.cpp in Sources */, 4A6D0C3F149B3D9E00DB3EAA /* TrickyTests.cpp in Sources */,
4AE1840B14EE4F230066340D /* catch_self_test.cpp in Sources */,
4A8E4DD2160A352200194CBD /* catch_tags.cpp in Sources */, 4A8E4DD2160A352200194CBD /* catch_tags.cpp in Sources */,
4AEE032016142F910071E950 /* catch_common.cpp in Sources */, 4AEE032016142F910071E950 /* catch_common.cpp in Sources */,
4AEE032316142FC70071E950 /* catch_debugger.cpp in Sources */, 4AEE032316142FC70071E950 /* catch_debugger.cpp in Sources */,

View File

@ -8,7 +8,6 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
4A2894D615D3956000E20735 /* ApproxTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894D515D3956000E20735 /* ApproxTests.cpp */; }; 4A2894D615D3956000E20735 /* ApproxTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894D515D3956000E20735 /* ApproxTests.cpp */; };
4AB735F815D396ED00F9F7C3 /* catch_self_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894D815D3957500E20735 /* catch_self_test.cpp */; };
4AB735FA15D396F400F9F7C3 /* TestMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894E015D3957500E20735 /* TestMain.cpp */; }; 4AB735FA15D396F400F9F7C3 /* TestMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894E015D3957500E20735 /* TestMain.cpp */; };
4AB735FB15D3970C00F9F7C3 /* ClassTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894DA15D3957500E20735 /* ClassTests.cpp */; }; 4AB735FB15D3970C00F9F7C3 /* ClassTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894DA15D3957500E20735 /* ClassTests.cpp */; };
4AB735FC15D3971100F9F7C3 /* ConditionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894DB15D3957500E20735 /* ConditionTests.cpp */; }; 4AB735FC15D3971100F9F7C3 /* ConditionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894DB15D3957500E20735 /* ConditionTests.cpp */; };
@ -33,8 +32,6 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
4A2894D515D3956000E20735 /* ApproxTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ApproxTests.cpp; path = ../../../SelfTest/ApproxTests.cpp; sourceTree = "<group>"; }; 4A2894D515D3956000E20735 /* ApproxTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ApproxTests.cpp; path = ../../../SelfTest/ApproxTests.cpp; sourceTree = "<group>"; };
4A2894D815D3957500E20735 /* catch_self_test.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = catch_self_test.cpp; path = ../../../SelfTest/catch_self_test.cpp; sourceTree = "<group>"; };
4A2894D915D3957500E20735 /* catch_self_test.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = catch_self_test.hpp; path = ../../../SelfTest/catch_self_test.hpp; sourceTree = "<group>"; };
4A2894DA15D3957500E20735 /* ClassTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ClassTests.cpp; path = ../../../SelfTest/ClassTests.cpp; sourceTree = "<group>"; }; 4A2894DA15D3957500E20735 /* ClassTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ClassTests.cpp; path = ../../../SelfTest/ClassTests.cpp; sourceTree = "<group>"; };
4A2894DB15D3957500E20735 /* ConditionTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ConditionTests.cpp; path = ../../../SelfTest/ConditionTests.cpp; sourceTree = "<group>"; }; 4A2894DB15D3957500E20735 /* ConditionTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ConditionTests.cpp; path = ../../../SelfTest/ConditionTests.cpp; sourceTree = "<group>"; };
4A2894DC15D3957500E20735 /* ExceptionTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ExceptionTests.cpp; path = ../../../SelfTest/ExceptionTests.cpp; sourceTree = "<group>"; }; 4A2894DC15D3957500E20735 /* ExceptionTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ExceptionTests.cpp; path = ../../../SelfTest/ExceptionTests.cpp; sourceTree = "<group>"; };
@ -61,8 +58,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
4A2894E015D3957500E20735 /* TestMain.cpp */, 4A2894E015D3957500E20735 /* TestMain.cpp */,
4A2894D815D3957500E20735 /* catch_self_test.cpp */,
4A2894D915D3957500E20735 /* catch_self_test.hpp */,
); );
name = "Self Test"; name = "Self Test";
sourceTree = "<group>"; sourceTree = "<group>";
@ -159,7 +154,6 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
4A2894D615D3956000E20735 /* ApproxTests.cpp in Sources */, 4A2894D615D3956000E20735 /* ApproxTests.cpp in Sources */,
4AB735F815D396ED00F9F7C3 /* catch_self_test.cpp in Sources */,
4AB735FA15D396F400F9F7C3 /* TestMain.cpp in Sources */, 4AB735FA15D396F400F9F7C3 /* TestMain.cpp in Sources */,
4AB735FB15D3970C00F9F7C3 /* ClassTests.cpp in Sources */, 4AB735FB15D3970C00F9F7C3 /* ClassTests.cpp in Sources */,
4AB735FC15D3971100F9F7C3 /* ConditionTests.cpp in Sources */, 4AB735FC15D3971100F9F7C3 /* ConditionTests.cpp in Sources */,
@ -224,6 +218,7 @@
4A90B5E115D2E3E900EF71BC /* Debug */ = { 4A90B5E115D2E3E900EF71BC /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
HEADER_SEARCH_PATHS = "../../../single_include/**"; HEADER_SEARCH_PATHS = "../../../single_include/**";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
}; };
@ -232,6 +227,7 @@
4A90B5E215D2E3E900EF71BC /* Release */ = { 4A90B5E215D2E3E900EF71BC /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
HEADER_SEARCH_PATHS = "../../../single_include/**"; HEADER_SEARCH_PATHS = "../../../single_include/**";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
}; };

View File

@ -2,6 +2,7 @@ import os
import sys import sys
import re import re
import datetime import datetime
import string
from scriptCommon import catchPath from scriptCommon import catchPath
@ -9,6 +10,9 @@ versionParser = re.compile( r'(\s*const\sT\sLibraryVersionInfo<T>::value)\s*\(\s
includesParser = re.compile( r'\s*#include\s*"(.*)"' ) includesParser = re.compile( r'\s*#include\s*"(.*)"' )
guardParser = re.compile( r'\s*#.*_INCLUDED') guardParser = re.compile( r'\s*#.*_INCLUDED')
defineParser = re.compile( r'\s*#define') defineParser = re.compile( r'\s*#define')
ifParser = re.compile( r'\s*#if')
endIfParser = re.compile( r'\s*#endif')
ifImplParser = re.compile( r'\s*#if.*(CATCH_CONFIG_MAIN|CATCH_CONFIG_RUNNER)')
commentParser1 = re.compile( r'^\s*/\*') commentParser1 = re.compile( r'^\s*/\*')
commentParser2 = re.compile( r'^\s*\*') commentParser2 = re.compile( r'^\s*\*')
blankParser = re.compile( r'^\s*$') blankParser = re.compile( r'^\s*$')
@ -18,21 +22,48 @@ versionPath = os.path.join( rootPath, "internal/catch_version.hpp" )
readmePath = os.path.join( catchPath, "README.md" ) readmePath = os.path.join( catchPath, "README.md" )
outputPath = os.path.join( catchPath, 'single_include/catch.hpp' ) outputPath = os.path.join( catchPath, 'single_include/catch.hpp' )
bumpVersion = len(sys.argv) < 2 or sys.argv[1] <> "nobump" bumpVersion = True
includeImpl = True
for arg in sys.argv[1:]:
arg = string.lower(arg)
if arg == "nobump":
bumpVersion = False
print "Not bumping version number"
elif arg == "noimpl":
includeImpl = False
bumpVersion = False
print "Not including impl code (and not bumping version)"
else:
print "\n** Unrecognised argument: " + arg + " **\n"
exit(1)
out = open( outputPath, 'w' ) out = open( outputPath, 'w' )
ifdefs = 0
implIfDefs = -1
def write( line ):
if includeImpl or implIfDefs == -1:
out.write( line )
def parseFile( path, filename ): def parseFile( path, filename ):
global ifdefs
global implIfDefs
f = open( path + filename, 'r' ) f = open( path + filename, 'r' )
blanks = 0 blanks = 0
for line in f: for line in f:
if ifParser.match( line ):
ifdefs = ifdefs + 1
elif endIfParser.match( line ):
ifdefs = ifdefs - 1
m = includesParser.match( line ) m = includesParser.match( line )
if m: if m:
header = m.group(1) header = m.group(1)
headerPath, sep, headerFile = header.rpartition( "/" ) headerPath, sep, headerFile = header.rpartition( "/" )
if not headerFile in seenHeaders: if not headerFile in seenHeaders:
seenHeaders.add( headerFile ) seenHeaders.add( headerFile )
out.write( "// #included from: {0}\n".format( header ) ) write( "// #included from: {0}\n".format( header ) )
if( headerPath == "internal" and path.endswith( "internal/" ) ): if( headerPath == "internal" and path.endswith( "internal/" ) ):
headerPath = "" headerPath = ""
sep = "" sep = ""
@ -40,13 +71,16 @@ def parseFile( path, filename ):
parseFile( path + headerPath + sep, headerFile ) parseFile( path + headerPath + sep, headerFile )
else: else:
parseFile( rootPath + headerPath + sep, headerFile ) parseFile( rootPath + headerPath + sep, headerFile )
elif (not guardParser.match( line ) or defineParser.match( line ) ) and not commentParser1.match( line )and not commentParser2.match( line ): else:
if ifImplParser.match(line):
implIfDefs = ifdefs
if (not guardParser.match( line ) or defineParser.match( line ) ) and not commentParser1.match( line )and not commentParser2.match( line ):
if blankParser.match( line ): if blankParser.match( line ):
blanks = blanks + 1 blanks = blanks + 1
else: else:
blanks = 0 blanks = 0
if blanks < 2: if blanks < 2:
out.write( line.rstrip() + "\n" ) write( line.rstrip() + "\n" )
class Version: class Version:
def __init__(self): def __init__(self):

File diff suppressed because it is too large Load Diff