mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Added std:: qualification to some functions from C stdlib
This should solve #543, once Clara changes are in as well.
This commit is contained in:
parent
fd7dde10d3
commit
d0620c3495
@ -50,7 +50,7 @@ namespace Detail {
|
|||||||
friend bool operator == ( const T& lhs, Approx const& rhs ) {
|
friend bool operator == ( const T& lhs, Approx const& rhs ) {
|
||||||
// Thanks to Richard Harris for his help refining this formula
|
// Thanks to Richard Harris for his help refining this formula
|
||||||
auto lhs_v = double(lhs);
|
auto lhs_v = double(lhs);
|
||||||
return fabs( lhs_v - rhs.m_value ) < rhs.m_epsilon * (rhs.m_scale + (std::max)( fabs(lhs_v), fabs(rhs.m_value) ) );
|
return std::fabs( lhs_v - rhs.m_value ) < rhs.m_epsilon * (rhs.m_scale + (std::max)( std::fabs(lhs_v), std::fabs(rhs.m_value) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
||||||
@ -94,7 +94,7 @@ namespace Detail {
|
|||||||
#else
|
#else
|
||||||
friend bool operator == ( double lhs, Approx const& rhs ) {
|
friend bool operator == ( double lhs, Approx const& rhs ) {
|
||||||
// Thanks to Richard Harris for his help refining this formula
|
// Thanks to Richard Harris for his help refining this formula
|
||||||
return fabs( lhs - rhs.m_value ) < rhs.m_epsilon * (rhs.m_scale + (std::max)( fabs(lhs), fabs(rhs.m_value) ) );
|
return std::fabs( lhs - rhs.m_value ) < rhs.m_epsilon * (rhs.m_scale + (std::max)( std::fabs(lhs), std::fabs(rhs.m_value) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator == ( Approx const& lhs, double rhs ) {
|
friend bool operator == ( Approx const& lhs, double rhs ) {
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cctype>
|
||||||
|
|
||||||
#include "catch_compiler_capabilities.h"
|
#include "catch_compiler_capabilities.h"
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ namespace Catch {
|
|||||||
return s.find(infix) != std::string::npos;
|
return s.find(infix) != std::string::npos;
|
||||||
}
|
}
|
||||||
char toLowerCh(char c) {
|
char toLowerCh(char c) {
|
||||||
return static_cast<char>( ::tolower( c ) );
|
return static_cast<char>( std::tolower( c ) );
|
||||||
}
|
}
|
||||||
void toLowerInPlace( std::string& s ) {
|
void toLowerInPlace( std::string& s ) {
|
||||||
std::transform( s.begin(), s.end(), s.begin(), toLowerCh );
|
std::transform( s.begin(), s.end(), s.begin(), toLowerCh );
|
||||||
|
@ -32,7 +32,7 @@ namespace Catch {
|
|||||||
return TestCaseInfo::None;
|
return TestCaseInfo::None;
|
||||||
}
|
}
|
||||||
inline bool isReservedTag( std::string const& tag ) {
|
inline bool isReservedTag( std::string const& tag ) {
|
||||||
return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !isalnum( tag[0] );
|
return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( tag[0] );
|
||||||
}
|
}
|
||||||
inline void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {
|
inline void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {
|
||||||
if( isReservedTag( tag ) ) {
|
if( isReservedTag( tag ) ) {
|
||||||
|
@ -237,7 +237,7 @@ namespace Catch {
|
|||||||
char const* getLineOfChars() {
|
char const* getLineOfChars() {
|
||||||
static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0};
|
static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0};
|
||||||
if( !*line ) {
|
if( !*line ) {
|
||||||
memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 );
|
std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 );
|
||||||
line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0;
|
line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0;
|
||||||
}
|
}
|
||||||
return line;
|
return line;
|
||||||
|
Loading…
Reference in New Issue
Block a user