mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Moved inline functions in cpp files into anon namespaces
This commit is contained in:
parent
504607701b
commit
b8553d62a3
@ -18,10 +18,12 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
inline auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& {
|
||||
namespace {
|
||||
auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& {
|
||||
expr.streamReconstructedExpression( os );
|
||||
return os;
|
||||
}
|
||||
}
|
||||
|
||||
LazyExpression::LazyExpression( bool isNegated )
|
||||
: m_isNegated( isNegated )
|
||||
|
@ -14,6 +14,12 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
namespace {
|
||||
char toLowerCh(char c) {
|
||||
return static_cast<char>( std::tolower( c ) );
|
||||
}
|
||||
}
|
||||
|
||||
bool startsWith( std::string const& s, std::string const& prefix ) {
|
||||
return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin());
|
||||
}
|
||||
@ -29,9 +35,6 @@ namespace Catch {
|
||||
bool contains( std::string const& s, std::string const& infix ) {
|
||||
return s.find( infix ) != std::string::npos;
|
||||
}
|
||||
inline char toLowerCh(char c) {
|
||||
return static_cast<char>( std::tolower( c ) );
|
||||
}
|
||||
void toLowerInPlace( std::string& s ) {
|
||||
std::transform( s.begin(), s.end(), s.begin(), toLowerCh );
|
||||
}
|
||||
|
@ -19,7 +19,8 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
inline TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) {
|
||||
namespace {
|
||||
TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) {
|
||||
if( startsWith( tag, '.' ) ||
|
||||
tag == "!hide" )
|
||||
return TestCaseInfo::IsHidden;
|
||||
@ -36,15 +37,16 @@ namespace Catch {
|
||||
else
|
||||
return TestCaseInfo::None;
|
||||
}
|
||||
inline bool isReservedTag( std::string const& tag ) {
|
||||
bool isReservedTag( std::string const& tag ) {
|
||||
return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( static_cast<unsigned char>(tag[0]) );
|
||||
}
|
||||
inline void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {
|
||||
void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {
|
||||
CATCH_ENFORCE( !isReservedTag(tag),
|
||||
"Tag name: [" << tag << "] is not allowed.\n"
|
||||
<< "Tag names starting with non alpha-numeric characters are reserved\n"
|
||||
<< _lineInfo );
|
||||
}
|
||||
}
|
||||
|
||||
TestCase makeTestCase( ITestInvoker* _testCase,
|
||||
std::string const& _className,
|
||||
|
@ -18,7 +18,8 @@ namespace Catch {
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();
|
||||
}
|
||||
|
||||
inline auto estimateClockResolution() -> uint64_t {
|
||||
namespace {
|
||||
auto estimateClockResolution() -> uint64_t {
|
||||
uint64_t sum = 0;
|
||||
static const uint64_t iterations = 1000000;
|
||||
|
||||
@ -47,6 +48,7 @@ namespace Catch {
|
||||
// - and potentially do more iterations if there's a high variance.
|
||||
return sum/iterations;
|
||||
}
|
||||
}
|
||||
auto getEstimatedClockResolution() -> uint64_t {
|
||||
static auto s_resolution = estimateClockResolution();
|
||||
return s_resolution;
|
||||
|
Loading…
Reference in New Issue
Block a user