mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Removed C-style casts
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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"; | ||||
|             } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Phil Nash
					Phil Nash