mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-13 17:05:39 +02:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2be372710e | ||
![]() |
0c093bee38 | ||
![]() |
dedc7c56ce | ||
![]() |
a9561ecb31 | ||
![]() |
e4df006568 | ||
![]() |
fb99cc556d | ||
![]() |
862d13138c | ||
![]() |
79acc0504b | ||
![]() |
f9afa2a68d | ||
![]() |
0c8c6b347a | ||
![]() |
40b6ad73df | ||
![]() |
30cebd6177 | ||
![]() |
e27c4ee042 | ||
![]() |
072114293b | ||
![]() |
f90ee9fb37 | ||
![]() |
c17ba0870a | ||
![]() |
79f01100e3 | ||
![]() |
ccf7f2842a | ||
![]() |
e0302db4a6 | ||
![]() |
88732e85b2 | ||
![]() |
1c9a6cab88 | ||
![]() |
fd7d35464b |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -14,6 +14,8 @@ Breakpoints.xcbkptlist
|
|||||||
projects/VS2010/TestCatch/_UpgradeReport_Files/
|
projects/VS2010/TestCatch/_UpgradeReport_Files/
|
||||||
projects/VS2010/TestCatch/TestCatch/TestCatch.vcxproj.filters
|
projects/VS2010/TestCatch/TestCatch/TestCatch.vcxproj.filters
|
||||||
projects/VisualStudio/TestCatch/UpgradeLog.XML
|
projects/VisualStudio/TestCatch/UpgradeLog.XML
|
||||||
|
projects/CMake/.idea
|
||||||
|
projects/CMake/cmake-build-debug
|
||||||
UpgradeLog.XML
|
UpgradeLog.XML
|
||||||
Resources/DWARF
|
Resources/DWARF
|
||||||
projects/XCode/iOSTest/Build
|
projects/XCode/iOSTest/Build
|
||||||
|
12
.travis.yml
12
.travis.yml
@@ -119,23 +119,22 @@ matrix:
|
|||||||
|
|
||||||
# 3/ OSX Clang Builds
|
# 3/ OSX Clang Builds
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode6.4
|
osx_image: xcode7
|
||||||
compiler: clang
|
compiler: clang
|
||||||
env: COMPILER='ccache clang++' BUILD_TYPE='Debug'
|
env: COMPILER='ccache clang++' BUILD_TYPE='Debug'
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode6.4
|
osx_image: xcode7
|
||||||
compiler: clang
|
compiler: clang
|
||||||
env: COMPILER='ccache clang++' BUILD_TYPE='Release'
|
env: COMPILER='ccache clang++' BUILD_TYPE='Release'
|
||||||
|
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode7
|
osx_image: xcode8
|
||||||
compiler: clang
|
compiler: clang
|
||||||
env: COMPILER='ccache clang++' BUILD_TYPE='Debug'
|
env: COMPILER='ccache clang++' BUILD_TYPE='Debug'
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode7
|
osx_image: xcode8
|
||||||
compiler: clang
|
compiler: clang
|
||||||
env: COMPILER='ccache clang++' BUILD_TYPE='Release'
|
env: COMPILER='ccache clang++' BUILD_TYPE='Release'
|
||||||
|
|
||||||
@@ -149,7 +148,8 @@ install:
|
|||||||
mkdir cmake && travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
|
mkdir cmake && travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
|
||||||
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
|
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
|
||||||
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
||||||
brew install cmake ccache
|
which cmake || brew install cmake
|
||||||
|
which ccache || brew install ccache
|
||||||
fi
|
fi
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||

|

|
||||||
|
|
||||||
*v1.5.7*
|
*v1.5.9*
|
||||||
|
|
||||||
Build status (on Travis CI) [](https://travis-ci.org/philsquared/Catch)
|
Build status (on Travis CI) [](https://travis-ci.org/philsquared/Catch)
|
||||||
|
|
||||||
|
5
include/external/clara.h
vendored
5
include/external/clara.h
vendored
@@ -396,9 +396,12 @@ namespace Clara {
|
|||||||
inline void convertInto( std::string const& _source, std::string& _dest ) {
|
inline void convertInto( std::string const& _source, std::string& _dest ) {
|
||||||
_dest = _source;
|
_dest = _source;
|
||||||
}
|
}
|
||||||
|
char toLowerCh(char c) {
|
||||||
|
return static_cast<char>( ::tolower( c ) );
|
||||||
|
}
|
||||||
inline void convertInto( std::string const& _source, bool& _dest ) {
|
inline void convertInto( std::string const& _source, bool& _dest ) {
|
||||||
std::string sourceLC = _source;
|
std::string sourceLC = _source;
|
||||||
std::transform( sourceLC.begin(), sourceLC.end(), sourceLC.begin(), ::tolower );
|
std::transform( sourceLC.begin(), sourceLC.end(), sourceLC.begin(), toLowerCh );
|
||||||
if( sourceLC == "y" || sourceLC == "1" || sourceLC == "true" || sourceLC == "yes" || sourceLC == "on" )
|
if( sourceLC == "y" || sourceLC == "1" || sourceLC == "true" || sourceLC == "yes" || sourceLC == "on" )
|
||||||
_dest = true;
|
_dest = true;
|
||||||
else if( sourceLC == "n" || sourceLC == "0" || sourceLC == "false" || sourceLC == "no" || sourceLC == "off" )
|
else if( sourceLC == "n" || sourceLC == "0" || sourceLC == "false" || sourceLC == "no" || sourceLC == "off" )
|
||||||
|
@@ -21,8 +21,11 @@ namespace Catch {
|
|||||||
bool contains( std::string const& s, std::string const& infix ) {
|
bool contains( std::string const& s, std::string const& infix ) {
|
||||||
return s.find( infix ) != std::string::npos;
|
return s.find( infix ) != std::string::npos;
|
||||||
}
|
}
|
||||||
|
char toLowerCh(char c) {
|
||||||
|
return static_cast<char>( ::tolower( c ) );
|
||||||
|
}
|
||||||
void toLowerInPlace( std::string& s ) {
|
void toLowerInPlace( std::string& s ) {
|
||||||
std::transform( s.begin(), s.end(), s.begin(), ::tolower );
|
std::transform( s.begin(), s.end(), s.begin(), toLowerCh );
|
||||||
}
|
}
|
||||||
std::string toLower( std::string const& s ) {
|
std::string toLower( std::string const& s ) {
|
||||||
std::string lc = s;
|
std::string lc = s;
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
|
@@ -24,9 +24,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
struct RandomNumberGenerator {
|
struct RandomNumberGenerator {
|
||||||
typedef int result_type;
|
typedef std::ptrdiff_t result_type;
|
||||||
|
|
||||||
result_type operator()( result_type n ) const { return std::rand() % n; }
|
result_type operator()( result_type n ) const { return std::rand() % n; }
|
||||||
|
|
||||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version libraryVersion( 1, 5, 7, "", 0 );
|
Version libraryVersion( 1, 5, 9, "", 0 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,6 +20,7 @@ namespace Catch {
|
|||||||
public:
|
public:
|
||||||
XmlReporter( ReporterConfig const& _config )
|
XmlReporter( ReporterConfig const& _config )
|
||||||
: StreamingReporterBase( _config ),
|
: StreamingReporterBase( _config ),
|
||||||
|
m_xml(_config.stream()),
|
||||||
m_sectionDepth( 0 )
|
m_sectionDepth( 0 )
|
||||||
{
|
{
|
||||||
m_reporterPrefs.shouldRedirectStdOut = true;
|
m_reporterPrefs.shouldRedirectStdOut = true;
|
||||||
@@ -39,7 +40,6 @@ namespace Catch {
|
|||||||
|
|
||||||
virtual void testRunStarting( TestRunInfo const& testInfo ) CATCH_OVERRIDE {
|
virtual void testRunStarting( TestRunInfo const& testInfo ) CATCH_OVERRIDE {
|
||||||
StreamingReporterBase::testRunStarting( testInfo );
|
StreamingReporterBase::testRunStarting( testInfo );
|
||||||
m_xml.setStream( stream );
|
|
||||||
m_xml.startElement( "Catch" );
|
m_xml.startElement( "Catch" );
|
||||||
if( !m_config->name().empty() )
|
if( !m_config->name().empty() )
|
||||||
m_xml.writeAttribute( "name", m_config->name() );
|
m_xml.writeAttribute( "name", m_config->name() );
|
||||||
@@ -115,7 +115,7 @@ namespace Catch {
|
|||||||
.writeText( assertionResult.getMessage() );
|
.writeText( assertionResult.getMessage() );
|
||||||
break;
|
break;
|
||||||
case ResultWas::FatalErrorCondition:
|
case ResultWas::FatalErrorCondition:
|
||||||
m_xml.scopedElement( "Fatal Error Condition" )
|
m_xml.scopedElement( "FatalErrorCondition" )
|
||||||
.writeAttribute( "filename", assertionResult.getSourceInfo().file )
|
.writeAttribute( "filename", assertionResult.getSourceInfo().file )
|
||||||
.writeAttribute( "line", assertionResult.getSourceInfo().line )
|
.writeAttribute( "line", assertionResult.getSourceInfo().line )
|
||||||
.writeText( assertionResult.getMessage() );
|
.writeText( assertionResult.getMessage() );
|
||||||
|
@@ -7,31 +7,51 @@ get_filename_component(CATCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
|
|||||||
get_filename_component(CATCH_DIR "${CATCH_DIR}" PATH)
|
get_filename_component(CATCH_DIR "${CATCH_DIR}" PATH)
|
||||||
set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
|
set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
|
||||||
if(USE_CPP11)
|
if(USE_CPP11)
|
||||||
## We can't turn this on by default, since it breaks on travis
|
## We can't turn this on by default, since it breaks on travis
|
||||||
message(STATUS "Enabling C++11")
|
message(STATUS "Enabling C++11")
|
||||||
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
|
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# define the sources of the self test
|
# define the sources of the self test
|
||||||
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}/ClassTests.cpp
|
${SELF_TEST_DIR}/ClassTests.cpp
|
||||||
${SELF_TEST_DIR}/ConditionTests.cpp
|
${SELF_TEST_DIR}/ConditionTests.cpp
|
||||||
${SELF_TEST_DIR}/ExceptionTests.cpp
|
${SELF_TEST_DIR}/ExceptionTests.cpp
|
||||||
${SELF_TEST_DIR}/GeneratorTests.cpp
|
${SELF_TEST_DIR}/GeneratorTests.cpp
|
||||||
${SELF_TEST_DIR}/MessageTests.cpp
|
${SELF_TEST_DIR}/MessageTests.cpp
|
||||||
${SELF_TEST_DIR}/MiscTests.cpp
|
${SELF_TEST_DIR}/MiscTests.cpp
|
||||||
${SELF_TEST_DIR}/PartTrackerTests.cpp
|
${SELF_TEST_DIR}/PartTrackerTests.cpp
|
||||||
${SELF_TEST_DIR}/TestMain.cpp
|
${SELF_TEST_DIR}/TestMain.cpp
|
||||||
${SELF_TEST_DIR}/TrickyTests.cpp
|
${SELF_TEST_DIR}/TrickyTests.cpp
|
||||||
${SELF_TEST_DIR}/VariadicMacrosTests.cpp
|
${SELF_TEST_DIR}/VariadicMacrosTests.cpp
|
||||||
${SELF_TEST_DIR}/EnumToString.cpp
|
${SELF_TEST_DIR}/EnumToString.cpp
|
||||||
${SELF_TEST_DIR}/ToStringPair.cpp
|
${SELF_TEST_DIR}/ToStringPair.cpp
|
||||||
${SELF_TEST_DIR}/ToStringVector.cpp
|
${SELF_TEST_DIR}/ToStringVector.cpp
|
||||||
${SELF_TEST_DIR}/ToStringWhich.cpp
|
${SELF_TEST_DIR}/ToStringWhich.cpp
|
||||||
${SELF_TEST_DIR}/ToStringTuple.cpp
|
${SELF_TEST_DIR}/ToStringTuple.cpp
|
||||||
)
|
${SELF_TEST_DIR}/CmdLineTests.cpp
|
||||||
|
${SELF_TEST_DIR}/TagAliasTests.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_common.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_console_colour.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_debugger.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_capture.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_config.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_exception.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_generators.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_registry_hub.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_reporter.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_runner.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_testcase.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_message.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_option.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_ptr.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_stream.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_streambuf.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_test_spec.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_xmlwriter.cpp
|
||||||
|
)
|
||||||
|
|
||||||
# configure the executable
|
# configure the executable
|
||||||
include_directories(${CATCH_DIR}/include)
|
include_directories(${CATCH_DIR}/include)
|
||||||
|
@@ -3,6 +3,46 @@
|
|||||||
CatchSelfTest is a <version> host application.
|
CatchSelfTest is a <version> host application.
|
||||||
Run with -? for options
|
Run with -? for options
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
'Not' checks that should fail
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ConditionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( false != false )
|
||||||
|
|
||||||
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( true != true )
|
||||||
|
|
||||||
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( !true )
|
||||||
|
with expansion:
|
||||||
|
false
|
||||||
|
|
||||||
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK_FALSE( true )
|
||||||
|
|
||||||
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( !trueValue )
|
||||||
|
with expansion:
|
||||||
|
false
|
||||||
|
|
||||||
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK_FALSE( trueValue )
|
||||||
|
with expansion:
|
||||||
|
!true
|
||||||
|
|
||||||
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( !(1 == 1) )
|
||||||
|
with expansion:
|
||||||
|
false
|
||||||
|
|
||||||
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK_FALSE( 1 == 1 )
|
||||||
|
with expansion:
|
||||||
|
!(1 == 1)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
A METHOD_AS_TEST_CASE based test run that fails
|
A METHOD_AS_TEST_CASE based test run that fails
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -25,6 +65,97 @@ ClassTests.cpp:<line number>: FAILED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
1 == 2
|
1 == 2
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
A couple of nested sections followed by a failure
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
|
explicitly with message:
|
||||||
|
to infinity and beyond
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
A failing expression with a non streamable type is still captured
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
TrickyTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
TrickyTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( &o1 == &o2 )
|
||||||
|
with expansion:
|
||||||
|
0x<hex digits> == 0x<hex digits>
|
||||||
|
|
||||||
|
TrickyTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( o1 == o2 )
|
||||||
|
with expansion:
|
||||||
|
{?} == {?}
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
An unchecked exception reports the line of the last assertion
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ExceptionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
|
{Unknown expression after the reported line}
|
||||||
|
due to unexpected exception with message:
|
||||||
|
unexpected exception
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Contains string matcher
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK_THAT( testStringForMatching(), Contains( "not there" ) )
|
||||||
|
with expansion:
|
||||||
|
"this string contains 'abc' as a substring" contains: "not there"
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Custom exceptions can be translated when testing for nothrow
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ExceptionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
|
REQUIRE_NOTHROW( throwCustom() )
|
||||||
|
due to unexpected exception with message:
|
||||||
|
custom exception - not std
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Custom exceptions can be translated when testing for throwing as something else
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ExceptionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
|
REQUIRE_THROWS_AS( throwCustom() )
|
||||||
|
due to unexpected exception with message:
|
||||||
|
custom exception - not std
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Custom std-exceptions can be custom translated
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ExceptionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
|
due to unexpected exception with message:
|
||||||
|
custom std exception
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
EndsWith string matcher
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK_THAT( testStringForMatching(), EndsWith( "this" ) )
|
||||||
|
with expansion:
|
||||||
|
"this string contains 'abc' as a substring" ends with: "this"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Equality checks that should fail
|
Equality checks that should fail
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -96,6 +227,100 @@ ConditionTests.cpp:<line number>: FAILED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
1.3 == Approx( 1.301 )
|
1.3 == Approx( 1.301 )
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Equals string matcher
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK_THAT( testStringForMatching(), Equals( "something else" ) )
|
||||||
|
with expansion:
|
||||||
|
"this string contains 'abc' as a substring" equals: "something else"
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Expected exceptions that don't throw or unexpected exceptions fail the test
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ExceptionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK_THROWS_AS( thisThrows() )
|
||||||
|
due to unexpected exception with message:
|
||||||
|
expected exception
|
||||||
|
|
||||||
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK_THROWS_AS( thisDoesntThrow() )
|
||||||
|
because no exception was thrown where one was expected:
|
||||||
|
|
||||||
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK_NOTHROW( thisThrows() )
|
||||||
|
due to unexpected exception with message:
|
||||||
|
expected exception
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
FAIL aborts the test
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MessageTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>: FAILED:
|
||||||
|
explicitly with message:
|
||||||
|
This is a failure
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
FAIL does not require an argument
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MessageTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>: FAILED:
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
INFO and WARN do not abort tests
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MessageTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>:
|
||||||
|
warning:
|
||||||
|
this is a warning
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
INFO gets logged on failure
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MessageTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>: FAILED:
|
||||||
|
REQUIRE( a == 1 )
|
||||||
|
with expansion:
|
||||||
|
2 == 1
|
||||||
|
with messages:
|
||||||
|
this message should be logged
|
||||||
|
so should this
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
INFO gets logged on failure, even if captured before successful assertions
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MessageTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( a == 1 )
|
||||||
|
with expansion:
|
||||||
|
2 == 1
|
||||||
|
with messages:
|
||||||
|
this message may be logged later
|
||||||
|
this message should be logged
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( a == 0 )
|
||||||
|
with expansion:
|
||||||
|
2 == 0
|
||||||
|
with message:
|
||||||
|
and this, but later
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Inequality checks that should fail
|
Inequality checks that should fail
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -127,6 +352,60 @@ ConditionTests.cpp:<line number>: FAILED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
5 != 5
|
5 != 5
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Matchers can be composed with both && and || - failing
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) )
|
||||||
|
with expansion:
|
||||||
|
"this string contains 'abc' as a substring" ( ( contains: "string" or
|
||||||
|
contains: "different" ) and contains: "random" )
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Matchers can be negated (Not) with the ! operator - failing
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK_THAT( testStringForMatching(), !Contains( "substring" ) )
|
||||||
|
with expansion:
|
||||||
|
"this string contains 'abc' as a substring" not contains: "substring"
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Mismatching exception messages failing the test
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ExceptionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
|
REQUIRE_THROWS_WITH( thisThrows(), "should fail" )
|
||||||
|
with expansion:
|
||||||
|
expected exception
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Nice descriptive name
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>:
|
||||||
|
warning:
|
||||||
|
This one ran
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Non-std exceptions can be translated
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ExceptionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
|
due to unexpected exception with message:
|
||||||
|
custom exception
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Ordering comparison checks that should fail
|
Ordering comparison checks that should fail
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -229,64 +508,99 @@ with expansion:
|
|||||||
"hello" <= "a"
|
"hello" <= "a"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
'Not' checks that should fail
|
Output from all sections is reported
|
||||||
|
one
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
ConditionTests.cpp:<line number>
|
MessageTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
MessageTests.cpp:<line number>: FAILED:
|
||||||
CHECK( false != false )
|
explicitly with message:
|
||||||
|
Message from section one
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK( true != true )
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK( !true )
|
|
||||||
with expansion:
|
|
||||||
false
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK_FALSE( true )
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK( !trueValue )
|
|
||||||
with expansion:
|
|
||||||
false
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK_FALSE( trueValue )
|
|
||||||
with expansion:
|
|
||||||
!true
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK( !(1 == 1) )
|
|
||||||
with expansion:
|
|
||||||
false
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK_FALSE( 1 == 1 )
|
|
||||||
with expansion:
|
|
||||||
!(1 == 1)
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Expected exceptions that don't throw or unexpected exceptions fail the test
|
Output from all sections is reported
|
||||||
|
two
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MessageTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>: FAILED:
|
||||||
|
explicitly with message:
|
||||||
|
Message from section two
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Pointers can be converted to strings
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MessageTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>:
|
||||||
|
warning:
|
||||||
|
actual address of p: 0x<hex digits>
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>:
|
||||||
|
warning:
|
||||||
|
toString(p): 0x<hex digits>
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
SCOPED_INFO is reset for each loop
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MessageTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>: FAILED:
|
||||||
|
REQUIRE( i < 10 )
|
||||||
|
with expansion:
|
||||||
|
10 < 10
|
||||||
|
with messages:
|
||||||
|
current counter 10
|
||||||
|
i := 10
|
||||||
|
|
||||||
|
A string sent directly to stdout
|
||||||
|
A string sent directly to stderr
|
||||||
|
Message from section one
|
||||||
|
Message from section two
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
StartsWith string matcher
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK_THAT( testStringForMatching(), StartsWith( "string" ) )
|
||||||
|
with expansion:
|
||||||
|
"this string contains 'abc' as a substring" starts with: "string"
|
||||||
|
|
||||||
|
hello
|
||||||
|
hello
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Tabs and newlines show in output
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( s1 == s2 )
|
||||||
|
with expansion:
|
||||||
|
"if ($b == 10) {
|
||||||
|
$a= 20;
|
||||||
|
}"
|
||||||
|
==
|
||||||
|
"if ($b == 10) {
|
||||||
|
$a = 20;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Unexpected exceptions can be translated
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
ExceptionTests.cpp:<line number>
|
ExceptionTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
CHECK_THROWS_AS( thisThrows() )
|
|
||||||
due to unexpected exception with message:
|
due to unexpected exception with message:
|
||||||
expected exception
|
3.14
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK_THROWS_AS( thisDoesntThrow() )
|
|
||||||
because no exception was thrown where one was expected:
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK_NOTHROW( thisThrows() )
|
|
||||||
due to unexpected exception with message:
|
|
||||||
expected exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
When unchecked exceptions are thrown directly they are always failures
|
When unchecked exceptions are thrown directly they are always failures
|
||||||
@@ -299,29 +613,8 @@ due to unexpected exception with message:
|
|||||||
unexpected exception
|
unexpected exception
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
An unchecked exception reports the line of the last assertion
|
When unchecked exceptions are thrown during a CHECK the test should abort and
|
||||||
-------------------------------------------------------------------------------
|
fail
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
{Unknown expression after the reported line}
|
|
||||||
due to unexpected exception with message:
|
|
||||||
unexpected exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
When unchecked exceptions are thrown from sections they are always failures
|
|
||||||
section name
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
due to unexpected exception with message:
|
|
||||||
unexpected exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
When unchecked exceptions are thrown from functions they are always failures
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
ExceptionTests.cpp:<line number>
|
ExceptionTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@@ -344,8 +637,7 @@ due to unexpected exception with message:
|
|||||||
expected exception
|
expected exception
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
When unchecked exceptions are thrown during a CHECK the test should abort and
|
When unchecked exceptions are thrown from functions they are always failures
|
||||||
fail
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
ExceptionTests.cpp:<line number>
|
ExceptionTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@@ -356,168 +648,69 @@ due to unexpected exception with message:
|
|||||||
expected exception
|
expected exception
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Non-std exceptions can be translated
|
When unchecked exceptions are thrown from sections they are always failures
|
||||||
|
section name
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
ExceptionTests.cpp:<line number>
|
ExceptionTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
due to unexpected exception with message:
|
due to unexpected exception with message:
|
||||||
custom exception
|
unexpected exception
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Custom std-exceptions can be custom translated
|
Where the LHS is not a simple value
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
ExceptionTests.cpp:<line number>
|
TrickyTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
TrickyTests.cpp:<line number>:
|
||||||
due to unexpected exception with message:
|
|
||||||
custom std exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Custom exceptions can be translated when testing for nothrow
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
REQUIRE_NOTHROW( throwCustom() )
|
|
||||||
due to unexpected exception with message:
|
|
||||||
custom exception - not std
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Custom exceptions can be translated when testing for throwing as something else
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
REQUIRE_THROWS_AS( throwCustom() )
|
|
||||||
due to unexpected exception with message:
|
|
||||||
custom exception - not std
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Unexpected exceptions can be translated
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
due to unexpected exception with message:
|
|
||||||
3.14
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Mismatching exception messages failing the test
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
REQUIRE_THROWS_WITH( thisThrows(), "should fail" )
|
|
||||||
with expansion:
|
|
||||||
expected exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
INFO and WARN do not abort tests
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MessageTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MessageTests.cpp:<line number>:
|
|
||||||
warning:
|
warning:
|
||||||
this is a warning
|
Uncomment the code in this test to check that it gives a sensible compiler
|
||||||
|
error
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
INFO gets logged on failure
|
Where there is more to the expression after the RHS
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
MessageTests.cpp:<line number>
|
TrickyTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
|
|
||||||
MessageTests.cpp:<line number>: FAILED:
|
TrickyTests.cpp:<line number>:
|
||||||
REQUIRE( a == 1 )
|
warning:
|
||||||
|
Uncomment the code in this test to check that it gives a sensible compiler
|
||||||
|
error
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
checkedElse, failing
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
|
CHECKED_ELSE( flag )
|
||||||
with expansion:
|
with expansion:
|
||||||
2 == 1
|
false
|
||||||
with messages:
|
|
||||||
this message should be logged
|
|
||||||
so should this
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
INFO gets logged on failure, even if captured before successful assertions
|
REQUIRE( testCheckedElse( false ) )
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MessageTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MessageTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK( a == 1 )
|
|
||||||
with expansion:
|
with expansion:
|
||||||
2 == 1
|
false
|
||||||
with messages:
|
|
||||||
this message may be logged later
|
|
||||||
this message should be logged
|
|
||||||
|
|
||||||
MessageTests.cpp:<line number>: FAILED:
|
-------------------------------------------------------------------------------
|
||||||
CHECK( a == 0 )
|
checkedIf, failing
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
|
CHECKED_IF( flag )
|
||||||
with expansion:
|
with expansion:
|
||||||
2 == 0
|
false
|
||||||
with message:
|
|
||||||
and this, but later
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
FAIL aborts the test
|
REQUIRE( testCheckedIf( false ) )
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MessageTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MessageTests.cpp:<line number>: FAILED:
|
|
||||||
explicitly with message:
|
|
||||||
This is a failure
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
FAIL does not require an argument
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MessageTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MessageTests.cpp:<line number>: FAILED:
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Output from all sections is reported
|
|
||||||
one
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MessageTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MessageTests.cpp:<line number>: FAILED:
|
|
||||||
explicitly with message:
|
|
||||||
Message from section one
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Output from all sections is reported
|
|
||||||
two
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MessageTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MessageTests.cpp:<line number>: FAILED:
|
|
||||||
explicitly with message:
|
|
||||||
Message from section two
|
|
||||||
|
|
||||||
Message from section one
|
|
||||||
Message from section two
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
SCOPED_INFO is reset for each loop
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MessageTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MessageTests.cpp:<line number>: FAILED:
|
|
||||||
REQUIRE( i < 10 )
|
|
||||||
with expansion:
|
with expansion:
|
||||||
10 < 10
|
false
|
||||||
with messages:
|
|
||||||
current counter 10
|
|
||||||
i := 10
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
just failure
|
just failure
|
||||||
@@ -529,45 +722,6 @@ MessageTests.cpp:<line number>: FAILED:
|
|||||||
explicitly with message:
|
explicitly with message:
|
||||||
Previous info should not be seen
|
Previous info should not be seen
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
sends information to INFO
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MessageTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MessageTests.cpp:<line number>: FAILED:
|
|
||||||
REQUIRE( false )
|
|
||||||
with messages:
|
|
||||||
hi
|
|
||||||
i := 7
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Pointers can be converted to strings
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MessageTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MessageTests.cpp:<line number>:
|
|
||||||
warning:
|
|
||||||
actual address of p: 0x<hex digits>
|
|
||||||
|
|
||||||
MessageTests.cpp:<line number>:
|
|
||||||
warning:
|
|
||||||
toString(p): 0x<hex digits>
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
more nested SECTION tests
|
|
||||||
s1
|
|
||||||
s2
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MiscTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MiscTests.cpp:<line number>: FAILED:
|
|
||||||
REQUIRE( a == b )
|
|
||||||
with expansion:
|
|
||||||
1 == 2
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
looped SECTION tests
|
looped SECTION tests
|
||||||
s1
|
s1
|
||||||
@@ -628,39 +782,18 @@ with expansion:
|
|||||||
with message:
|
with message:
|
||||||
Testing if fib[7] (21) is even
|
Testing if fib[7] (21) is even
|
||||||
|
|
||||||
A string sent directly to stdout
|
|
||||||
A string sent directly to stderr
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
checkedIf, failing
|
more nested SECTION tests
|
||||||
|
s1
|
||||||
|
s2
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
MiscTests.cpp:<line number>
|
MiscTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
|
|
||||||
MiscTests.cpp:<line number>: FAILED:
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
CHECKED_IF( flag )
|
REQUIRE( a == b )
|
||||||
with expansion:
|
with expansion:
|
||||||
false
|
1 == 2
|
||||||
|
|
||||||
MiscTests.cpp:<line number>: FAILED:
|
|
||||||
REQUIRE( testCheckedIf( false ) )
|
|
||||||
with expansion:
|
|
||||||
false
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
checkedElse, failing
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MiscTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MiscTests.cpp:<line number>: FAILED:
|
|
||||||
CHECKED_ELSE( flag )
|
|
||||||
with expansion:
|
|
||||||
false
|
|
||||||
|
|
||||||
MiscTests.cpp:<line number>: FAILED:
|
|
||||||
REQUIRE( testCheckedElse( false ) )
|
|
||||||
with expansion:
|
|
||||||
false
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
send a single char to INFO
|
send a single char to INFO
|
||||||
@@ -674,149 +807,16 @@ with message:
|
|||||||
3
|
3
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Contains string matcher
|
sends information to INFO
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
MiscTests.cpp:<line number>
|
MessageTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
|
|
||||||
MiscTests.cpp:<line number>: FAILED:
|
MessageTests.cpp:<line number>: FAILED:
|
||||||
CHECK_THAT( testStringForMatching(), Contains( "not there" ) )
|
REQUIRE( false )
|
||||||
with expansion:
|
with messages:
|
||||||
"this string contains 'abc' as a substring" contains: "not there"
|
hi
|
||||||
|
i := 7
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
StartsWith string matcher
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MiscTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MiscTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK_THAT( testStringForMatching(), StartsWith( "string" ) )
|
|
||||||
with expansion:
|
|
||||||
"this string contains 'abc' as a substring" starts with: "string"
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
EndsWith string matcher
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MiscTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MiscTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK_THAT( testStringForMatching(), EndsWith( "this" ) )
|
|
||||||
with expansion:
|
|
||||||
"this string contains 'abc' as a substring" ends with: "this"
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Equals string matcher
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MiscTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MiscTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK_THAT( testStringForMatching(), Equals( "something else" ) )
|
|
||||||
with expansion:
|
|
||||||
"this string contains 'abc' as a substring" equals: "something else"
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Matchers can be composed with both && and || - failing
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MiscTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MiscTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) )
|
|
||||||
with expansion:
|
|
||||||
"this string contains 'abc' as a substring" ( ( contains: "string" or
|
|
||||||
contains: "different" ) and contains: "random" )
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Matchers can be negated (Not) with the ! operator - failing
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MiscTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MiscTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK_THAT( testStringForMatching(), !Contains( "substring" ) )
|
|
||||||
with expansion:
|
|
||||||
"this string contains 'abc' as a substring" not contains: "substring"
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Nice descriptive name
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MiscTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MiscTests.cpp:<line number>:
|
|
||||||
warning:
|
|
||||||
This one ran
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
A couple of nested sections followed by a failure
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MiscTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MiscTests.cpp:<line number>: FAILED:
|
|
||||||
explicitly with message:
|
|
||||||
to infinity and beyond
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Tabs and newlines show in output
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
MiscTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
MiscTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK( s1 == s2 )
|
|
||||||
with expansion:
|
|
||||||
"if ($b == 10) {
|
|
||||||
$a= 20;
|
|
||||||
}"
|
|
||||||
==
|
|
||||||
"if ($b == 10) {
|
|
||||||
$a = 20;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
|
|
||||||
hello
|
|
||||||
hello
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Where there is more to the expression after the RHS
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
TrickyTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
TrickyTests.cpp:<line number>:
|
|
||||||
warning:
|
|
||||||
Uncomment the code in this test to check that it gives a sensible compiler
|
|
||||||
error
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Where the LHS is not a simple value
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
TrickyTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
TrickyTests.cpp:<line number>:
|
|
||||||
warning:
|
|
||||||
Uncomment the code in this test to check that it gives a sensible compiler
|
|
||||||
error
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
A failing expression with a non streamable type is still captured
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
TrickyTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
TrickyTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK( &o1 == &o2 )
|
|
||||||
with expansion:
|
|
||||||
0x<hex digits> == 0x<hex digits>
|
|
||||||
|
|
||||||
TrickyTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK( o1 == o2 )
|
|
||||||
with expansion:
|
|
||||||
{?} == {?}
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
string literals of different sizes can be compared
|
string literals of different sizes can be compared
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -4,612 +4,37 @@ CatchSelfTest is a <version> host application.
|
|||||||
Run with -? for options
|
Run with -? for options
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
toString(enum)
|
# A test name that starts with a #
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
EnumToString.cpp:<line number>
|
MiscTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
|
|
||||||
EnumToString.cpp:<line number>:
|
MiscTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
CHECK( Catch::toString(e0) == "0" )
|
with message:
|
||||||
with expansion:
|
yay
|
||||||
"0" == "0"
|
|
||||||
|
|
||||||
EnumToString.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( Catch::toString(e1) == "1" )
|
|
||||||
with expansion:
|
|
||||||
"1" == "1"
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
toString(enum w/operator<<)
|
'Not' checks that should fail
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
EnumToString.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
EnumToString.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( Catch::toString(e0) == "E2{0}" )
|
|
||||||
with expansion:
|
|
||||||
"E2{0}" == "E2{0}"
|
|
||||||
|
|
||||||
EnumToString.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( Catch::toString(e1) == "E2{1}" )
|
|
||||||
with expansion:
|
|
||||||
"E2{1}" == "E2{1}"
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
toString(enum class)
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
EnumToString.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
EnumToString.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( Catch::toString(e0) == "0" )
|
|
||||||
with expansion:
|
|
||||||
"0" == "0"
|
|
||||||
|
|
||||||
EnumToString.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( Catch::toString(e1) == "1" )
|
|
||||||
with expansion:
|
|
||||||
"1" == "1"
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
toString(enum class w/operator<<)
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
EnumToString.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
EnumToString.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( Catch::toString(e0) == "E2/V0" )
|
|
||||||
with expansion:
|
|
||||||
"E2/V0" == "E2/V0"
|
|
||||||
|
|
||||||
EnumToString.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( Catch::toString(e1) == "E2/V1" )
|
|
||||||
with expansion:
|
|
||||||
"E2/V1" == "E2/V1"
|
|
||||||
|
|
||||||
EnumToString.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
CHECK( Catch::toString(e3) == "Unknown enum value 10" )
|
|
||||||
with expansion:
|
|
||||||
"Unknown enum value 10"
|
|
||||||
==
|
|
||||||
"Unknown enum value 10"
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Some simple comparisons between doubles
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ApproxTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( d == Approx( 1.23 ) )
|
|
||||||
with expansion:
|
|
||||||
1.23 == Approx( 1.23 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( d != Approx( 1.22 ) )
|
|
||||||
with expansion:
|
|
||||||
1.23 != Approx( 1.22 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( d != Approx( 1.24 ) )
|
|
||||||
with expansion:
|
|
||||||
1.23 != Approx( 1.24 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( Approx( d ) == 1.23 )
|
|
||||||
with expansion:
|
|
||||||
Approx( 1.23 ) == 1.23
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( Approx( d ) != 1.22 )
|
|
||||||
with expansion:
|
|
||||||
Approx( 1.23 ) != 1.22
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( Approx( d ) != 1.24 )
|
|
||||||
with expansion:
|
|
||||||
Approx( 1.23 ) != 1.24
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Approximate comparisons with different epsilons
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ApproxTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( d != Approx( 1.231 ) )
|
|
||||||
with expansion:
|
|
||||||
1.23 != Approx( 1.231 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( d == Approx( 1.231 ).epsilon( 0.1 ) )
|
|
||||||
with expansion:
|
|
||||||
1.23 == Approx( 1.231 )
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Approximate comparisons with floats
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ApproxTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( 1.23f == Approx( 1.23f ) )
|
|
||||||
with expansion:
|
|
||||||
1.23f == Approx( 1.2300000191 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( 0.0f == Approx( 0.0f ) )
|
|
||||||
with expansion:
|
|
||||||
0.0f == Approx( 0.0 )
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Approximate comparisons with ints
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ApproxTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( 1 == Approx( 1 ) )
|
|
||||||
with expansion:
|
|
||||||
1 == Approx( 1.0 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( 0 == Approx( 0 ) )
|
|
||||||
with expansion:
|
|
||||||
0 == Approx( 0.0 )
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Approximate comparisons with mixed numeric types
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ApproxTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( 1.0f == Approx( 1 ) )
|
|
||||||
with expansion:
|
|
||||||
1.0f == Approx( 1.0 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( 0 == Approx( dZero) )
|
|
||||||
with expansion:
|
|
||||||
0 == Approx( 0.0 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( 0 == Approx( dSmall ).epsilon( 0.001 ) )
|
|
||||||
with expansion:
|
|
||||||
0 == Approx( 0.00001 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( 1.234f == Approx( dMedium ) )
|
|
||||||
with expansion:
|
|
||||||
1.234f == Approx( 1.234 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( dMedium == Approx( 1.234f ) )
|
|
||||||
with expansion:
|
|
||||||
1.234 == Approx( 1.2339999676 )
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Use a custom approx
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ApproxTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( d == approx( 1.23 ) )
|
|
||||||
with expansion:
|
|
||||||
1.23 == Approx( 1.23 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( d == approx( 1.22 ) )
|
|
||||||
with expansion:
|
|
||||||
1.23 == Approx( 1.22 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( d == approx( 1.24 ) )
|
|
||||||
with expansion:
|
|
||||||
1.23 == Approx( 1.24 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( d != approx( 1.25 ) )
|
|
||||||
with expansion:
|
|
||||||
1.23 != Approx( 1.25 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( approx( d ) == 1.23 )
|
|
||||||
with expansion:
|
|
||||||
Approx( 1.23 ) == 1.23
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( approx( d ) == 1.22 )
|
|
||||||
with expansion:
|
|
||||||
Approx( 1.23 ) == 1.22
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( approx( d ) == 1.24 )
|
|
||||||
with expansion:
|
|
||||||
Approx( 1.23 ) == 1.24
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( approx( d ) != 1.25 )
|
|
||||||
with expansion:
|
|
||||||
Approx( 1.23 ) != 1.25
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Approximate PI
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ApproxTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) )
|
|
||||||
with expansion:
|
|
||||||
3.1428571429 == Approx( 3.141 )
|
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) )
|
|
||||||
with expansion:
|
|
||||||
3.1428571429 != Approx( 3.141 )
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
A METHOD_AS_TEST_CASE based test run that succeeds
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ClassTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ClassTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( s == "hello" )
|
|
||||||
with expansion:
|
|
||||||
"hello" == "hello"
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
A METHOD_AS_TEST_CASE based test run that fails
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ClassTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ClassTests.cpp:<line number>: FAILED:
|
|
||||||
REQUIRE( s == "world" )
|
|
||||||
with expansion:
|
|
||||||
"hello" == "world"
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
A TEST_CASE_METHOD based test run that succeeds
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ClassTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ClassTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( m_a == 1 )
|
|
||||||
with expansion:
|
|
||||||
1 == 1
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
A TEST_CASE_METHOD based test run that fails
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ClassTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ClassTests.cpp:<line number>: FAILED:
|
|
||||||
REQUIRE( m_a == 2 )
|
|
||||||
with expansion:
|
|
||||||
1 == 2
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Equality checks that should succeed
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ConditionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.int_seven == 7 )
|
|
||||||
with expansion:
|
|
||||||
7 == 7
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.float_nine_point_one == Approx( 9.1f ) )
|
|
||||||
with expansion:
|
|
||||||
9.1f == Approx( 9.1000003815 )
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.double_pi == Approx( 3.1415926535 ) )
|
|
||||||
with expansion:
|
|
||||||
3.1415926535 == Approx( 3.1415926535 )
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.str_hello == "hello" )
|
|
||||||
with expansion:
|
|
||||||
"hello" == "hello"
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( "hello" == data.str_hello )
|
|
||||||
with expansion:
|
|
||||||
"hello" == "hello"
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.str_hello.size() == 5 )
|
|
||||||
with expansion:
|
|
||||||
5 == 5
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( x == Approx( 1.3 ) )
|
|
||||||
with expansion:
|
|
||||||
1.3 == Approx( 1.3 )
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Equality checks that should fail
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
ConditionTests.cpp:<line number>
|
ConditionTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.int_seven == 6 )
|
CHECK( false != false )
|
||||||
with expansion:
|
|
||||||
7 == 6
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.int_seven == 8 )
|
CHECK( true != true )
|
||||||
with expansion:
|
|
||||||
7 == 8
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Inequality checks that should succeed
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ConditionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.int_seven != 6 )
|
|
||||||
with expansion:
|
|
||||||
7 != 6
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.int_seven != 8 )
|
|
||||||
with expansion:
|
|
||||||
7 != 8
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.float_nine_point_one != Approx( 9.11f ) )
|
|
||||||
with expansion:
|
|
||||||
9.1f != Approx( 9.1099996567 )
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.float_nine_point_one != Approx( 9.0f ) )
|
|
||||||
with expansion:
|
|
||||||
9.1f != Approx( 9.0 )
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.float_nine_point_one != Approx( 1 ) )
|
|
||||||
with expansion:
|
|
||||||
9.1f != Approx( 1.0 )
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.float_nine_point_one != Approx( 0 ) )
|
|
||||||
with expansion:
|
|
||||||
9.1f != Approx( 0.0 )
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.double_pi != Approx( 3.1415 ) )
|
|
||||||
with expansion:
|
|
||||||
3.1415926535 != Approx( 3.1415 )
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.str_hello != "goodbye" )
|
|
||||||
with expansion:
|
|
||||||
"hello" != "goodbye"
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.str_hello != "hell" )
|
|
||||||
with expansion:
|
|
||||||
"hello" != "hell"
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.str_hello != "hello1" )
|
|
||||||
with expansion:
|
|
||||||
"hello" != "hello1"
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.str_hello.size() != 6 )
|
|
||||||
with expansion:
|
|
||||||
5 != 6
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Inequality checks that should fail
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ConditionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.int_seven != 7 )
|
CHECK( !true )
|
||||||
with expansion:
|
with expansion:
|
||||||
7 != 7
|
false
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.float_nine_point_one != Approx( 9.1f ) )
|
CHECK_FALSE( true )
|
||||||
with expansion:
|
|
||||||
9.1f != Approx( 9.1000003815 )
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Ordering comparison checks that should succeed
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ConditionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.int_seven < 8 )
|
|
||||||
with expansion:
|
|
||||||
7 < 8
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.int_seven > 6 )
|
|
||||||
with expansion:
|
|
||||||
7 > 6
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.int_seven > 0 )
|
|
||||||
with expansion:
|
|
||||||
7 > 0
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.int_seven > -1 )
|
|
||||||
with expansion:
|
|
||||||
7 > -1
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.int_seven >= 7 )
|
|
||||||
with expansion:
|
|
||||||
7 >= 7
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.int_seven >= 6 )
|
|
||||||
with expansion:
|
|
||||||
7 >= 6
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.int_seven <= 7 )
|
|
||||||
with expansion:
|
|
||||||
7 <= 7
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.int_seven <= 8 )
|
|
||||||
with expansion:
|
|
||||||
7 <= 8
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.float_nine_point_one > 9 )
|
|
||||||
with expansion:
|
|
||||||
9.1f > 9
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.float_nine_point_one < 10 )
|
|
||||||
with expansion:
|
|
||||||
9.1f < 10
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.float_nine_point_one < 9.2 )
|
|
||||||
with expansion:
|
|
||||||
9.1f < 9.2
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.str_hello <= "hello" )
|
|
||||||
with expansion:
|
|
||||||
"hello" <= "hello"
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.str_hello >= "hello" )
|
|
||||||
with expansion:
|
|
||||||
"hello" >= "hello"
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.str_hello < "hellp" )
|
|
||||||
with expansion:
|
|
||||||
"hello" < "hellp"
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.str_hello < "zebra" )
|
|
||||||
with expansion:
|
|
||||||
"hello" < "zebra"
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.str_hello > "hellm" )
|
|
||||||
with expansion:
|
|
||||||
"hello" > "hellm"
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
|
||||||
PASSED:
|
|
||||||
REQUIRE( data.str_hello > "a" )
|
|
||||||
with expansion:
|
|
||||||
"hello" > "a"
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Ordering comparison checks that should fail
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ConditionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK( data.int_seven > 7 )
|
|
||||||
with expansion:
|
|
||||||
7 > 7
|
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
|
||||||
CHECK( data.int_seven < 7 )
|
|
||||||
with expansion:
|
|
||||||
7 < 7
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 21 | 16 passed | 3 failed | 2 failed as expected
|
test cases: 2 | 1 passed | 1 failed
|
||||||
assertions: 81 | 73 passed | 4 failed | 4 failed as expected
|
assertions: 5 | 1 passed | 4 failed
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include "catch_test_spec_parser.hpp"
|
#include "internal/catch_test_spec_parser.hpp"
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
# pragma clang diagnostic ignored "-Wc++98-compat"
|
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
// 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_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_common.h"
|
#include "internal/catch_common.h"
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
// 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_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_console_colour.hpp"
|
#include "internal/catch_console_colour.hpp"
|
||||||
|
@@ -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.h"
|
#include "internal/catch_debugger.h"
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
// 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_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_interfaces_capture.h"
|
#include "internal/catch_interfaces_capture.h"
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
#include "catch_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_interfaces_config.h"
|
#include "internal/catch_interfaces_config.h"
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
#include "catch_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_interfaces_exception.h"
|
#include "internal/catch_interfaces_exception.h"
|
||||||
|
@@ -1 +1 @@
|
|||||||
#include "catch_interfaces_generators.h"
|
#include "internal/catch_interfaces_generators.h"
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
// 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_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_interfaces_registry_hub.h"
|
#include "internal/catch_interfaces_registry_hub.h"
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
#include "catch_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_interfaces_reporter.h"
|
#include "internal/catch_interfaces_reporter.h"
|
||||||
|
@@ -1 +1 @@
|
|||||||
#include "catch_interfaces_runner.h"
|
#include "internal/catch_interfaces_runner.h"
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
#include "catch_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_interfaces_testcase.h"
|
#include "internal/catch_interfaces_testcase.h"
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
// 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_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_message.h"
|
#include "internal/catch_message.h"
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
// 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_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_option.hpp"
|
#include "internal/catch_option.hpp"
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
// 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_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_ptr.hpp"
|
#include "internal/catch_ptr.hpp"
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
// 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_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_stream.h"
|
#include "internal/catch_stream.h"
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
// 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_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_streambuf.h"
|
#include "internal/catch_streambuf.h"
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
// 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_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_test_spec.hpp"
|
#include "internal/catch_test_spec.hpp"
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// 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_suppress_warnings.h"
|
#include "internal/catch_suppress_warnings.h"
|
||||||
#include "catch_xmlwriter.hpp"
|
#include "internal/catch_xmlwriter.hpp"
|
||||||
#include "catch_reenable_warnings.h"
|
#include "internal/catch_reenable_warnings.h"
|
||||||
|
@@ -22,6 +22,7 @@ if len(sys.argv) == 2:
|
|||||||
cmdPath = sys.argv[1]
|
cmdPath = sys.argv[1]
|
||||||
else:
|
else:
|
||||||
cmdPath = os.path.join( catchPath, 'projects/XCode/CatchSelfTest/DerivedData/CatchSelfTest/Build/Products/Debug/CatchSelfTest' )
|
cmdPath = os.path.join( catchPath, 'projects/XCode/CatchSelfTest/DerivedData/CatchSelfTest/Build/Products/Debug/CatchSelfTest' )
|
||||||
|
# cmdPath = os.path.join( catchPath, 'projects/CMake/cmake-build-debug/SelfTest' )
|
||||||
|
|
||||||
overallResult = 0
|
overallResult = 0
|
||||||
|
|
||||||
@@ -100,15 +101,15 @@ def approve( baseName, args ):
|
|||||||
overallResult = 1
|
overallResult = 1
|
||||||
|
|
||||||
# Standard console reporter
|
# Standard console reporter
|
||||||
approve( "console.std", ["~_"] )
|
approve( "console.std", ["~_", "--order", "lex"] )
|
||||||
# console reporter, include passes, warn about No Assertions
|
# console reporter, include passes, warn about No Assertions
|
||||||
approve( "console.sw", ["~_", "-s", "-w", "NoAssertions"] )
|
approve( "console.sw", ["~_", "-s", "-w", "NoAssertions", "--order", "lex"] )
|
||||||
# console reporter, include passes, warn about No Assertions, limit failures to first 4
|
# console reporter, include passes, warn about No Assertions, limit failures to first 4
|
||||||
approve( "console.swa4", ["~_", "-s", "-w", "NoAssertions", "-x", "4"] )
|
approve( "console.swa4", ["~_", "-s", "-w", "NoAssertions", "-x", "4", "--order", "lex"] )
|
||||||
# junit reporter, include passes, warn about No Assertions
|
# junit reporter, include passes, warn about No Assertions
|
||||||
approve( "junit.sw", ["~_", "-s", "-w", "NoAssertions", "-r", "junit"] )
|
approve( "junit.sw", ["~_", "-s", "-w", "NoAssertions", "-r", "junit", "--order", "lex"] )
|
||||||
# xml reporter, include passes, warn about No Assertions
|
# xml reporter, include passes, warn about No Assertions
|
||||||
approve( "xml.sw", ["~_", "-s", "-w", "NoAssertions", "-r", "xml"] )
|
approve( "xml.sw", ["~_", "-s", "-w", "NoAssertions", "-r", "xml", "--order", "lex"] )
|
||||||
|
|
||||||
if overallResult != 0:
|
if overallResult != 0:
|
||||||
print( "run approve.py to approve new baselines" )
|
print( "run approve.py to approve new baselines" )
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Catch v1.5.7
|
* Catch v1.5.9
|
||||||
* Generated: 2016-09-27 10:45:46.824849
|
* Generated: 2016-11-29 12:14:38.049276
|
||||||
* ----------------------------------------------------------
|
* ----------------------------------------------------------
|
||||||
* This file has been merged from multiple headers. Please don't edit it directly
|
* This file has been merged from multiple headers. Please don't edit it directly
|
||||||
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
|
||||||
@@ -3428,6 +3428,7 @@ namespace Catch {
|
|||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
@@ -3995,9 +3996,12 @@ namespace Clara {
|
|||||||
inline void convertInto( std::string const& _source, std::string& _dest ) {
|
inline void convertInto( std::string const& _source, std::string& _dest ) {
|
||||||
_dest = _source;
|
_dest = _source;
|
||||||
}
|
}
|
||||||
|
char toLowerCh(char c) {
|
||||||
|
return static_cast<char>( ::tolower( c ) );
|
||||||
|
}
|
||||||
inline void convertInto( std::string const& _source, bool& _dest ) {
|
inline void convertInto( std::string const& _source, bool& _dest ) {
|
||||||
std::string sourceLC = _source;
|
std::string sourceLC = _source;
|
||||||
std::transform( sourceLC.begin(), sourceLC.end(), sourceLC.begin(), ::tolower );
|
std::transform( sourceLC.begin(), sourceLC.end(), sourceLC.begin(), toLowerCh );
|
||||||
if( sourceLC == "y" || sourceLC == "1" || sourceLC == "true" || sourceLC == "yes" || sourceLC == "on" )
|
if( sourceLC == "y" || sourceLC == "1" || sourceLC == "true" || sourceLC == "yes" || sourceLC == "on" )
|
||||||
_dest = true;
|
_dest = true;
|
||||||
else if( sourceLC == "n" || sourceLC == "0" || sourceLC == "false" || sourceLC == "no" || sourceLC == "off" )
|
else if( sourceLC == "n" || sourceLC == "0" || sourceLC == "false" || sourceLC == "no" || sourceLC == "off" )
|
||||||
@@ -6461,7 +6465,7 @@ namespace Catch {
|
|||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
struct RandomNumberGenerator {
|
struct RandomNumberGenerator {
|
||||||
typedef int result_type;
|
typedef std::ptrdiff_t result_type;
|
||||||
|
|
||||||
result_type operator()( result_type n ) const { return std::rand() % n; }
|
result_type operator()( result_type n ) const { return std::rand() % n; }
|
||||||
|
|
||||||
@@ -7578,7 +7582,7 @@ namespace Catch {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version libraryVersion( 1, 5, 7, "", 0 );
|
Version libraryVersion( 1, 5, 9, "", 0 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7809,8 +7813,11 @@ namespace Catch {
|
|||||||
bool contains( std::string const& s, std::string const& infix ) {
|
bool contains( std::string const& s, std::string const& infix ) {
|
||||||
return s.find( infix ) != std::string::npos;
|
return s.find( infix ) != std::string::npos;
|
||||||
}
|
}
|
||||||
|
char toLowerCh(char c) {
|
||||||
|
return static_cast<char>( ::tolower( c ) );
|
||||||
|
}
|
||||||
void toLowerInPlace( std::string& s ) {
|
void toLowerInPlace( std::string& s ) {
|
||||||
std::transform( s.begin(), s.end(), s.begin(), ::tolower );
|
std::transform( s.begin(), s.end(), s.begin(), toLowerCh );
|
||||||
}
|
}
|
||||||
std::string toLower( std::string const& s ) {
|
std::string toLower( std::string const& s ) {
|
||||||
std::string lc = s;
|
std::string lc = s;
|
||||||
@@ -9163,6 +9170,7 @@ namespace Catch {
|
|||||||
public:
|
public:
|
||||||
XmlReporter( ReporterConfig const& _config )
|
XmlReporter( ReporterConfig const& _config )
|
||||||
: StreamingReporterBase( _config ),
|
: StreamingReporterBase( _config ),
|
||||||
|
m_xml(_config.stream()),
|
||||||
m_sectionDepth( 0 )
|
m_sectionDepth( 0 )
|
||||||
{
|
{
|
||||||
m_reporterPrefs.shouldRedirectStdOut = true;
|
m_reporterPrefs.shouldRedirectStdOut = true;
|
||||||
@@ -9182,7 +9190,6 @@ namespace Catch {
|
|||||||
|
|
||||||
virtual void testRunStarting( TestRunInfo const& testInfo ) CATCH_OVERRIDE {
|
virtual void testRunStarting( TestRunInfo const& testInfo ) CATCH_OVERRIDE {
|
||||||
StreamingReporterBase::testRunStarting( testInfo );
|
StreamingReporterBase::testRunStarting( testInfo );
|
||||||
m_xml.setStream( stream );
|
|
||||||
m_xml.startElement( "Catch" );
|
m_xml.startElement( "Catch" );
|
||||||
if( !m_config->name().empty() )
|
if( !m_config->name().empty() )
|
||||||
m_xml.writeAttribute( "name", m_config->name() );
|
m_xml.writeAttribute( "name", m_config->name() );
|
||||||
@@ -9258,7 +9265,7 @@ namespace Catch {
|
|||||||
.writeText( assertionResult.getMessage() );
|
.writeText( assertionResult.getMessage() );
|
||||||
break;
|
break;
|
||||||
case ResultWas::FatalErrorCondition:
|
case ResultWas::FatalErrorCondition:
|
||||||
m_xml.scopedElement( "Fatal Error Condition" )
|
m_xml.scopedElement( "FatalErrorCondition" )
|
||||||
.writeAttribute( "filename", assertionResult.getSourceInfo().file )
|
.writeAttribute( "filename", assertionResult.getSourceInfo().file )
|
||||||
.writeAttribute( "line", assertionResult.getSourceInfo().line )
|
.writeAttribute( "line", assertionResult.getSourceInfo().line )
|
||||||
.writeText( assertionResult.getMessage() );
|
.writeText( assertionResult.getMessage() );
|
||||||
|
Reference in New Issue
Block a user