Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2
diff options
context:
space:
mode:
authorMartin Hořeňovský2022-04-28 14:06:01 +0200
committerMartin Hořeňovský2022-04-28 14:56:33 +0200
commit332de39cd4ba410e9dd9de670ea87a7c0dc7a8dd (patch)
tree3ecf3ab90e138011736d99a74bce9b5b83704d8f /src/catch2
parentc410e2596c872ff86974c8db5f011ca8b9cf445c (diff)
downloadcatch3-332de39cd4ba410e9dd9de670ea87a7c0dc7a8dd.tar.gz
Remove some useless casts
Diffstat (limited to 'src/catch2')
-rw-r--r--src/catch2/catch_test_case_info.cpp2
-rw-r--r--src/catch2/internal/catch_stringref.cpp2
-rw-r--r--src/catch2/matchers/catch_matchers_floating_point.cpp20
3 files changed, 18 insertions, 6 deletions
diff --git a/src/catch2/catch_test_case_info.cpp b/src/catch2/catch_test_case_info.cpp
index 6d89dc72..c1a0a431 100644
--- a/src/catch2/catch_test_case_info.cpp
+++ b/src/catch2/catch_test_case_info.cpp
@@ -58,7 +58,7 @@ namespace Catch {
else if( tag == "!nonportable"_sr )
return TestCaseProperties::NonPortable;
else if( tag == "!benchmark"_sr )
- return static_cast<TestCaseProperties>(TestCaseProperties::Benchmark | TestCaseProperties::IsHidden );
+ return TestCaseProperties::Benchmark | TestCaseProperties::IsHidden;
else
return TestCaseProperties::None;
}
diff --git a/src/catch2/internal/catch_stringref.cpp b/src/catch2/internal/catch_stringref.cpp
index 82eef686..46bbfafd 100644
--- a/src/catch2/internal/catch_stringref.cpp
+++ b/src/catch2/internal/catch_stringref.cpp
@@ -14,7 +14,7 @@
namespace Catch {
StringRef::StringRef( char const* rawChars ) noexcept
- : StringRef( rawChars, static_cast<StringRef::size_type>(std::strlen(rawChars) ) )
+ : StringRef( rawChars, std::strlen(rawChars) )
{}
auto StringRef::operator == ( StringRef other ) const noexcept -> bool {
diff --git a/src/catch2/matchers/catch_matchers_floating_point.cpp b/src/catch2/matchers/catch_matchers_floating_point.cpp
index ad0fd378..4d40140f 100644
--- a/src/catch2/matchers/catch_matchers_floating_point.cpp
+++ b/src/catch2/matchers/catch_matchers_floating_point.cpp
@@ -150,14 +150,26 @@ namespace Detail {
ret << " ([";
if (m_type == Detail::FloatingPointKind::Double) {
- write(ret, step(m_target, static_cast<double>(-INFINITY), m_ulps));
+ write( ret,
+ step( m_target,
+ -std::numeric_limits<double>::infinity(),
+ m_ulps ) );
ret << ", ";
- write(ret, step(m_target, static_cast<double>( INFINITY), m_ulps));
+ write( ret,
+ step( m_target,
+ std::numeric_limits<double>::infinity(),
+ m_ulps ) );
} else {
// We have to cast INFINITY to float because of MinGW, see #1782
- write(ret, step(static_cast<float>(m_target), static_cast<float>(-INFINITY), m_ulps));
+ write( ret,
+ step( static_cast<float>( m_target ),
+ -std::numeric_limits<float>::infinity(),
+ m_ulps ) );
ret << ", ";
- write(ret, step(static_cast<float>(m_target), static_cast<float>( INFINITY), m_ulps));
+ write( ret,
+ step( static_cast<float>( m_target ),
+ std::numeric_limits<float>::infinity(),
+ m_ulps ) );
}
ret << "])";