From d4793cc99fd4660d5884ad695049f00742cb8d7a Mon Sep 17 00:00:00 2001 From: Guilherme Maciel Ferreira Date: Fri, 25 Mar 2011 10:37:45 +0100 Subject: [PATCH] Improved asserts --- src/ping/pinganalyzer.cpp | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ping/pinganalyzer.cpp b/src/ping/pinganalyzer.cpp index f54af08..83ae653 100644 --- a/src/ping/pinganalyzer.cpp +++ b/src/ping/pinganalyzer.cpp @@ -26,8 +26,8 @@ PingAnalyzer::PingAnalyzer( PingsFailedCount( 0 ), ExceededPingFailedCountLimit( false ) { - BOOST_ASSERT( !host_address.empty() ); - BOOST_ASSERT( ( 0 <= limit_ping_fail_percentage ) && ( limit_ping_fail_percentage <= 100 ) ); + BOOST_ASSERT( !HostAddress.empty() ); + BOOST_ASSERT( ( 0 <= LimitPingFailPercentage ) && ( LimitPingFailPercentage <= 100 ) ); } PingAnalyzer::~PingAnalyzer() @@ -73,13 +73,15 @@ void PingAnalyzer::update_ping_statistics( bool ping_success ) bool PingAnalyzer::tried_all_resolved_ip() const { - return ( PingsPerformedCount >= ResolvedIpCount ); + BOOST_ASSERT( ( 0 <= PingsPerformedCount ) && ( PingsPerformedCount <= ResolvedIpCount ) ); + + return ( PingsPerformedCount == ResolvedIpCount ); } void PingAnalyzer::analyze_ping_statistics() { - BOOST_ASSERT( PingsPerformedCount == ResolvedIpCount ); BOOST_ASSERT( !HostAddress.empty() ); + BOOST_ASSERT( PingsPerformedCount == ResolvedIpCount ); // notify if the amount of pings that failed exceed the limit if ( exceeded_ping_failed_count_limit() ) -- 1.7.1