Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Removed C-style casts

Commit
a31f05fe83197c2cf8fc529b96e595a3dc21b416
Author
Phil Nash ·
Parents
08e5296720e2

Files · Download .tar.gz

Changes

 include/internal/catch_commandline.hpp       | 4 ++--
 include/internal/catch_test_case_info.hpp    | 2 +-
 include/internal/catch_test_spec.hpp         | 2 +-
 include/internal/catch_timer.hpp             | 6 +++---
 include/reporters/catch_reporter_console.hpp | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp
index baed9c81..c7c33845 100644
--- a/include/internal/catch_commandline.hpp
+++ b/include/internal/catch_commandline.hpp
@@ -26,14 +26,14 @@ namespace Catch {
 
     inline void addWarning( ConfigData& config, std::string const& _warning ) {
         if( _warning == "NoAssertions" )
-            config.warnings = (WarnAbout::What)( config.warnings | WarnAbout::NoAssertions );
+            config.warnings = static_cast<WarnAbout::What>( config.warnings | WarnAbout::NoAssertions );
         else
             throw std::runtime_error( "Unrecognised warning: '" + _warning + "'" );
 
     }
     inline void setVerbosity( ConfigData& config, int level ) {
         // !TBD: accept strings?
-        config.verbosity = (Verbosity::Level)level;
+        config.verbosity = static_cast<Verbosity::Level>( level );
     }
     inline void setShowDurations( ConfigData& config, bool _showDurations ) {
         config.showDurations = _showDurations
diff --git a/include/internal/catch_test_case_info.hpp b/include/internal/catch_test_case_info.hpp
index b277ef1e..e3fa1f7d 100644
--- a/include/internal/catch_test_case_info.hpp
+++ b/include/internal/catch_test_case_info.hpp
@@ -108,7 +108,7 @@ namespace Catch {
         for( std::set<std::string>::const_iterator it = _tags.begin(), itEnd = _tags.end(); it != itEnd; ++it ) {
             oss << "[" << *it << "]";
             std::string lcaseTag = toLower( *it );
-            properties = (SpecialProperties)( properties | parseSpecialTag( lcaseTag ) );
+            properties = static_cast<SpecialProperties>( properties | parseSpecialTag( lcaseTag ) );
             lcaseTags.insert( lcaseTag );
         }
         tagsAsString = oss.str();
diff --git a/include/internal/catch_test_spec.hpp b/include/internal/catch_test_spec.hpp
index 2edf5443..b5f70635 100644
--- a/include/internal/catch_test_spec.hpp
+++ b/include/internal/catch_test_spec.hpp
@@ -41,7 +41,7 @@ namespace Catch {
                 }
                 if( endsWith( m_name, "*" ) ) {
                     m_name = m_name.substr( 0, m_name.size()-1 );
-                    m_wildcard = (WildcardPosition)( m_wildcard | WildcardAtEnd );
+                    m_wildcard = static_cast<WildcardPosition>( m_wildcard | WildcardAtEnd );
                 }
             }
             virtual ~NamePattern();
diff --git a/include/internal/catch_timer.hpp b/include/internal/catch_timer.hpp
index 6f716b1e..b60fa2b5 100644
--- a/include/internal/catch_timer.hpp
+++ b/include/internal/catch_timer.hpp
@@ -38,7 +38,7 @@ namespace Catch {
         uint64_t getCurrentTicks() {
             timeval t;
             gettimeofday(&t,NULL);
-            return (uint64_t)t.tv_sec * 1000000ull + (uint64_t)t.tv_usec;
+            return static_cast<uint64_t>( t.tv_sec ) * 1000000ull + static_cast<uint64_t>( t.tv_usec );
         }
 #endif
     }
@@ -47,10 +47,10 @@ namespace Catch {
         m_ticks = getCurrentTicks();
     }
     unsigned int Timer::getElapsedNanoseconds() const {
-        return (unsigned int)(getCurrentTicks() - m_ticks);
+        return static_cast<unsigned int>(getCurrentTicks() - m_ticks);
     }
     unsigned int Timer::getElapsedMilliseconds() const {
-        return (unsigned int)((getCurrentTicks() - m_ticks)/1000);
+        return static_cast<unsigned int>((getCurrentTicks() - m_ticks)/1000);
     }
     double Timer::getElapsedSeconds() const {
         return (getCurrentTicks() - m_ticks)/1000000.0;
diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp
index b2309701..f9373598 100644
--- a/include/reporters/catch_reporter_console.hpp
+++ b/include/reporters/catch_reporter_console.hpp
@@ -324,7 +324,7 @@ namespace Catch {
         }
 
         void printTotals( Totals const& totals ) {
-            int cols = 1+(int)log10( (float)std::max( totals.testCases.total(), totals.assertions.total() ) );
+            int cols = 1+static_cast<int>( log10( static_cast<float>( (std::max)( totals.testCases.total(), totals.assertions.total() ) ) ) );
             if( totals.testCases.total() == 0 ) {
                 stream << Colour( Colour::Warning ) << "No tests ran\n";
             }