mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Some template instantiation reductions
This commit is contained in:
parent
fe64c28925
commit
10f0a58643
@ -107,16 +107,18 @@ namespace Catch {
|
|||||||
return std::any_of( m_filters.begin(), m_filters.end(), [&]( Filter const& f ){ return f.matches( testCase ); } );
|
return std::any_of( m_filters.begin(), m_filters.end(), [&]( Filter const& f ){ return f.matches( testCase ); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
TestSpec::Matches TestSpec::matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const
|
TestSpec::Matches TestSpec::matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const {
|
||||||
{
|
Matches matches;
|
||||||
Matches matches( m_filters.size() );
|
matches.reserve( m_filters.size() );
|
||||||
std::transform( m_filters.begin(), m_filters.end(), matches.begin(), [&]( Filter const& filter ){
|
for ( auto const& filter : m_filters ) {
|
||||||
std::vector<TestCaseHandle const*> currentMatches;
|
std::vector<TestCaseHandle const*> currentMatches;
|
||||||
for ( auto const& test : testCases )
|
for ( auto const& test : testCases )
|
||||||
if( isThrowSafe( test, config ) && filter.matches( test.getTestCaseInfo() ) )
|
if ( isThrowSafe( test, config ) &&
|
||||||
|
filter.matches( test.getTestCaseInfo() ) )
|
||||||
currentMatches.emplace_back( &test );
|
currentMatches.emplace_back( &test );
|
||||||
return FilterMatch{ extractFilterName(filter), currentMatches };
|
matches.push_back(
|
||||||
} );
|
FilterMatch{ extractFilterName( filter ), currentMatches } );
|
||||||
|
}
|
||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,9 @@ namespace Catch {
|
|||||||
};
|
};
|
||||||
|
|
||||||
kvPair splitKVPair(StringRef kvString) {
|
kvPair splitKVPair(StringRef kvString) {
|
||||||
auto splitPos = static_cast<size_t>( std::distance(
|
auto splitPos = static_cast<size_t>(
|
||||||
kvString.begin(),
|
std::find( kvString.begin(), kvString.end(), '=' ) -
|
||||||
std::find( kvString.begin(), kvString.end(), '=' ) ) );
|
kvString.begin() );
|
||||||
|
|
||||||
return { kvString.substr( 0, splitPos ),
|
return { kvString.substr( 0, splitPos ),
|
||||||
kvString.substr( splitPos + 1, kvString.size() ) };
|
kvString.substr( splitPos + 1, kvString.size() ) };
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include <catch2/internal/catch_string_manip.hpp>
|
#include <catch2/internal/catch_string_manip.hpp>
|
||||||
#include <catch2/internal/catch_stringref.hpp>
|
#include <catch2/internal/catch_stringref.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
@ -32,9 +31,9 @@ namespace Catch {
|
|||||||
return s.find( infix ) != std::string::npos;
|
return s.find( infix ) != std::string::npos;
|
||||||
}
|
}
|
||||||
void toLowerInPlace( std::string& s ) {
|
void toLowerInPlace( std::string& s ) {
|
||||||
std::transform( s.begin(), s.end(), s.begin(), []( char c ) {
|
for ( char& c : s ) {
|
||||||
return toLower( c );
|
c = toLower( c );
|
||||||
} );
|
}
|
||||||
}
|
}
|
||||||
std::string toLower( std::string const& s ) {
|
std::string toLower( std::string const& s ) {
|
||||||
std::string lc = s;
|
std::string lc = s;
|
||||||
|
@ -171,7 +171,7 @@ private:
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const auto itEnd = messages.cend();
|
const auto itEnd = messages.cend();
|
||||||
const auto N = static_cast<std::size_t>(std::distance(itMessage, itEnd));
|
const auto N = static_cast<std::size_t>(itEnd - itMessage);
|
||||||
|
|
||||||
stream << colourImpl->guardColour( colour ) << " with "
|
stream << colourImpl->guardColour( colour ) << " with "
|
||||||
<< pluralise( N, "message"_sr ) << ':';
|
<< pluralise( N, "message"_sr ) << ':';
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include <catch2/reporters/catch_reporter_helpers.hpp>
|
#include <catch2/reporters/catch_reporter_helpers.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
@ -165,7 +164,7 @@ namespace Catch {
|
|||||||
|
|
||||||
// using messages.end() directly (or auto) yields compilation error:
|
// using messages.end() directly (or auto) yields compilation error:
|
||||||
std::vector<MessageInfo>::const_iterator itEnd = messages.end();
|
std::vector<MessageInfo>::const_iterator itEnd = messages.end();
|
||||||
const std::size_t N = static_cast<std::size_t>(std::distance(itMessage, itEnd));
|
const std::size_t N = static_cast<std::size_t>(itEnd - itMessage);
|
||||||
|
|
||||||
stream << colourImpl->guardColour( colour ) << " with "
|
stream << colourImpl->guardColour( colour ) << " with "
|
||||||
<< pluralise( N, "message"_sr ) << ':';
|
<< pluralise( N, "message"_sr ) << ':';
|
||||||
|
Loading…
Reference in New Issue
Block a user