Improved asserts
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Fri, 25 Mar 2011 09:37:45 +0000 (10:37 +0100)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Fri, 25 Mar 2011 09:38:31 +0000 (10:38 +0100)
src/ping/pinganalyzer.cpp

index f54af08..83ae653 100644 (file)
@@ -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() )