do not dump stuff on std::cout during tests
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 03 May 2011 11:23:11 +0200
changeset 7118 a18895058cb1
parent 7117 a35590a0cba4
child 7119 ce5195475f2b
do not dump stuff on std::cout during tests
src/energy/test/basic-energy-model-test.cc
src/energy/test/rv-battery-model-test.cc
--- a/src/energy/test/basic-energy-model-test.cc	Tue May 03 11:22:20 2011 +0200
+++ b/src/energy/test/basic-energy-model-test.cc	Tue May 03 11:23:11 2011 +0200
@@ -186,16 +186,16 @@
 
   // obtain remaining energy from source
   double remainingEnergy = source->GetRemainingEnergy ();
-  NS_LOG_UNCOND ("Remaining energy is " << remainingEnergy);
-  NS_LOG_UNCOND ("Estimated remaining energy is " << estRemainingEnergy);
-  NS_LOG_UNCOND ("Difference is " << estRemainingEnergy - remainingEnergy);
+  NS_LOG_DEBUG ("Remaining energy is " << remainingEnergy);
+  NS_LOG_DEBUG ("Estimated remaining energy is " << estRemainingEnergy);
+  NS_LOG_DEBUG ("Difference is " << estRemainingEnergy - remainingEnergy);
   // check remaining energy
   NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL (remainingEnergy, estRemainingEnergy, m_tolerance,
                              "Incorrect remaining energy!");
 
   // obtain radio state
   WifiPhy::State endState = devModel->GetCurrentState ();
-  NS_LOG_UNCOND ("Radio state is " << endState);
+  NS_LOG_DEBUG ("Radio state is " << endState);
   // check end state
   NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (endState, state,  "Incorrect end state!");
   Simulator::Destroy ();
@@ -353,10 +353,10 @@
   Simulator::Run ();
   Simulator::Destroy ();
 
-  NS_LOG_UNCOND ("Simulation time = " << simTimeS << "s");
-  NS_LOG_UNCOND ("Update interval = " << updateIntervalS << "s");
-  NS_LOG_UNCOND ("Expected callback count is " << m_numOfNodes);
-  NS_LOG_UNCOND ("Actual callback count is " << m_callbackCount);
+  NS_LOG_DEBUG ("Simulation time = " << simTimeS << "s");
+  NS_LOG_DEBUG ("Update interval = " << updateIntervalS << "s");
+  NS_LOG_DEBUG ("Expected callback count is " << m_numOfNodes);
+  NS_LOG_DEBUG ("Actual callback count is " << m_callbackCount);
 
   // check result, call back should only be invoked once
   NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (m_numOfNodes, m_callbackCount, "Not all callbacks are invoked!");
--- a/src/energy/test/rv-battery-model-test.cc	Tue May 03 11:22:20 2011 +0200
+++ b/src/energy/test/rv-battery-model-test.cc	Tue May 03 11:23:11 2011 +0200
@@ -640,7 +640,7 @@
 void
 BatteryLifetimeTest::DoRun (void)
 {
-  NS_LOG_UNCOND ("Constant load run.");
+  NS_LOG_DEBUG ("Constant load run.");
 
   // 640mA
   NS_TEST_ASSERT_MSG_EQ (ConstantLoadTest (0.640, Seconds (2844.0)), false,  "Problems with constant load test (640mA).");
@@ -657,13 +657,13 @@
   CreateLoadProfiles ();
 
   // variable load with Itsy battery
-  NS_LOG_UNCOND ("\n\nItsy");
+  NS_LOG_DEBUG ("\n\nItsy");
   m_alpha = 35220;
   m_beta = 0.637;
   for (uint32_t i = 0; i < m_loadProfiles.size (); i++)
     {
-      NS_LOG_UNCOND ("========");
-      NS_LOG_UNCOND ("Variable load profile C" << i + 1);
+      NS_LOG_DEBUG ("========");
+      NS_LOG_DEBUG ("Variable load profile C" << i + 1);
       if (VariableLoadTest (m_loadProfiles[i].loads,
                             m_loadProfiles[i].timeStamps,
                             m_loadProfiles[i].itsyLifetime))
@@ -673,13 +673,13 @@
     }
 
   // variable load with DUALFOIL battery
-  NS_LOG_UNCOND ("\n\nDUALFOIL");
+  NS_LOG_DEBUG ("\n\nDUALFOIL");
   m_alpha = 40027;
   m_beta = 0.276;
   for (uint32_t i = 0; i < m_loadProfiles.size (); i++)
     {
-      NS_LOG_UNCOND ("========");
-      NS_LOG_UNCOND ("Variable load profile C" << i + 1);
+      NS_LOG_DEBUG ("========");
+      NS_LOG_DEBUG ("Variable load profile C" << i + 1);
       if (VariableLoadTest (m_loadProfiles[i].loads,
                             m_loadProfiles[i].timeStamps,
                             m_loadProfiles[i].dualFoilLifeTime))
@@ -757,8 +757,8 @@
   Ptr<RvBatteryModel> srcPtr = DynamicCast<RvBatteryModel> (sources.Get (0));
   actualLifetime = srcPtr->GetLifetime ();
 
-  NS_LOG_UNCOND ("Expected lifetime = " << expLifetime.GetSeconds () << "s");
-  NS_LOG_UNCOND ("Actual lifetime = " << actualLifetime.GetSeconds () << "s");
+  NS_LOG_DEBUG ("Expected lifetime = " << expLifetime.GetSeconds () << "s");
+  NS_LOG_DEBUG ("Actual lifetime = " << actualLifetime.GetSeconds () << "s");
 
   NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (actualLifetime, expLifetime, "Incorrect lifetime!");
   /*
@@ -853,9 +853,9 @@
     Ptr<RvBatteryModel> srcPtr = DynamicCast<RvBatteryModel> (sources.Get (0));
     actualLifetime = srcPtr->GetLifetime ();
 
-    NS_LOG_UNCOND ("Expected lifetime = " << expLifetime.GetSeconds () << "s");
-    NS_LOG_UNCOND ("Actual lifetime = " << actualLifetime.GetSeconds () << "s");
-    NS_LOG_UNCOND ("Difference = " << expLifetime.GetSeconds () - actualLifetime.GetSeconds () << "s");
+    NS_LOG_DEBUG ("Expected lifetime = " << expLifetime.GetSeconds () << "s");
+    NS_LOG_DEBUG ("Actual lifetime = " << actualLifetime.GetSeconds () << "s");
+    NS_LOG_DEBUG ("Difference = " << expLifetime.GetSeconds () - actualLifetime.GetSeconds () << "s");
 
     //NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (actualLifetime, expLifetime, "Incorrect lifetime!");
     NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL (actualLifetime.GetSeconds (), expLifetime.GetSeconds (),