mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-17 03:02:24 +01:00
merge from upstream
This commit is contained in:
commit
ba3408b2dc
@ -1,6 +1,6 @@
|
||||
![catch logo](catch-logo-small.png)
|
||||
|
||||
*v1.0 build 23 (master branch)*
|
||||
*v1.0 build 25 (master branch)*
|
||||
|
||||
Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch)
|
||||
|
||||
|
@ -30,7 +30,6 @@
|
||||
// running under the debugger or has a debugger attached post facto).
|
||||
INTERNAL_CATCH_INLINE bool isDebuggerActive(){
|
||||
|
||||
int junk;
|
||||
int mib[4];
|
||||
struct kinfo_proc info;
|
||||
size_t size;
|
||||
@ -51,8 +50,10 @@
|
||||
// Call sysctl.
|
||||
|
||||
size = sizeof(info);
|
||||
junk = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0);
|
||||
assert(junk == 0);
|
||||
if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0) != 0 ) {
|
||||
std::cerr << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// We're being debugged if the P_TRACED flag is set.
|
||||
|
||||
|
@ -79,6 +79,24 @@ namespace Detail {
|
||||
}
|
||||
};
|
||||
|
||||
// For display purposes only.
|
||||
// Does not consider endian-ness
|
||||
template<typename T>
|
||||
std::string rawMemoryToString( T value ) {
|
||||
union {
|
||||
T typedValue;
|
||||
unsigned char bytes[sizeof(T)];
|
||||
};
|
||||
|
||||
typedValue = value;
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "0x";
|
||||
for( unsigned char* cp = bytes; cp < bytes+sizeof(T); ++cp )
|
||||
oss << std::hex << std::setw(2) << std::setfill('0') << (unsigned int)*cp;
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
} // end namespace Detail
|
||||
|
||||
template<typename T>
|
||||
@ -94,13 +112,18 @@ struct StringMaker<T*> {
|
||||
static std::string convert( U* p ) {
|
||||
if( !p )
|
||||
return INTERNAL_CATCH_STRINGIFY( NULL );
|
||||
std::ostringstream oss;
|
||||
#ifdef _MSC_VER
|
||||
oss << "0x" << p;
|
||||
#else
|
||||
oss << p;
|
||||
#endif
|
||||
return oss.str();
|
||||
else
|
||||
return Detail::rawMemoryToString( p );
|
||||
}
|
||||
};
|
||||
|
||||
template<typename R, typename C>
|
||||
struct StringMaker<R C::*> {
|
||||
static std::string convert( R C::* p ) {
|
||||
if( !p )
|
||||
return INTERNAL_CATCH_STRINGIFY( NULL );
|
||||
else
|
||||
return Detail::rawMemoryToString( p );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace Catch {
|
||||
|
||||
// These numbers are maintained by a script
|
||||
template <typename T>
|
||||
const T LibraryVersionInfo<T>::value( 1, 0, 23, "master" );
|
||||
const T LibraryVersionInfo<T>::value( 1, 0, 25, "master" );
|
||||
}
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED
|
||||
|
@ -750,5 +750,5 @@ with expansion:
|
||||
"first" == "second"
|
||||
|
||||
===============================================================================
|
||||
122 test cases - 36 failed (675 assertions - 91 failed)
|
||||
123 test cases - 36 failed (676 assertions - 91 failed)
|
||||
|
||||
|
@ -6366,7 +6366,21 @@ TrickyTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( a == &foo )
|
||||
with expansion:
|
||||
1 == 1
|
||||
0x<hex digits> == 0x<hex digits>
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Comparing member function pointers
|
||||
-------------------------------------------------------------------------------
|
||||
TrickyTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
TrickyTests.cpp:<line number>:
|
||||
PASSED:
|
||||
CHECK( m == &S::f )
|
||||
with expansion:
|
||||
0x<hex digits>
|
||||
==
|
||||
0x<hex digits>
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
pointer to class
|
||||
@ -7144,5 +7158,5 @@ with expansion:
|
||||
true
|
||||
|
||||
===============================================================================
|
||||
122 test cases - 51 failed (694 assertions - 110 failed)
|
||||
123 test cases - 51 failed (695 assertions - 110 failed)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<testsuites>
|
||||
<testsuite name="~_" errors="10" failures="100" tests="694" hostname="tbd" time="{duration}" timestamp="tbd">
|
||||
<testsuite name="~_" errors="10" failures="100" tests="695" hostname="tbd" time="{duration}" timestamp="tbd">
|
||||
<testcase classname="global" name="Some simple comparisons between doubles" time="{duration}"/>
|
||||
<testcase classname="global" name="Approximate comparisons with different epsilons" time="{duration}"/>
|
||||
<testcase classname="global" name="Approximate comparisons with floats" time="{duration}"/>
|
||||
@ -514,6 +514,7 @@ TrickyTests.cpp:<line number>
|
||||
<testcase classname="Assertions then sections" name="A section/Another other section" time="{duration}"/>
|
||||
<testcase classname="global" name="non streamable - with conv. op" time="{duration}"/>
|
||||
<testcase classname="global" name="Comparing function pointers" time="{duration}"/>
|
||||
<testcase classname="global" name="Comparing member function pointers" time="{duration}"/>
|
||||
<testcase classname="global" name="pointer to class" time="{duration}"/>
|
||||
<testcase classname="global" name="X/level/0/a" time="{duration}"/>
|
||||
<testcase classname="global" name="X/level/0/b" time="{duration}"/>
|
||||
|
@ -6637,7 +6637,20 @@ there"
|
||||
a == &foo
|
||||
</Original>
|
||||
<Expanded>
|
||||
1 == 1
|
||||
0x<hex digits> == 0x<hex digits>
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Comparing member function pointers">
|
||||
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
|
||||
<Original>
|
||||
m == &S::f
|
||||
</Original>
|
||||
<Expanded>
|
||||
0x<hex digits>
|
||||
==
|
||||
0x<hex digits>
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
@ -7405,7 +7418,7 @@ there"
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="584" failures="110"/>
|
||||
<OverallResults successes="585" failures="110"/>
|
||||
</Group>
|
||||
<OverallResults successes="584" failures="110"/>
|
||||
<OverallResults successes="585" failures="110"/>
|
||||
</Catch>
|
||||
|
@ -361,6 +361,20 @@ namespace TrickyTests
|
||||
REQUIRE( a == &foo );
|
||||
}
|
||||
|
||||
struct S
|
||||
{
|
||||
void f() {}
|
||||
};
|
||||
|
||||
|
||||
TEST_CASE( "Comparing member function pointers", "[Tricky][member function pointer]" )
|
||||
{
|
||||
typedef void (S::*MF)();
|
||||
MF m = &S::f;
|
||||
|
||||
CHECK( m == &S::f );
|
||||
}
|
||||
|
||||
class ClassName {};
|
||||
|
||||
TEST_CASE( "pointer to class", "[Tricky]" )
|
||||
|
@ -581,7 +581,7 @@
|
||||
GCC_WARN_UNUSED_LABEL = YES;
|
||||
GCC_WARN_UNUSED_PARAMETER = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
MACOSX_DEPLOYMENT_TARGET = "";
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
USER_HEADER_SEARCH_PATHS = "\"$(PROJECT_DIR)/../../../include\"";
|
||||
@ -624,7 +624,7 @@
|
||||
GCC_WARN_UNUSED_LABEL = YES;
|
||||
GCC_WARN_UNUSED_PARAMETER = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
MACOSX_DEPLOYMENT_TARGET = "";
|
||||
SDKROOT = macosx;
|
||||
USER_HEADER_SEARCH_PATHS = "\"$(PROJECT_DIR)/../../../include\"";
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* CATCH v1.0 build 23 (master branch)
|
||||
* Generated: 2013-12-23 10:22:45.547645
|
||||
* CATCH v1.0 build 25 (master branch)
|
||||
* Generated: 2014-01-08 17:16:38.496390
|
||||
* ----------------------------------------------------------
|
||||
* This file has been merged from multiple headers. Please don't edit it directly
|
||||
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
|
||||
@ -681,6 +681,24 @@ namespace Detail {
|
||||
}
|
||||
};
|
||||
|
||||
// For display purposes only.
|
||||
// Does not consider endian-ness
|
||||
template<typename T>
|
||||
std::string rawMemoryToString( T value ) {
|
||||
union {
|
||||
T typedValue;
|
||||
unsigned char bytes[sizeof(T)];
|
||||
};
|
||||
|
||||
typedValue = value;
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "0x";
|
||||
for( unsigned char* cp = bytes; cp < bytes+sizeof(T); ++cp )
|
||||
oss << std::hex << std::setw(2) << std::setfill('0') << (unsigned int)*cp;
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
} // end namespace Detail
|
||||
|
||||
template<typename T>
|
||||
@ -696,9 +714,18 @@ struct StringMaker<T*> {
|
||||
static std::string convert( U* p ) {
|
||||
if( !p )
|
||||
return INTERNAL_CATCH_STRINGIFY( NULL );
|
||||
std::ostringstream oss;
|
||||
oss << p;
|
||||
return oss.str();
|
||||
else
|
||||
return Detail::rawMemoryToString( p );
|
||||
}
|
||||
};
|
||||
|
||||
template<typename R, typename C>
|
||||
struct StringMaker<R C::*> {
|
||||
static std::string convert( R C::* p ) {
|
||||
if( !p )
|
||||
return INTERNAL_CATCH_STRINGIFY( NULL );
|
||||
else
|
||||
return Detail::rawMemoryToString( p );
|
||||
}
|
||||
};
|
||||
|
||||
@ -6179,7 +6206,7 @@ namespace Catch {
|
||||
namespace Catch {
|
||||
|
||||
// These numbers are maintained by a script
|
||||
Version libraryVersion( 1, 0, 23, "master" );
|
||||
Version libraryVersion( 1, 0, 25, "master" );
|
||||
}
|
||||
|
||||
// #included from: catch_text.hpp
|
||||
@ -6598,7 +6625,6 @@ namespace Catch {
|
||||
// running under the debugger or has a debugger attached post facto).
|
||||
bool isDebuggerActive(){
|
||||
|
||||
int junk;
|
||||
int mib[4];
|
||||
struct kinfo_proc info;
|
||||
size_t size;
|
||||
@ -6619,8 +6645,10 @@ namespace Catch {
|
||||
// Call sysctl.
|
||||
|
||||
size = sizeof(info);
|
||||
junk = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0);
|
||||
assert(junk == 0);
|
||||
if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0) != 0 ) {
|
||||
std::cerr << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// We're being debugged if the P_TRACED flag is set.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user