mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-13 00:45:39 +02:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
35f510545d | ||
![]() |
742457cbcf | ||
![]() |
1aa6c91e64 | ||
![]() |
ac220289a6 | ||
![]() |
be3570ef22 | ||
![]() |
a74d760d74 | ||
![]() |
f666f5f0ae | ||
![]() |
7940d58a2f |
@@ -1,6 +1,6 @@
|
|||||||

|

|
||||||
|
|
||||||
*v1.5.3*
|
*v1.5.6*
|
||||||
|
|
||||||
Build status (on Travis CI) [](https://travis-ci.org/philsquared/Catch)
|
Build status (on Travis CI) [](https://travis-ci.org/philsquared/Catch)
|
||||||
|
|
||||||
|
4
include/external/clara.h
vendored
4
include/external/clara.h
vendored
@@ -589,7 +589,7 @@ namespace Clara {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Mode handleOpt( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
|
Mode handleOpt( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
|
||||||
if( std::string( ":=\0", 5 ).find( c ) == std::string::npos )
|
if( std::string( ":=\0", 3 ).find( c ) == std::string::npos )
|
||||||
return mode;
|
return mode;
|
||||||
|
|
||||||
std::string optName = arg.substr( from, i-from );
|
std::string optName = arg.substr( from, i-from );
|
||||||
@@ -603,7 +603,7 @@ namespace Clara {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
Mode handlePositional( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
|
Mode handlePositional( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
|
||||||
if( inQuotes || std::string( "\0", 3 ).find( c ) == std::string::npos )
|
if( inQuotes || std::string( "\0", 1 ).find( c ) == std::string::npos )
|
||||||
return mode;
|
return mode;
|
||||||
|
|
||||||
std::string data = arg.substr( from, i-from );
|
std::string data = arg.substr( from, i-from );
|
||||||
|
@@ -40,7 +40,7 @@
|
|||||||
__catchResult.useActiveException( Catch::ResultDisposition::Normal ); \
|
__catchResult.useActiveException( Catch::ResultDisposition::Normal ); \
|
||||||
} \
|
} \
|
||||||
INTERNAL_CATCH_REACT( __catchResult ) \
|
INTERNAL_CATCH_REACT( __catchResult ) \
|
||||||
} while( Catch::isTrue( false && static_cast<bool>(expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look
|
} while( Catch::isTrue( false && !!(expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \
|
#define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \
|
||||||
|
@@ -36,8 +36,16 @@
|
|||||||
|
|
||||||
// All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11
|
// All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11
|
||||||
|
|
||||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
#ifdef __cplusplus
|
||||||
# define CATCH_CPP11_OR_GREATER
|
|
||||||
|
# if __cplusplus >= 201103L
|
||||||
|
# define CATCH_CPP11_OR_GREATER
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if __cplusplus >= 201402L
|
||||||
|
# define CATCH_CPP14_OR_GREATER
|
||||||
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
|
@@ -151,7 +151,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
ConfigData m_data;
|
ConfigData m_data;
|
||||||
|
|
||||||
std::auto_ptr<IStream const> m_stream;
|
CATCH_AUTO_PTR( IStream const ) m_stream;
|
||||||
TestSpec m_testSpec;
|
TestSpec m_testSpec;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ namespace Catch {
|
|||||||
|
|
||||||
|
|
||||||
class DebugOutStream : public IStream {
|
class DebugOutStream : public IStream {
|
||||||
std::auto_ptr<StreamBufBase> m_streamBuf;
|
CATCH_AUTO_PTR( StreamBufBase ) m_streamBuf;
|
||||||
mutable std::ostream m_os;
|
mutable std::ostream m_os;
|
||||||
public:
|
public:
|
||||||
DebugOutStream();
|
DebugOutStream();
|
||||||
|
@@ -19,13 +19,31 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace Catch {
|
#ifdef CATCH_CPP14_OR_GREATER
|
||||||
|
#include <random>
|
||||||
|
#endif
|
||||||
|
|
||||||
struct LexSort {
|
namespace Catch {
|
||||||
bool operator() (TestCase i,TestCase j) const { return (i<j);}
|
|
||||||
};
|
|
||||||
struct RandomNumberGenerator {
|
struct RandomNumberGenerator {
|
||||||
int operator()( int n ) const { return std::rand() % n; }
|
typedef int result_type;
|
||||||
|
|
||||||
|
result_type operator()( result_type n ) const { return std::rand() % n; }
|
||||||
|
|
||||||
|
#ifdef CATCH_CPP14_OR_GREATER
|
||||||
|
static constexpr result_type min() { return 0; }
|
||||||
|
static constexpr result_type max() { return 1000000; }
|
||||||
|
result_type operator()() const { return std::rand() % max(); }
|
||||||
|
#endif
|
||||||
|
template<typename V>
|
||||||
|
static void shuffle( V& vector ) {
|
||||||
|
RandomNumberGenerator rng;
|
||||||
|
#ifdef CATCH_CPP14_OR_GREATER
|
||||||
|
std::shuffle( vector.begin(), vector.end(), rng );
|
||||||
|
#else
|
||||||
|
std::random_shuffle( vector.begin(), vector.end(), rng );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
|
inline std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
|
||||||
@@ -34,14 +52,12 @@ namespace Catch {
|
|||||||
|
|
||||||
switch( config.runOrder() ) {
|
switch( config.runOrder() ) {
|
||||||
case RunTests::InLexicographicalOrder:
|
case RunTests::InLexicographicalOrder:
|
||||||
std::sort( sorted.begin(), sorted.end(), LexSort() );
|
std::sort( sorted.begin(), sorted.end() );
|
||||||
break;
|
break;
|
||||||
case RunTests::InRandomOrder:
|
case RunTests::InRandomOrder:
|
||||||
{
|
{
|
||||||
seedRng( config );
|
seedRng( config );
|
||||||
|
RandomNumberGenerator::shuffle( sorted );
|
||||||
RandomNumberGenerator rng;
|
|
||||||
std::random_shuffle( sorted.begin(), sorted.end(), rng );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RunTests::InDeclarationOrder:
|
case RunTests::InDeclarationOrder:
|
||||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version libraryVersion( 1, 5, 3, "", 0 );
|
Version libraryVersion( 1, 5, 6, "", 0 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Catch v1.5.3
|
* Catch v1.5.6
|
||||||
* Generated: 2016-05-10 19:09:28.805441
|
* Generated: 2016-06-09 19:20:41.460328
|
||||||
* ----------------------------------------------------------
|
* ----------------------------------------------------------
|
||||||
* 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.
|
||||||
@@ -106,8 +106,16 @@
|
|||||||
|
|
||||||
// All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11
|
// All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11
|
||||||
|
|
||||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
#ifdef __cplusplus
|
||||||
# define CATCH_CPP11_OR_GREATER
|
|
||||||
|
# if __cplusplus >= 201103L
|
||||||
|
# define CATCH_CPP11_OR_GREATER
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if __cplusplus >= 201402L
|
||||||
|
# define CATCH_CPP14_OR_GREATER
|
||||||
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
@@ -2065,7 +2073,7 @@ namespace Catch {
|
|||||||
__catchResult.useActiveException( Catch::ResultDisposition::Normal ); \
|
__catchResult.useActiveException( Catch::ResultDisposition::Normal ); \
|
||||||
} \
|
} \
|
||||||
INTERNAL_CATCH_REACT( __catchResult ) \
|
INTERNAL_CATCH_REACT( __catchResult ) \
|
||||||
} while( Catch::isTrue( false && static_cast<bool>(expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look
|
} while( Catch::isTrue( false && !!(expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \
|
#define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \
|
||||||
@@ -3450,7 +3458,7 @@ namespace Catch {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class DebugOutStream : public IStream {
|
class DebugOutStream : public IStream {
|
||||||
std::auto_ptr<StreamBufBase> m_streamBuf;
|
CATCH_AUTO_PTR( StreamBufBase ) m_streamBuf;
|
||||||
mutable std::ostream m_os;
|
mutable std::ostream m_os;
|
||||||
public:
|
public:
|
||||||
DebugOutStream();
|
DebugOutStream();
|
||||||
@@ -3598,7 +3606,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
ConfigData m_data;
|
ConfigData m_data;
|
||||||
|
|
||||||
std::auto_ptr<IStream const> m_stream;
|
CATCH_AUTO_PTR( IStream const ) m_stream;
|
||||||
TestSpec m_testSpec;
|
TestSpec m_testSpec;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4177,7 +4185,7 @@ namespace Clara {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Mode handleOpt( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
|
Mode handleOpt( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
|
||||||
if( std::string( ":=\0", 5 ).find( c ) == std::string::npos )
|
if( std::string( ":=\0", 3 ).find( c ) == std::string::npos )
|
||||||
return mode;
|
return mode;
|
||||||
|
|
||||||
std::string optName = arg.substr( from, i-from );
|
std::string optName = arg.substr( from, i-from );
|
||||||
@@ -4191,7 +4199,7 @@ namespace Clara {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
Mode handlePositional( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
|
Mode handlePositional( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
|
||||||
if( inQuotes || std::string( "\0", 3 ).find( c ) == std::string::npos )
|
if( inQuotes || std::string( "\0", 1 ).find( c ) == std::string::npos )
|
||||||
return mode;
|
return mode;
|
||||||
|
|
||||||
std::string data = arg.substr( from, i-from );
|
std::string data = arg.substr( from, i-from );
|
||||||
@@ -6439,13 +6447,31 @@ namespace Catch {
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#ifdef CATCH_CPP14_OR_GREATER
|
||||||
|
#include <random>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
struct LexSort {
|
|
||||||
bool operator() (TestCase i,TestCase j) const { return (i<j);}
|
|
||||||
};
|
|
||||||
struct RandomNumberGenerator {
|
struct RandomNumberGenerator {
|
||||||
int operator()( int n ) const { return std::rand() % n; }
|
typedef int result_type;
|
||||||
|
|
||||||
|
result_type operator()( result_type n ) const { return std::rand() % n; }
|
||||||
|
|
||||||
|
#ifdef CATCH_CPP14_OR_GREATER
|
||||||
|
static constexpr result_type min() { return 0; }
|
||||||
|
static constexpr result_type max() { return 1000000; }
|
||||||
|
result_type operator()() const { return std::rand() % max(); }
|
||||||
|
#endif
|
||||||
|
template<typename V>
|
||||||
|
static void shuffle( V& vector ) {
|
||||||
|
RandomNumberGenerator rng;
|
||||||
|
#ifdef CATCH_CPP14_OR_GREATER
|
||||||
|
std::shuffle( vector.begin(), vector.end(), rng );
|
||||||
|
#else
|
||||||
|
std::random_shuffle( vector.begin(), vector.end(), rng );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
|
inline std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
|
||||||
@@ -6454,14 +6480,12 @@ namespace Catch {
|
|||||||
|
|
||||||
switch( config.runOrder() ) {
|
switch( config.runOrder() ) {
|
||||||
case RunTests::InLexicographicalOrder:
|
case RunTests::InLexicographicalOrder:
|
||||||
std::sort( sorted.begin(), sorted.end(), LexSort() );
|
std::sort( sorted.begin(), sorted.end() );
|
||||||
break;
|
break;
|
||||||
case RunTests::InRandomOrder:
|
case RunTests::InRandomOrder:
|
||||||
{
|
{
|
||||||
seedRng( config );
|
seedRng( config );
|
||||||
|
RandomNumberGenerator::shuffle( sorted );
|
||||||
RandomNumberGenerator rng;
|
|
||||||
std::random_shuffle( sorted.begin(), sorted.end(), rng );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RunTests::InDeclarationOrder:
|
case RunTests::InDeclarationOrder:
|
||||||
@@ -7547,7 +7571,7 @@ namespace Catch {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version libraryVersion( 1, 5, 3, "", 0 );
|
Version libraryVersion( 1, 5, 6, "", 0 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user