--- a/CHANGES.html Mon Jan 10 15:55:29 2011 -0800
+++ b/CHANGES.html Mon Jan 17 12:53:20 2011 -0800
@@ -44,6 +44,28 @@
us a note on ns-developers mailing list. </p>
<hr>
+<h1>Changes from ns-3.10 to ns-3.11</h1>
+
+<h2>Changes to build system:</h2>
+<ul>
+</ul>
+
+<h2>New API:</h2>
+<ul>
+</ul>
+
+<h2>Changes to existing API:</h2>
+<ul>
+<li><b>Test cases no longer return a boolean value</b>
+<p>Unit test case DoRun() functions no longer return a bool value. Now, they don't return a value at all. The motivation for this change was to disallow users from merely returning "true" from a test case to force an error to be recorded. Instead, test case macros should be used.
+</p></li>
+</ul>
+
+<h2>Changed behavior:</h2>
+<ul>
+</ul>
+
+<hr>
<h1>Changes from ns-3.9 to ns-3.10</h1>
<h2>Changes to build system:</h2>
--- a/doc/testing/source/testing-framework.rst Mon Jan 10 15:55:29 2011 -0800
+++ b/doc/testing/source/testing-framework.rst Mon Jan 17 12:53:20 2011 -0800
@@ -654,7 +654,7 @@
class MyTestCase : public TestCase
{
MyTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
MyTestCase::MyTestCase ()
@@ -662,11 +662,10 @@
{
}
- bool
+ void
MyTestCase::DoRun (void)
{
NS_TEST_ASSERT_MSG_EQ (true, true, "Some failure message");
- return GetErrorStatus ();
}
Utilities
--- a/src/applications/udp-client-server/udp-client-server-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/applications/udp-client-server/udp-client-server-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -48,7 +48,7 @@
virtual ~UdpClientServerTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -61,7 +61,7 @@
{
}
-bool UdpClientServerTestCase::DoRun (void)
+void UdpClientServerTestCase::DoRun (void)
{
NodeContainer n;
n.Create (2);
@@ -102,8 +102,6 @@
NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetLost (), 0, "Packets were lost !");
NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetReceived (), 8, "Did not receive expected number of packets !");
-
- return GetErrorStatus ();
}
/**
@@ -118,7 +116,7 @@
virtual ~UdpTraceClientServerTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -131,7 +129,7 @@
{
}
-bool UdpTraceClientServerTestCase::DoRun (void)
+void UdpTraceClientServerTestCase::DoRun (void)
{
NodeContainer n;
n.Create (2);
@@ -167,8 +165,6 @@
NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetLost (), 0, "Packets were lost !");
NS_TEST_ASSERT_MSG_EQ (server.GetServer ()->GetReceived (), 247, "Did not receive expected number of packets !");
-
- return GetErrorStatus ();
}
@@ -183,7 +179,7 @@
virtual ~PacketLossCounterTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -196,7 +192,7 @@
{
}
-bool PacketLossCounterTestCase::DoRun (void)
+void PacketLossCounterTestCase::DoRun (void)
{
PacketLossCounter lossCounter(32);
lossCounter.NotifyReceived(32); //out of order
@@ -245,9 +241,6 @@
lossCounter.NotifyReceived(i);
}
NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost(), 9, "Check that 9 (6+1+2) packet are lost");
-
-
- return GetErrorStatus ();
}
class UdpClientServerTestSuite: public TestSuite
{
--- a/src/common/buffer-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/common/buffer-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -11,7 +11,7 @@
private:
bool EnsureWrittenBytes (Buffer b, uint32_t n, uint8_t array[]);
public:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
BufferTest ();
};
@@ -71,7 +71,7 @@
} \
}
-bool
+void
BufferTest::DoRun (void)
{
Buffer buffer;
@@ -317,8 +317,6 @@
i = other.Begin ();
i.Write (buffer.Begin (), buffer.End ());
ENSURE_WRITTEN_BYTES (other, 9, 0x1, 0x2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3, 0x4);
-
- return GetErrorStatus ();
}
//-----------------------------------------------------------------------------
class BufferTestSuite : public TestSuite
--- a/src/common/packet-metadata-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/common/packet-metadata-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -253,7 +253,7 @@
PacketMetadataTest ();
virtual ~PacketMetadataTest ();
bool CheckHistory (Ptr<Packet> p, const char *file, int line, uint32_t n, ...);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
private:
Ptr<Packet> DoAddHeader (Ptr<Packet> p);
};
@@ -400,7 +400,7 @@
return p;
}
-bool
+void
PacketMetadataTest::DoRun (void)
{
bool result = true;
@@ -774,8 +774,6 @@
CHECK_HISTORY (p, 1, 500);
p->RemoveAtStart (10);
CHECK_HISTORY (p, 1, 490);
-
- return !result;
}
//-----------------------------------------------------------------------------
class PacketMetadataTestSuite : public TestSuite
--- a/src/common/packet.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/common/packet.cc Mon Jan 17 12:53:20 2011 -0800
@@ -1079,7 +1079,7 @@
{
public:
PacketTest ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
private:
void DoCheck (Ptr<const Packet> p, const char *file, int line, uint32_t n, ...);
};
@@ -1126,7 +1126,7 @@
NS_TEST_EXPECT_MSG_EQ (j, expected.size (), "Size match");
}
-bool
+void
PacketTest::DoRun (void)
{
Ptr<Packet> pkt1 = Create<Packet> (reinterpret_cast<const uint8_t*> ("hello"), 5);
@@ -1307,8 +1307,6 @@
CHECK (tmp, 1, E (20, 1, 1001));
#endif
}
-
- return GetErrorStatus ();
}
//-----------------------------------------------------------------------------
class PacketTestSuite : public TestSuite
--- a/src/common/pcap-file-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/common/pcap-file-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -86,7 +86,7 @@
private:
virtual void DoSetup (void);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
std::string m_testFilename;
@@ -116,7 +116,7 @@
remove (m_testFilename.c_str ());
}
-bool
+void
WriteModeCreateTestCase::DoRun (void)
{
PcapFile f;
@@ -184,8 +184,6 @@
f.Write (0, 0, buffer, 128);
NS_TEST_ASSERT_MSG_EQ (f.Fail (), false, "Write (write-only-file " << m_testFilename <<
") returns error");
-
- return false;
}
// ===========================================================================
@@ -200,7 +198,7 @@
private:
virtual void DoSetup (void);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
std::string m_testFilename;
@@ -230,7 +228,7 @@
remove (m_testFilename.c_str ());
}
-bool
+void
ReadModeCreateTestCase::DoRun (void)
{
PcapFile f;
@@ -291,8 +289,6 @@
") does not return error");
f.Close ();
f.Clear ();
-
- return false;
}
#if 0
@@ -308,7 +304,7 @@
private:
virtual void DoSetup (void);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
std::string m_testFilename;
@@ -338,7 +334,7 @@
remove (m_testFilename.c_str ());
}
-bool
+void
AppendModeCreateTestCase::DoRun (void)
{
PcapFile f;
@@ -399,8 +395,6 @@
NS_TEST_ASSERT_MSG_EQ (f.Fail (), false, "Write (append-mode-file " << m_testFilename << ") returns error");
f.Close ();
-
- return false;
}
#endif
@@ -416,7 +410,7 @@
private:
virtual void DoSetup (void);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
std::string m_testFilename;
@@ -446,7 +440,7 @@
remove (m_testFilename.c_str ());
}
-bool
+void
FileHeaderTestCase::DoRun (void)
{
PcapFile f;
@@ -639,8 +633,6 @@
NS_TEST_ASSERT_MSG_EQ (f.GetDataLinkType (), 1234, "Read back data link type incorrectly");
f.Close ();
-
- return false;
}
// ===========================================================================
@@ -655,7 +647,7 @@
private:
virtual void DoSetup (void);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
std::string m_testFilename;
@@ -685,7 +677,7 @@
remove (m_testFilename.c_str ());
}
-bool
+void
RecordHeaderTestCase::DoRun (void)
{
PcapFile f;
@@ -943,8 +935,6 @@
}
f.Close ();
-
- return false;
}
// ===========================================================================
@@ -959,7 +949,7 @@
private:
virtual void DoSetup (void);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
std::string m_testFilename;
@@ -1011,7 +1001,7 @@
};
-bool
+void
ReadFileTestCase::DoRun (void)
{
PcapFile f;
@@ -1055,8 +1045,6 @@
NS_TEST_ASSERT_MSG_EQ (f.Eof (), true, "Read() of known good pcap file at EOF does not return error");
f.Close ();
-
- return false;
}
// ===========================================================================
@@ -1068,7 +1056,7 @@
DiffTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
DiffTestCase::DiffTestCase ()
@@ -1076,7 +1064,7 @@
{
}
-bool
+void
DiffTestCase::DoRun (void)
{
//
@@ -1111,8 +1099,6 @@
NS_TEST_EXPECT_MSG_EQ (diff, true, "PcapDiff(file, file2) must be true");
NS_TEST_EXPECT_MSG_EQ (sec, 2, "Files are different from 2.3696 seconds");
NS_TEST_EXPECT_MSG_EQ (usec, 3696, "Files are different from 2.3696 seconds");
-
- return GetErrorStatus();
}
class PcapFileTestSuite : public TestSuite
--- a/src/common/propagation-loss-model-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/common/propagation-loss-model-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -41,7 +41,7 @@
virtual ~FriisPropagationLossModelTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
typedef struct {
Vector m_position;
@@ -62,7 +62,7 @@
{
}
-bool
+void
FriisPropagationLossModelTestCase::DoRun (void)
{
// The ns-3 testing manual gives more background on the values selected
@@ -127,8 +127,6 @@
double resultW = pow (10.0, resultdBm/10.0)/1000;
NS_TEST_EXPECT_MSG_EQ_TOL (resultW, testVector.m_pr, testVector.m_tolerance, "Got unexpected rcv power");
}
-
- return GetErrorStatus ();
}
// Added for Two-Ray Ground Model - tomhewer@mac.com
@@ -140,7 +138,7 @@
virtual ~TwoRayGroundPropagationLossModelTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
typedef struct
{
@@ -163,7 +161,7 @@
{
}
-bool
+void
TwoRayGroundPropagationLossModelTestCase::DoRun (void)
{
// wavelength at 2.4 GHz is 0.125m
@@ -258,8 +256,6 @@
double resultW = pow (10.0, resultdBm / 10.0) / 1000;
NS_TEST_EXPECT_MSG_EQ_TOL (resultW, testVector.m_pr, testVector.m_tolerance, "Got unexpected rcv power");
}
-
- return GetErrorStatus ();
}
@@ -270,7 +266,7 @@
virtual ~LogDistancePropagationLossModelTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
typedef struct {
Vector m_position;
@@ -291,7 +287,7 @@
{
}
-bool
+void
LogDistancePropagationLossModelTestCase::DoRun (void)
{
// reference loss at 2.4 GHz is 40.045997
@@ -348,8 +344,6 @@
double resultW = pow (10.0, resultdBm/10.0)/1000;
NS_TEST_EXPECT_MSG_EQ_TOL (resultW, testVector.m_pr, testVector.m_tolerance, "Got unexpected rcv power");
}
-
- return GetErrorStatus ();
}
class MatrixPropagationLossModelTestCase : public TestCase
@@ -359,7 +353,7 @@
virtual ~MatrixPropagationLossModelTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
MatrixPropagationLossModelTestCase::MatrixPropagationLossModelTestCase ()
@@ -371,7 +365,7 @@
{
}
-bool
+void
MatrixPropagationLossModelTestCase::DoRun (void)
{
Ptr<Node> n[3];
@@ -401,8 +395,6 @@
NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[2], m[1]), 0, "Loss 2 -> 1 incorrect");
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
class RangePropagationLossModelTestCase : public TestCase
@@ -412,7 +404,7 @@
virtual ~RangePropagationLossModelTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
RangePropagationLossModelTestCase::RangePropagationLossModelTestCase ()
@@ -424,7 +416,7 @@
{
}
-bool
+void
RangePropagationLossModelTestCase::DoRun (void)
{
Config::SetDefault ("ns3::RangePropagationLossModel::MaxRange", DoubleValue (127.2));
@@ -443,8 +435,6 @@
resultdBm = lossModel->CalcRxPower (txPwrdBm, a, b);
NS_TEST_EXPECT_MSG_EQ_TOL (resultdBm, -1000.0, tolerance, "Got unexpected rcv power");
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
class PropagationLossModelsTestSuite : public TestSuite
--- a/src/common/sequence-number.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/common/sequence-number.cc Mon Jan 17 12:53:20 2011 -0800
@@ -74,7 +74,7 @@
SequenceNumberTestCase ();
virtual ~SequenceNumberTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
SequenceNumberTestCase::SequenceNumberTestCase ()
@@ -94,7 +94,7 @@
m_newval = newval;
}
-bool SequenceNumberTestCase::DoRun (void)
+void SequenceNumberTestCase::DoRun (void)
{
#define NS_TEST_ASSERT_EQUAL(a,b) NS_TEST_ASSERT_MSG_EQ(a,b, "foo")
#define NS_TEST_ASSERT(a) NS_TEST_ASSERT_MSG_EQ(bool(a), true, "foo")
@@ -177,8 +177,6 @@
obj->Dispose ();
}
-
- return false;
}
static class SequenceNumberTestSuite : public TestSuite
--- a/src/common/spectrum-value-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/common/spectrum-value-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -38,7 +38,7 @@
public:
SpectrumValueTestCase (SpectrumValue a, SpectrumValue b, std::string name);
virtual ~SpectrumValueTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
private:
bool MoreOrLessEqual (SpectrumValue x, SpectrumValue y);
@@ -67,7 +67,7 @@
return (Norm (z) < TOLERANCE);
}
-bool
+void
SpectrumValueTestCase::DoRun (void)
{
bool error = !MoreOrLessEqual (m_a, m_b);
@@ -86,7 +86,6 @@
std::string ("no message"),
__FILE__, __LINE__);
}
- return error;
}
--- a/src/contrib/energy/test/basic-energy-model-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/contrib/energy/test/basic-energy-model-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -50,7 +50,7 @@
virtual ~BasicEnergyUpdateTest ();
private:
- bool DoRun (void);
+ void DoRun (void);
/**
* \param state Radio state to switch to.
@@ -80,7 +80,7 @@
{
}
-bool
+void
BasicEnergyUpdateTest::DoRun (void)
{
// set types
@@ -88,29 +88,11 @@
m_deviceEnergyModel.SetTypeId ("ns3::WifiRadioEnergyModel");
// run state switch tests
- if (StateSwitchTest (WifiPhy::IDLE))
- {
- return true;
- }
- if (StateSwitchTest (WifiPhy::CCA_BUSY))
- {
- return true;
- }
- if (StateSwitchTest (WifiPhy::TX))
- {
- return true;
- }
- if (StateSwitchTest (WifiPhy::RX))
- {
- return true;
- }
- if (StateSwitchTest (WifiPhy::SWITCHING))
- {
- return true;
- }
-
- // error free
- return false;
+ NS_TEST_ASSERT_MSG_EQ (StateSwitchTest (WifiPhy::IDLE), false, "Problem with state switch test (WifiPhy idle).");
+ NS_TEST_ASSERT_MSG_EQ (StateSwitchTest (WifiPhy::CCA_BUSY), false, "Problem with state switch test (WifiPhy cca busy).");
+ NS_TEST_ASSERT_MSG_EQ (StateSwitchTest (WifiPhy::TX), false, "Problem with state switch test (WifiPhy tx).");
+ NS_TEST_ASSERT_MSG_EQ (StateSwitchTest (WifiPhy::RX), false, "Problem with state switch test (WifiPhy rx).");
+ NS_TEST_ASSERT_MSG_EQ (StateSwitchTest (WifiPhy::SWITCHING), false, "Problem with state switch test (WifiPhy switching).");
}
bool
@@ -136,12 +118,12 @@
DeviceEnergyModelContainer models =
source->FindDeviceEnergyModels ("ns3::WifiRadioEnergyModel");
// check list
- NS_TEST_ASSERT_MSG_EQ (false, (models.GetN () == 0), "Model list is empty!");
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (false, (models.GetN () == 0), "Model list is empty!");
// get pointer
Ptr<WifiRadioEnergyModel> devModel =
DynamicCast<WifiRadioEnergyModel> (models.Get (0));
// check pointer
- NS_TEST_ASSERT_MSG_NE (0, devModel, "NULL pointer to device model!");
+ NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL (0, devModel, "NULL pointer to device model!");
/*
* The radio will stay IDLE for m_timeS seconds. Then it will switch into a
@@ -208,14 +190,14 @@
NS_LOG_UNCOND ("Estimated remaining energy is " << estRemainingEnergy);
NS_LOG_UNCOND ("Difference is " << estRemainingEnergy - remainingEnergy);
// check remaining energy
- NS_TEST_ASSERT_MSG_EQ_TOL (remainingEnergy, estRemainingEnergy, m_tolerance,
+ 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);
// check end state
- NS_TEST_ASSERT_MSG_EQ (endState, state, "Incorrect end state!");
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (endState, state, "Incorrect end state!");
Simulator::Destroy ();
return false; // no error
@@ -234,7 +216,7 @@
virtual ~BasicEnergyDepletionTest ();
private:
- bool DoRun (void);
+ void DoRun (void);
/**
* Callback invoked when energy is drained from source.
@@ -273,7 +255,7 @@
{
}
-bool
+void
BasicEnergyDepletionTest::DoRun (void)
{
/*
@@ -284,16 +266,11 @@
for (double updateIntervalS = 0.5; updateIntervalS <= m_updateIntervalS;
updateIntervalS += m_timeStepS)
{
- if (DepletionTestCase (simTimeS, updateIntervalS))
- {
- return true;
- }
+ NS_TEST_ASSERT_MSG_EQ (DepletionTestCase (simTimeS, updateIntervalS), false, "Depletion test case problem.");
// reset callback count
m_callbackCount = 0;
}
}
- // error free
- return false;
}
void
@@ -383,7 +360,7 @@
NS_LOG_UNCOND ("Actual callback count is " << m_callbackCount);
// check result, call back should only be invoked once
- NS_TEST_ASSERT_MSG_EQ (m_numOfNodes, m_callbackCount, "Not all callbacks are invoked!");
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (m_numOfNodes, m_callbackCount, "Not all callbacks are invoked!");
return false;
}
--- a/src/contrib/energy/test/li-ion-energy-source-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/contrib/energy/test/li-ion-energy-source-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -35,7 +35,7 @@
LiIonEnergyTestCase ();
~LiIonEnergyTestCase ();
- bool DoRun (void);
+ void DoRun (void);
double m_simTime;
Ptr<Node> m_node;
@@ -51,7 +51,7 @@
m_node = 0;
}
-bool
+void
LiIonEnergyTestCase::DoRun ()
{
m_node = CreateObject<Node> ();
@@ -76,8 +76,6 @@
NS_TEST_ASSERT_MSG_EQ_TOL (es->GetSupplyVoltage (), 3.6, 1.0e-3,
"Incorrect consumed energy!");
-
- return false;
}
class LiIonEnergySourceTestSuite : public TestSuite
--- a/src/contrib/energy/test/rv-battery-model-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/contrib/energy/test/rv-battery-model-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -61,7 +61,7 @@
*
* Runs test.
*/
- bool DoRun (void);
+ void DoRun (void);
/**
* \param load Load value, in Amperes (A).
@@ -637,35 +637,21 @@
timeStamps.clear ();
}
-bool
+void
BatteryLifetimeTest::DoRun (void)
{
NS_LOG_UNCOND ("Constant load run.");
+
// 640mA
- if (ConstantLoadTest (0.640, Seconds (2844.0)))
- {
- return true;
- }
+ NS_TEST_ASSERT_MSG_EQ (ConstantLoadTest (0.640, Seconds (2844.0)), false, "Problems with constant load test (640mA).");
// 320mA
- if (ConstantLoadTest (0.320, Seconds (6146.0)))
- {
- return true;
- }
+ NS_TEST_ASSERT_MSG_EQ (ConstantLoadTest (0.320, Seconds (6146.0)), false, "Problems with constant load test (320mA).");
// 128mA
- if (ConstantLoadTest (0.128, Seconds (16052.0)))
- {
- return true;
- }
+ NS_TEST_ASSERT_MSG_EQ (ConstantLoadTest (0.128, Seconds (16052.0)), false, "Problems with constant load test (128mA).");
// 64mA
- if (ConstantLoadTest (0.064, Seconds (32561.0)))
- {
- return true;
- }
+ NS_TEST_ASSERT_MSG_EQ (ConstantLoadTest (0.064, Seconds (32561.0)), false, "Problems with constant load test (64mA).");
// 32mA
- if (ConstantLoadTest (0.032, Seconds (65580.0)))
- {
- return true;
- }
+ NS_TEST_ASSERT_MSG_EQ (ConstantLoadTest (0.032, Seconds (65580.0)), false, "Problems with constant load test (32).");
// create load profiles for variable load test
CreateLoadProfiles ();
@@ -682,7 +668,7 @@
m_loadProfiles[i].timeStamps,
m_loadProfiles[i].itsyLifetime))
{
- return false;
+ return;
}
}
@@ -698,11 +684,9 @@
m_loadProfiles[i].timeStamps,
m_loadProfiles[i].dualFoilLifeTime))
{
- return false;
+ return;
}
}
-
- return false; // error free
}
bool
@@ -776,11 +760,11 @@
NS_LOG_UNCOND ("Expected lifetime = " << expLifetime.GetSeconds () << "s");
NS_LOG_UNCOND ("Actual lifetime = " << actualLifetime.GetSeconds () << "s");
- NS_TEST_ASSERT_MSG_EQ (actualLifetime, expLifetime, "Incorrect lifetime!");
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (actualLifetime, expLifetime, "Incorrect lifetime!");
/*
- NS_TEST_ASSERT_MSG_EQ_TOL (actualLifetime.GetSeconds () / 60,
- expLifetime.GetSeconds () / 60, 0.1,
- "Incorrect lifetime!");
+ NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL (actualLifetime.GetSeconds () / 60,
+ expLifetime.GetSeconds () / 60, 0.1,
+ "Incorrect lifetime!");
*/
Simulator::Destroy ();
@@ -873,8 +857,8 @@
NS_LOG_UNCOND ("Actual lifetime = " << actualLifetime.GetSeconds () << "s");
NS_LOG_UNCOND ("Difference = " << expLifetime.GetSeconds () - actualLifetime.GetSeconds () << "s");
- //NS_TEST_ASSERT_MSG_EQ (actualLifetime, expLifetime, "Incorrect lifetime!");
- NS_TEST_ASSERT_MSG_EQ_TOL (actualLifetime.GetSeconds (), expLifetime.GetSeconds (),
+ //NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (actualLifetime, expLifetime, "Incorrect lifetime!");
+ NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL (actualLifetime.GetSeconds (), expLifetime.GetSeconds (),
120, // error tolerance = 120s
"Incorrect lifetime!");
--- a/src/contrib/event-garbage-collector.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/contrib/event-garbage-collector.cc Mon Jan 17 12:53:20 2011 -0800
@@ -102,7 +102,7 @@
EventGarbageCollectorTestCase ();
virtual ~EventGarbageCollectorTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
EventGarbageCollectorTestCase::EventGarbageCollectorTestCase ()
@@ -124,7 +124,7 @@
}
}
-bool EventGarbageCollectorTestCase::DoRun (void)
+void EventGarbageCollectorTestCase::DoRun (void)
{
m_events = new EventGarbageCollector ();
@@ -139,7 +139,6 @@
NS_TEST_EXPECT_MSG_EQ (m_events, 0, "");
NS_TEST_EXPECT_MSG_EQ (m_counter, 50, "");
Simulator::Destroy ();
- return false;
}
static class EventGarbageCollectorTestSuite : public TestSuite
--- a/src/contrib/flow-monitor/model/histogram.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/contrib/flow-monitor/model/histogram.cc Mon Jan 17 12:53:20 2011 -0800
@@ -156,7 +156,7 @@
private:
public:
HistogramTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -166,7 +166,7 @@
{}
-bool
+void
HistogramTestCase::DoRun (void)
{
Histogram h0(3.5);
@@ -195,8 +195,6 @@
NS_TEST_EXPECT_MSG_EQ (h0.GetNBins (), 22, "");
NS_TEST_EXPECT_MSG_EQ (h0.GetBinCount (21), 1, "");
}
-
- return false;
}
static class HistogramTestSuite : public TestSuite
--- a/src/contrib/topology-read/rocketfuel-topology-reader.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/contrib/topology-read/rocketfuel-topology-reader.cc Mon Jan 17 12:53:20 2011 -0800
@@ -429,7 +429,7 @@
public:
RocketfuelTopologyReaderTest ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
RocketfuelTopologyReaderTest::RocketfuelTopologyReaderTest ()
@@ -437,7 +437,7 @@
{}
-bool
+void
RocketfuelTopologyReaderTest::DoRun (void)
{
Ptr<RocketfuelTopologyReader> inFile;
@@ -453,24 +453,16 @@
nodes = inFile->Read ();
}
- if (nodes.GetN () == 0)
- {
- NS_LOG_ERROR ("Problems reading node information the topology file. Failing.");
- return true;
- }
- if (inFile->LinksSize () == 0)
- {
- NS_LOG_ERROR ("Problems reading the topology file. Failing.");
- return true;
- }
+ NS_TEST_ASSERT_MSG_NE (nodes.GetN (), 0, "Problems reading node information the topology file..");
+
+ NS_TEST_ASSERT_MSG_NE (inFile->LinksSize (), 0, "Problems reading the topology file.");
+
NS_LOG_INFO ("Rocketfuel topology created with " << nodes.GetN () << " nodes and " <<
inFile->LinksSize () << " links (from " << input << ")");
NS_TEST_EXPECT_MSG_EQ (nodes.GetN (),315, "noes");
NS_TEST_EXPECT_MSG_EQ (inFile->LinksSize (),972, "links");
Simulator::Destroy ();
-
- return false;
}
static class RocketfuelTopologyReaderTestSuite : public TestSuite
--- a/src/core/attribute-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/core/attribute-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -233,7 +233,7 @@
virtual ~AttributeTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
bool CheckGetCodePaths (Ptr<Object> p, std::string attributeName, std::string expectedString, T expectedValue);
};
@@ -263,15 +263,15 @@
// Get an Attribute value through its StringValue representation.
//
bool ok = p->GetAttributeFailSafe (attributeName.c_str (), stringValue);
- NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not GetAttributeFailSafe() " << attributeName << " from Object");
- NS_TEST_ASSERT_MSG_EQ (stringValue.Get (), expectedString, "Got unexpected StringValue representation");
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (ok, true, "Could not GetAttributeFailSafe() " << attributeName << " from Object");
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (stringValue.Get (), expectedString, "Got unexpected StringValue representation");
//
// Get the existing boolean value through its particular type representation.
//
ok = p->GetAttributeFailSafe (attributeName.c_str (), actualValue);
- NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not GetAttributeFailSafe() " << attributeName << " from Object");
- NS_TEST_ASSERT_MSG_EQ (actualValue.Get (), expectedValue.Get (), "Got unexpected Value from Object");
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (ok, true, "Could not GetAttributeFailSafe() " << attributeName << " from Object");
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (actualValue.Get (), expectedValue.Get (), "Got unexpected Value from Object");
return GetErrorStatus ();
}
@@ -279,7 +279,7 @@
// ===========================================================================
// The actual Attribute type test cases are specialized for each Attribute type
// ===========================================================================
-template <> bool
+template <> void
AttributeTestCase<BooleanValue>::DoRun (void)
{
AttributeList attrs;
@@ -381,11 +381,9 @@
ok = CheckGetCodePaths (p, "TestBoolA", "false", BooleanValue (false));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Attribute not set properly by SetAttributeFailSafe() (getter/setter) via StringValue");
-
- return GetErrorStatus ();
}
-template <> bool
+template <> void
AttributeTestCase<IntegerValue>::DoRun (void)
{
Ptr<AttributeObjectTest> p;
@@ -493,11 +491,9 @@
ok = CheckGetCodePaths (p, "TestInt16WithBounds", "-5", IntegerValue (-5));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Error in SetAttributeFailSafe() but value changes");
-
- return GetErrorStatus ();
}
-template <> bool
+template <> void
AttributeTestCase<UintegerValue>::DoRun (void)
{
Ptr<AttributeObjectTest> p;
@@ -566,11 +562,9 @@
//
ok = p->SetAttributeFailSafe("TestUint8", StringValue ("-1"));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via StringValue to -1");
-
- return GetErrorStatus ();
}
-template <> bool
+template <> void
AttributeTestCase<DoubleValue>::DoRun (void)
{
Ptr<AttributeObjectTest> p;
@@ -594,11 +588,9 @@
ok = CheckGetCodePaths (p, "TestFloat", "2.3", DoubleValue ((float)2.3));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Attribute not set properly by SetAttributeFailSafe() via DoubleValue");
-
- return GetErrorStatus ();
}
-template <> bool
+template <> void
AttributeTestCase<EnumValue>::DoRun (void)
{
Ptr<AttributeObjectTest> p;
@@ -651,11 +643,9 @@
ok = CheckGetCodePaths (p, "TestEnum", "TestB", EnumValue (AttributeObjectTest::TEST_B));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Error in SetAttributeFailSafe() but value changes");
-
- return GetErrorStatus ();
}
-template <> bool
+template <> void
AttributeTestCase<RandomVariableValue>::DoRun (void)
{
Ptr<AttributeObjectTest> p;
@@ -675,8 +665,6 @@
//
ok = p->SetAttributeFailSafe("TestRandom", RandomVariableValue (ConstantVariable (10.)));
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a UniformVariable");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -690,7 +678,7 @@
virtual ~ObjectVectorAttributeTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
ObjectVectorAttributeTestCase::ObjectVectorAttributeTestCase (std::string description)
@@ -698,7 +686,7 @@
{
}
-bool
+void
ObjectVectorAttributeTestCase::DoRun (void)
{
Ptr<AttributeObjectTest> p;
@@ -743,8 +731,6 @@
//
p->GetAttribute ("TestVector1", vector);
NS_TEST_ASSERT_MSG_EQ (vector.GetN (), 2, "ObjectVectorValue \"TestVector1\" should be incremented");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -758,7 +744,7 @@
virtual ~IntegerTraceSourceAttributeTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
IntegerTraceSourceAttributeTestCase::IntegerTraceSourceAttributeTestCase (std::string description)
@@ -766,7 +752,7 @@
{
}
-bool
+void
IntegerTraceSourceAttributeTestCase::DoRun (void)
{
Ptr<AttributeObjectTest> p;
@@ -837,8 +823,6 @@
ok = p->SetAttributeFailSafe("IntegerTraceSource2", IntegerValue (-129));
NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via IntegerValue to -129");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -852,7 +836,7 @@
virtual ~IntegerTraceSourceTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void NotifySource1 (int8_t old, int8_t n) {m_got1 = n;}
int64_t m_got1;
@@ -863,7 +847,7 @@
{
}
-bool
+void
IntegerTraceSourceTestCase::DoRun (void)
{
Ptr<AttributeObjectTest> p;
@@ -911,8 +895,6 @@
NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to 1");
NS_TEST_ASSERT_MSG_EQ (m_got1, 0, "Hitting a TracedValue after disconnect still causes callback");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -926,7 +908,7 @@
virtual ~TracedCallbackTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void NotifySource2 (double a, int b, float c) {m_got2 = a;}
@@ -938,7 +920,7 @@
{
}
-bool
+void
TracedCallbackTestCase::DoRun (void)
{
Ptr<AttributeObjectTest> p;
@@ -987,8 +969,6 @@
p->InvokeCb (-1.0, -5, 0.0);
NS_TEST_ASSERT_MSG_EQ (m_got2, 1.0, "Invoking disconnected TracedCallback unexpectedly results in trace callback");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -1002,7 +982,7 @@
virtual ~PointerAttributeTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void NotifySource2 (double a, int b, float c) {m_got2 = a;}
@@ -1014,7 +994,7 @@
{
}
-bool
+void
PointerAttributeTestCase::DoRun (void)
{
Ptr<AttributeObjectTest> p;
@@ -1077,8 +1057,6 @@
p->GetAttribute ("Pointer", ptr);
derived = ptr.Get<Derived> ();
NS_TEST_ASSERT_MSG_NE (p, 0, "Retrieved zero PointerValue Attribute after initializing to non-zero Ptr");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -1098,7 +1076,7 @@
}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
Callback<void,int8_t> m_cbValue;
@@ -1112,7 +1090,7 @@
{
}
-bool
+void
CallbackValueTestCase::DoRun (void)
{
Ptr<AttributeObjectTest> p;
@@ -1160,9 +1138,7 @@
//
p->InvokeCbValue (3);
NS_TEST_ASSERT_MSG_EQ (m_gotCbValue, 2, "Callback Attribute set to null callback unexpectedly fired");
-
- return GetErrorStatus ();
-}
+ }
// ===========================================================================
// The Test Suite that glues all of the Test Cases together.
--- a/src/core/callback-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/core/callback-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -37,7 +37,7 @@
int Target4 (double a, int b) {m_test4 = true; return 4;}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoSetup (void);
bool m_test1;
@@ -86,7 +86,7 @@
gBasicCallbackTest7 = false;
}
-bool
+void
BasicCallbackTestCase::DoRun (void)
{
//
@@ -150,8 +150,6 @@
Callback<int, int> target7 = Callback<int, int> (&BasicCallbackTarget7, true, true);
target7 (1);
NS_TEST_ASSERT_MSG_EQ (gBasicCallbackTest7, true, "Callback did not fire");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -169,7 +167,7 @@
int Target4 (double a, int b) {m_test4 = true; return 4;}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoSetup (void);
bool m_test1;
@@ -218,7 +216,7 @@
gMakeCallbackTest7 = false;
}
-bool
+void
MakeCallbackTestCase::DoRun (void)
{
//
@@ -282,8 +280,6 @@
Callback<int, int> target7 = MakeCallback (&MakeCallbackTarget7);
target7 (1);
NS_TEST_ASSERT_MSG_EQ (gMakeCallbackTest7, true, "Callback did not fire");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -296,7 +292,7 @@
virtual ~MakeBoundCallbackTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoSetup (void);
};
@@ -339,7 +335,7 @@
gMakeBoundCallbackTest3b = 0;
}
-bool
+void
MakeBoundCallbackTestCase::DoRun (void)
{
//
@@ -380,8 +376,6 @@
NS_TEST_ASSERT_MSG_EQ (result, 1234, "Return value of callback not correct");
NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest3a, &a, "Callback did not fire or binding not correct");
NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest3b, 2468, "Callback did not fire or argument not correct");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -396,7 +390,7 @@
void Target1 (void) {m_test1 = true;}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoSetup (void);
bool m_test1;
@@ -413,7 +407,7 @@
m_test1 = false;
}
-bool
+void
NullifyCallbackTestCase::DoRun (void)
{
//
@@ -429,8 +423,6 @@
target1.Nullify ();
NS_TEST_ASSERT_MSG_EQ (target1.IsNull (), true, "Nullified Callback reports not IsNull()");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -446,7 +438,7 @@
void Target1 (void) {m_test1 = true;}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
bool m_test1;
};
@@ -513,7 +505,7 @@
{
}
-bool
+void
MakeCallbackTemplatesTestCase::DoRun (void)
{
CallbackTestClass that;
@@ -562,8 +554,6 @@
MakeBoundCallback (&TestFRFive, 1);
that.CheckParentalRights ();
-
- return GetErrorStatus ();
}
// ===========================================================================
--- a/src/core/command-line.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/core/command-line.cc Mon Jan 17 12:53:20 2011 -0800
@@ -352,7 +352,7 @@
virtual ~CommandLineBooleanTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -361,7 +361,7 @@
{
}
-bool
+void
CommandLineBooleanTestCase::DoRun (void)
{
CommandLine cmd;
@@ -374,8 +374,6 @@
Parse (cmd, 1, "--my-bool=1");
NS_TEST_ASSERT_MSG_EQ (myBool, true, "Command parser did not correctly set a boolean value to true");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -388,7 +386,7 @@
virtual ~CommandLineIntTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -397,7 +395,7 @@
{
}
-bool
+void
CommandLineIntTestCase::DoRun (void)
{
CommandLine cmd;
@@ -414,8 +412,6 @@
Parse (cmd, 2, "--my-bool=1", "--my-int32=+2");
NS_TEST_ASSERT_MSG_EQ (myBool, true, "Command parser did not correctly set a boolean value to true");
NS_TEST_ASSERT_MSG_EQ (myInt32, +2, "Command parser did not correctly set an integer value to +2");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -428,7 +424,7 @@
virtual ~CommandLineUnsignedIntTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -437,7 +433,7 @@
{
}
-bool
+void
CommandLineUnsignedIntTestCase::DoRun (void)
{
CommandLine cmd;
@@ -451,8 +447,6 @@
NS_TEST_ASSERT_MSG_EQ (myBool, false, "Command parser did not correctly set a boolean value to true");
NS_TEST_ASSERT_MSG_EQ (myUint32, 9, "Command parser did not correctly set an unsigned integer value to 9");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -465,7 +459,7 @@
virtual ~CommandLineStringTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -474,7 +468,7 @@
{
}
-bool
+void
CommandLineStringTestCase::DoRun (void)
{
CommandLine cmd;
@@ -488,8 +482,6 @@
NS_TEST_ASSERT_MSG_EQ (myUint32, 9, "Command parser did not correctly set an unsigned integer value to 9");
NS_TEST_ASSERT_MSG_EQ (myStr, "XX", "Command parser did not correctly set an string value to \"XX\"");
-
- return GetErrorStatus ();
}
// ===========================================================================
--- a/src/core/config.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/core/config.cc Mon Jan 17 12:53:20 2011 -0800
@@ -766,7 +766,7 @@
virtual ~RootNamespaceConfigTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
RootNamespaceConfigTestCase::RootNamespaceConfigTestCase ()
@@ -774,7 +774,7 @@
{
}
-bool
+void
RootNamespaceConfigTestCase::DoRun (void)
{
IntegerValue iv;
@@ -812,8 +812,6 @@
Config::Set ("/B", IntegerValue (-1));
root->GetAttribute ("B", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -1, "Object Attribute \"B\" not set correctly");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -826,7 +824,7 @@
virtual ~UnderRootNamespaceConfigTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
UnderRootNamespaceConfigTestCase::UnderRootNamespaceConfigTestCase ()
@@ -834,7 +832,7 @@
{
}
-bool
+void
UnderRootNamespaceConfigTestCase::DoRun (void)
{
IntegerValue iv;
@@ -912,8 +910,6 @@
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 4, "Object Attribute \"A\" not set as expected");
b->GetAttribute ("B", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -4, "Object Attribute \"B\" not set as expected");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -926,7 +922,7 @@
virtual ~ObjectVectorConfigTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
ObjectVectorConfigTestCase::ObjectVectorConfigTestCase ()
@@ -934,7 +930,7 @@
{
}
-bool
+void
ObjectVectorConfigTestCase::DoRun (void)
{
IntegerValue iv;
@@ -1068,8 +1064,6 @@
obj3->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -16, "Object Attribute \"A\" not set as expected");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -1085,7 +1079,7 @@
void TraceWithPath (std::string path, int16_t old, int16_t newValue) {m_newValue = newValue; m_path = path;}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
int16_t m_newValue;
std::string m_path;
@@ -1096,7 +1090,7 @@
{
}
-bool
+void
ObjectVectorTraceConfigTestCase::DoRun (void)
{
IntegerValue iv;
@@ -1217,8 +1211,6 @@
obj3->SetAttribute ("Source", IntegerValue (-4));
NS_TEST_ASSERT_MSG_EQ (m_newValue, -4, "Trace 3 did not fire as expected");
NS_TEST_ASSERT_MSG_EQ (m_path, "/NodeA/NodeB/NodesB/1/Source", "Trace 1 did not provide expected context");
-
- return GetErrorStatus ();
}
// ===========================================================================
--- a/src/core/global-value.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/core/global-value.cc Mon Jan 17 12:53:20 2011 -0800
@@ -218,7 +218,7 @@
virtual ~GlobalValueTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
GlobalValueTestCase::GlobalValueTestCase ()
@@ -226,7 +226,7 @@
{
}
-bool
+void
GlobalValueTestCase::DoRun (void)
{
//
@@ -256,8 +256,6 @@
break;
}
}
-
- return GetErrorStatus ();
}
// ===========================================================================
--- a/src/core/names-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/core/names-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -70,7 +70,7 @@
virtual ~BasicAddTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -89,7 +89,7 @@
Names::Clear ();
}
-bool
+void
BasicAddTestCase::DoRun (void)
{
std::string found;
@@ -117,8 +117,6 @@
found = Names::FindName (childOfObjectTwo);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
-
- return false;
}
// ===========================================================================
@@ -137,7 +135,7 @@
virtual ~StringContextAddTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -157,7 +155,7 @@
Names::Clear ();
}
-bool
+void
StringContextAddTestCase::DoRun (void)
{
std::string found;
@@ -185,8 +183,6 @@
found = Names::FindName (childOfObjectTwo);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
-
- return false;
}
// ===========================================================================
@@ -202,7 +198,7 @@
virtual ~FullyQualifiedAddTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -222,7 +218,7 @@
Names::Clear ();
}
-bool
+void
FullyQualifiedAddTestCase::DoRun (void)
{
std::string found;
@@ -250,8 +246,6 @@
found = Names::FindName (childOfObjectTwo);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
-
- return false;
}
// ===========================================================================
@@ -270,7 +264,7 @@
virtual ~RelativeAddTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -290,7 +284,7 @@
Names::Clear ();
}
-bool
+void
RelativeAddTestCase::DoRun (void)
{
std::string found;
@@ -318,8 +312,6 @@
found = Names::FindName (childOfObjectTwo);
NS_TEST_ASSERT_MSG_EQ (found, "Child", "Could not Names::Add and Names::FindName a child Object");
-
- return false;
}
// ===========================================================================
@@ -338,7 +330,7 @@
virtual ~BasicRenameTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -357,7 +349,7 @@
Names::Clear ();
}
-bool
+void
BasicRenameTestCase::DoRun (void)
{
std::string found;
@@ -383,8 +375,6 @@
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "New Child", "Could not Names::Rename a child Object");
-
- return false;
}
// ===========================================================================
@@ -400,7 +390,7 @@
virtual ~StringContextRenameTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -419,7 +409,7 @@
Names::Clear ();
}
-bool
+void
StringContextRenameTestCase::DoRun (void)
{
std::string found;
@@ -445,8 +435,6 @@
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "New Child", "Could not Names::Rename a child Object");
-
- return false;
}
// ===========================================================================
@@ -462,7 +450,7 @@
virtual ~FullyQualifiedRenameTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -481,7 +469,7 @@
Names::Clear ();
}
-bool
+void
FullyQualifiedRenameTestCase::DoRun (void)
{
std::string found;
@@ -507,8 +495,6 @@
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "New Child", "Could not Names::Rename a child Object");
-
- return false;
}
// ===========================================================================
@@ -524,7 +510,7 @@
virtual ~RelativeRenameTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -543,7 +529,7 @@
Names::Clear ();
}
-bool
+void
RelativeRenameTestCase::DoRun (void)
{
std::string found;
@@ -569,8 +555,6 @@
found = Names::FindName (childOfObjectOne);
NS_TEST_ASSERT_MSG_EQ (found, "New Child", "Could not Names::Rename a child Object");
-
- return false;
}
// ===========================================================================
@@ -586,7 +570,7 @@
virtual ~FindPathTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -605,7 +589,7 @@
Names::Clear ();
}
-bool
+void
FindPathTestCase::DoRun (void)
{
std::string found;
@@ -625,8 +609,6 @@
Ptr<TestObject> objectNotThere = CreateObject<TestObject> ();
found = Names::FindPath (objectNotThere);
NS_TEST_ASSERT_MSG_EQ (found, "", "Unexpectedly found a non-existent Object");
-
- return false;
}
// ===========================================================================
@@ -642,7 +624,7 @@
virtual ~BasicFindTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -661,7 +643,7 @@
Names::Clear ();
}
-bool
+void
BasicFindTestCase::DoRun (void)
{
Ptr<TestObject> found;
@@ -689,8 +671,6 @@
found = Names::Find<TestObject> (objectTwo, "Child");
NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo, "Could not find a previously named child Object via object context");
-
- return false;
}
// ===========================================================================
@@ -706,7 +686,7 @@
virtual ~StringContextFindTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -725,7 +705,7 @@
Names::Clear ();
}
-bool
+void
StringContextFindTestCase::DoRun (void)
{
Ptr<TestObject> found;
@@ -753,8 +733,6 @@
found = Names::Find<TestObject> ("/Names/Name Two", "Child");
NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo, "Could not find a previously named child Object via string context");
-
- return false;
}
// ===========================================================================
@@ -770,7 +748,7 @@
virtual ~FullyQualifiedFindTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -789,7 +767,7 @@
Names::Clear ();
}
-bool
+void
FullyQualifiedFindTestCase::DoRun (void)
{
Ptr<TestObject> found;
@@ -817,8 +795,6 @@
found = Names::Find<TestObject> ("/Names/Name Two/Child");
NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo, "Could not find a previously named child Object via string context");
-
- return false;
}
// ===========================================================================
@@ -834,7 +810,7 @@
virtual ~RelativeFindTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -853,7 +829,7 @@
Names::Clear ();
}
-bool
+void
RelativeFindTestCase::DoRun (void)
{
Ptr<TestObject> found;
@@ -881,8 +857,6 @@
found = Names::Find<TestObject> ("Name Two/Child");
NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo, "Could not find a previously named child Object via string context");
-
- return false;
}
// ===========================================================================
@@ -896,7 +870,7 @@
virtual ~AlternateFindTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -915,7 +889,7 @@
Names::Clear ();
}
-bool
+void
AlternateFindTestCase::DoRun (void)
{
Ptr<TestObject> testObject = CreateObject<TestObject> ();
@@ -943,8 +917,6 @@
foundTestObject = Names::Find<TestObject> ("Alternate Test Object");
NS_TEST_ASSERT_MSG_EQ (foundTestObject, 0,
"Unexpectedly able to GetObject<TestObject> on an AlternateTestObject");
-
- return false;
}
class NamesTestSuite : public TestSuite
--- a/src/core/object.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/core/object.cc Mon Jan 17 12:53:20 2011 -0800
@@ -475,7 +475,7 @@
virtual ~CreateObjectTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
CreateObjectTestCase::CreateObjectTestCase ()
@@ -487,7 +487,7 @@
{
}
-bool
+void
CreateObjectTestCase::DoRun (void)
{
Ptr<BaseA> baseA = CreateObject<BaseA> ();
@@ -529,8 +529,6 @@
// object.
//
NS_TEST_ASSERT_MSG_EQ (baseA->GetObject<BaseA> (DerivedA::GetTypeId ()), baseA, "GetObject returns different Ptr");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -543,7 +541,7 @@
virtual ~AggregateObjectTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
AggregateObjectTestCase::AggregateObjectTestCase ()
@@ -555,7 +553,7 @@
{
}
-bool
+void
AggregateObjectTestCase::DoRun (void)
{
Ptr<BaseA> baseA = CreateObject<BaseA> ();
@@ -702,8 +700,6 @@
baseA = baseB->GetObject<BaseA> ();
NS_TEST_ASSERT_MSG_NE (baseA, 0, "Unable to GetObject on released object");
-
- return GetErrorStatus ();
}
// ===========================================================================
@@ -716,7 +712,7 @@
virtual ~ObjectFactoryTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
ObjectFactoryTestCase::ObjectFactoryTestCase ()
@@ -728,7 +724,7 @@
{
}
-bool
+void
ObjectFactoryTestCase::DoRun (void)
{
ObjectFactory factory;
@@ -776,8 +772,6 @@
// declaration.
//
NS_TEST_ASSERT_MSG_NE (a->GetObject<DerivedA> (), 0, "Unexpectedly able to work around C++ type system");
-
- return GetErrorStatus ();
}
// ===========================================================================
--- a/src/core/ptr-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/core/ptr-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -53,7 +53,7 @@
PtrTestCase ();
void DestroyNotify (void);
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
Ptr<NoCount> CallTest (Ptr<NoCount> p);
Ptr<NoCount> const CallTestConst (Ptr<NoCount> const p);
uint32_t m_nDestroyed;
@@ -114,7 +114,7 @@
}
-bool
+void
PtrTestCase::DoRun (void)
{
m_nDestroyed = false;
@@ -257,8 +257,6 @@
NS_TEST_EXPECT_MSG_EQ ((p0 == p1), false, "operator == failed");
NS_TEST_EXPECT_MSG_EQ ((p0 != p1), true, "operator != failed");
}
-
- return false;
}
static class PtrTestSuite : public TestSuite
--- a/src/core/random-variable.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/core/random-variable.cc Mon Jan 17 12:53:20 2011 -0800
@@ -2055,7 +2055,7 @@
}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
BasicRandomNumberTestCase::BasicRandomNumberTestCase ()
@@ -2063,7 +2063,7 @@
{
}
-bool
+void
BasicRandomNumberTestCase::DoRun (void)
{
const double desiredMean = 1.0;
@@ -2106,8 +2106,6 @@
}
double obtainedStdDev = sqrt (sum / (NSAMPLES - 1));
NS_TEST_EXPECT_MSG_EQ_TOL (obtainedStdDev, desiredStdDev, 0.1, "Got unexpected standard deviation from LogNormalVariable");
-
- return GetErrorStatus ();
}
class RandomNumberSerializationTestCase : public TestCase
@@ -2119,7 +2117,7 @@
}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
RandomNumberSerializationTestCase::RandomNumberSerializationTestCase ()
@@ -2127,7 +2125,7 @@
{
}
-bool
+void
RandomNumberSerializationTestCase::DoRun (void)
{
RandomVariableValue val;
@@ -2145,8 +2143,6 @@
rng = val.Get ();
NS_TEST_ASSERT_MSG_EQ (val.SerializeToString (MakeRandomVariableChecker ()), "Normal:0.1:0.2:0.15",
"Deserialize and Serialize \"Normal:0.1:0.2:0.15\" mismatch");
-
- return GetErrorStatus ();
}
class BasicRandomNumberTestSuite : public TestSuite
--- a/src/core/rng-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/core/rng-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -55,7 +55,7 @@
double ChiSquaredTest (UniformVariable &u);
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
RngUniformTestCase::RngUniformTestCase ()
@@ -102,7 +102,7 @@
return chiSquared;
}
-bool
+void
RngUniformTestCase::DoRun (void)
{
SeedManager::SetSeed (time (0));
@@ -120,7 +120,6 @@
sum /= (double)N_RUNS;
NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range");
- return false;
}
// ===========================================================================
@@ -139,7 +138,7 @@
double ChiSquaredTest (NormalVariable &n);
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
RngNormalTestCase::RngNormalTestCase ()
@@ -200,7 +199,7 @@
return chiSquared;
}
-bool
+void
RngNormalTestCase::DoRun (void)
{
SeedManager::SetSeed (time (0));
@@ -218,7 +217,6 @@
sum /= (double)N_RUNS;
NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range");
- return false;
}
// ===========================================================================
@@ -237,7 +235,7 @@
double ChiSquaredTest (ExponentialVariable &n);
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
RngExponentialTestCase::RngExponentialTestCase ()
@@ -297,7 +295,7 @@
return chiSquared;
}
-bool
+void
RngExponentialTestCase::DoRun (void)
{
SeedManager::SetSeed (time (0));
@@ -315,7 +313,6 @@
sum /= (double)N_RUNS;
NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range");
- return false;
}
// ===========================================================================
@@ -334,7 +331,7 @@
double ChiSquaredTest (ParetoVariable &p);
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
RngParetoTestCase::RngParetoTestCase ()
@@ -395,7 +392,7 @@
return chiSquared;
}
-bool
+void
RngParetoTestCase::DoRun (void)
{
SeedManager::SetSeed (time (0));
@@ -413,7 +410,6 @@
sum /= (double)N_RUNS;
NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range");
- return false;
}
class RngTestSuite : public TestSuite
--- a/src/core/test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/core/test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -21,6 +21,8 @@
#include "abort.h"
#include <math.h>
+// Set to true to enable a segmentation fault upon a test case macro test
+// failing (for debugging purposes)
bool gBreakOnFailure = false;
namespace ns3 {
@@ -138,7 +140,7 @@
DoReportStart ();
}
-bool
+void
TestCase::Run (void)
{
//
@@ -150,8 +152,7 @@
DoReportStart ();
DoSetup ();
- bool result = DoRun ();
- UpdateErrorStatus (result);
+ DoRun ();
DoTeardown ();
@@ -175,7 +176,7 @@
DoReportEnd ();
- return GetErrorStatus ();
+ return;
}
void
@@ -456,10 +457,7 @@
DoReportStart ();
DoSetup ();
-
- bool result = DoRun ();
- UpdateErrorStatus (result);
-
+ DoRun ();
DoTeardown ();
if (GetErrorStatus () == false)
@@ -663,7 +661,7 @@
{
}
-bool
+void
TestSuite::DoRun (void)
{
SetErrorStatus (false);
@@ -682,19 +680,18 @@
//
// Run the test case
//
- bool result = (*i)->Run ();
- UpdateErrorStatus (result);
+ (*i)->Run ();
+ UpdateErrorStatus ((*i)->GetErrorStatus ());
//
- // Exit if we have detected an error and we are not allowing multiple filures
+ // Exit if we have detected an error and we are not allowing multiple failures
//
if (GetErrorStatus () && m_continueOnFailure == false)
{
- return GetErrorStatus ();
+ return;
}
}
- return GetErrorStatus ();
}
void
--- a/src/core/test.h Mon Jan 10 15:55:29 2011 -0800
+++ b/src/core/test.h Mon Jan 17 12:53:20 2011 -0800
@@ -51,12 +51,6 @@
#define NS_TEST_SOURCEDIR \
TestCase::GetSourceDir (__FILE__)
-#define NS_TEST_RETURN_IF_ERROR \
- if (GetErrorStatus ()) \
- { \
- return true; \
- }
-
// ===========================================================================
// Test for equality (generic version)
// ===========================================================================
@@ -79,7 +73,7 @@
actualStream.str (), limitStream.str (), msgStream.str (), file, line); \
if (!ContinueOnFailure ()) \
{ \
- return true; \
+ return; \
} \
} \
} while (false)
@@ -115,6 +109,61 @@
/**
* \internal
+ */
+#define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line) \
+ do { \
+ if (!((actual) == (limit))) \
+ { \
+ if (gBreakOnFailure) {*(int *)0 = 0;} \
+ std::ostringstream msgStream; \
+ msgStream << msg; \
+ std::ostringstream actualStream; \
+ actualStream << actual; \
+ std::ostringstream limitStream; \
+ limitStream << limit; \
+ ReportTestFailure (std::string (#actual) + " (actual) == " + std::string (#limit) + " (limit)", \
+ actualStream.str (), limitStream.str (), msgStream.str (), file, line); \
+ if (!ContinueOnFailure ()) \
+ { \
+ return true; \
+ } \
+ } \
+ } while (false)
+
+/**
+ * \brief Test that an actual and expected (limit) value are equal and report
+ * and abort if not.
+ *
+ * Check to see if the expected (limit) value is equal to the actual value found
+ * in a test case. If the two values are equal nothing happens, but if the
+ * comparison fails, an error is reported in a consistent way and the execution
+ * of the current test case is aborted.
+ *
+ * The message is interpreted as a stream, for example:
+ *
+ * \code
+ * NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (result, true,
+ * "cannot open file " << filename << " in test");
+ * \endcode
+ *
+ * is legal.
+ *
+ * \param actual Expression for the actual value found during the test.
+ * \param limit Expression for the expected value of the test.
+ * \param msg Message that is output if the test does not pass.
+ *
+ * \warning Do not use this macro if you are comparing floating point numbers
+ * (float or double) as it is unlikely to do what you expect. Use
+ * NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_TOL instead.
+ *
+ * This function returns a boolean value.
+ *
+ */
+#define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL(actual, limit, msg) \
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
+
+/**
+ * \internal
*
* Required to avoid use of return statement which allows use in methods
* (esp. callbacks) returning void.
@@ -189,7 +238,7 @@
ReportTestFailure (condStream.str (), actualStream.str (), limitStream.str (), msgStream.str (), file, line); \
if (!ContinueOnFailure ()) \
{ \
- return true; \
+ return; \
} \
} \
} while (false)
@@ -247,6 +296,85 @@
/**
* \internal
+ */
+#define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL(actual, limit, tol, msg, file, line) \
+ do { \
+ if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \
+ { \
+ if (gBreakOnFailure) {*(int *)0 = 0;} \
+ std::ostringstream msgStream; \
+ msgStream << msg; \
+ std::ostringstream actualStream; \
+ actualStream << actual; \
+ std::ostringstream limitStream; \
+ limitStream << limit << " +- " << tol; \
+ std::ostringstream condStream; \
+ condStream << #actual << " (actual) < " << #limit << " (limit) + " << #tol << " (tol) && " << \
+ #actual << " (actual) > " << #limit << " (limit) - " << #tol << " (tol)"; \
+ ReportTestFailure (condStream.str (), actualStream.str (), limitStream.str (), msgStream.str (), file, line); \
+ if (!ContinueOnFailure ()) \
+ { \
+ return true; \
+ } \
+ } \
+ } while (false)
+
+/**
+ * \brief Test that actual and expected (limit) values are equal to plus or minus
+ * some tolerance and report and abort if not.
+ *
+ * Check to see if the expected (limit) value is equal to the actual value found
+ * in a test case to some tolerance. This is not the same thing as asking if
+ * two floating point are equal to within some epsilon, but is useful for that
+ * case. This assertion is geared toward more of a measurement problem. Consider
+ * measuring a physical rod of some kind that you have ordered. You need to
+ * determine if it is "good." You won't measure the rod to an arbitrary precision
+ * of sixteen significant figures, you will measure the rod to determine if its
+ * length is within the tolerances you provided. For example, 12.00 inches plus
+ * or minus .005 inch may be just fine.
+ *
+ * In ns-3, you might want to measure a signal to noise ratio and check to see
+ * if the answer is what you expect. If you naively measure (double)1128.93 and
+ * compare this number with a constant 1128.93 you are almost certainly going to
+ * have your test fail because of floating point rounding errors. We provide a
+ * floating point comparison function ns3::TestDoubleIsEqual() but you will
+ * probably quickly find that is not what you want either. It may turn out to
+ * be the case that when you measured an snr that printed as 1128.93, what was
+ * actually measured was something more like 1128.9287653857625442 for example.
+ * Given that the double epsilon is on the order of 0.0000000000000009, you would
+ * need to provide sixteen significant figures of expected value for this kind of
+ * test to pass even with a typical test for floating point "approximate equality."
+ * That is clearly not required or desired. You really want to be able to provide
+ * 1128.93 along with a tolerance just like you provided 12 inches +- 0.005 inch
+ * above.
+ *
+ * This assertion is designed for real measurements by taking into account
+ * measurement tolerances. By doing so it also automatically compensates for
+ * floating point rounding errors. If you really want to check floating point
+ * equality down to the numeric_limits<double>::epsilon () range, consider using
+ * ns3::TestDoubleIsEqual().
+ *
+ * The message is interpreted as a stream, for example:
+ *
+ * \code
+ * NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL (snr, 1128.93, 0.005, "wrong snr (" << snr << ") in test");
+ * \endcode
+ *
+ * is legal.
+ *
+ * \param actual Expression for the actual value found during the test.
+ * \param limit Expression for the expected value of the test.
+ * \param tol Tolerance of the test.
+ * \param msg Message that is output if the test does not pass.
+ *
+ * This function returns a boolean value.
+ *
+ */
+#define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL(actual, limit, tol, msg) \
+ NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__)
+
+/**
+ * \internal
*
* Required to avoid use of return statement which allows use in methods
* (esp. callbacks) returning void.
@@ -342,7 +470,7 @@
actualStream.str (), limitStream.str (), msgStream.str (), file, line); \
if (!ContinueOnFailure ()) \
{ \
- return true; \
+ return; \
} \
} \
} while (false)
@@ -377,6 +505,60 @@
/**
* \internal
+ */
+#define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line) \
+ do { \
+ if (!((actual) != (limit))) \
+ { \
+ if (gBreakOnFailure) {*(int *)0 = 0;} \
+ std::ostringstream msgStream; \
+ msgStream << msg; \
+ std::ostringstream actualStream; \
+ actualStream << actual; \
+ std::ostringstream limitStream; \
+ limitStream << limit; \
+ ReportTestFailure (std::string (#actual) + " (actual) != " + std::string (#limit) + " (limit)", \
+ actualStream.str (), limitStream.str (), msgStream.str (), file, line); \
+ if (!ContinueOnFailure ()) \
+ { \
+ return true; \
+ } \
+ } \
+ } while (false)
+
+/**
+ * \brief Test that an actual and expected (limit) value are equal and report
+ * and abort if not.
+ *
+ * Check to see if the expected (limit) value is not equal to the actual value
+ * found in a test case. If the two values are equal nothing happens, but if
+ * the comparison fails, an error is reported in a consistent way and the
+ * execution of the current test case is aborted.
+ *
+ * The message is interpreted as a stream, for example:
+ *
+ * \code
+ * NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL (result, false,
+ * "cannot open file " << filename << " in test");
+ * \endcode
+ *
+ * is legal.
+ *
+ * \param actual Expression for the actual value found during the test.
+ * \param limit Expression for the expected value of the test.
+ * \param msg Message that is output if the test does not pass.
+ *
+ * \warning Do not use this macro if you are comparing floating point numbers
+ * (float or double). Use NS_TEST_ASSERT_MSG_FLNE instead.
+ *
+ * This function returns a boolean value.
+ *
+ */
+#define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL(actual, limit, msg) \
+ NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
+
+/**
+ * \internal
*
* Required to avoid use of return statement which allows use in methods
* (callbacks) returning void.
@@ -447,7 +629,7 @@
actualStream.str (), limitStream.str (), msgStream.str (), file, line); \
if (!ContinueOnFailure ()) \
{ \
- return true; \
+ return; \
} \
} \
} while (false)
@@ -531,7 +713,7 @@
actualStream.str (), limitStream.str (), msgStream.str (), file, line); \
if (!ContinueOnFailure ()) \
{ \
- return true; \
+ return; \
} \
} \
} while (false)
@@ -626,9 +808,8 @@
/**
* \brief Run this test case.
- * \returns Boolean sense of "an error has occurred."
*/
- bool Run (void);
+ void Run (void);
/**
* \brief Set the verbosity of this test case.
@@ -829,9 +1010,8 @@
/**
* \internal
* \brief Implementation to actually run this test case.
- * \returns Boolean sense of "an error has occurred."
*/
- virtual bool DoRun (void) = 0;
+ virtual void DoRun (void) = 0;
/**
* \internal
@@ -1073,9 +1253,8 @@
/**
* \internal
* \brief Implementation to actually run this test suite.
- * \returns Boolean sense of "an error has occurred."
*/
- virtual bool DoRun (void);
+ virtual void DoRun (void);
/**
* \internal
--- a/src/core/traced-callback-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/core/traced-callback-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -28,7 +28,7 @@
virtual ~BasicTracedCallbackTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void CbOne (uint8_t a, double b);
void CbTwo (uint8_t a, double b);
@@ -54,7 +54,7 @@
m_two = true;
}
-bool
+void
BasicTracedCallbackTestCase::DoRun (void)
{
//
@@ -106,8 +106,6 @@
trace (1, 2);
NS_TEST_ASSERT_MSG_EQ (m_one, true, "Callback CbOne not called");
NS_TEST_ASSERT_MSG_EQ (m_two, true, "Callback CbTwo not called");
-
- return GetErrorStatus ();
}
class TracedCallbackTestSuite : public TestSuite
--- a/src/core/type-traits-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/core/type-traits-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -28,7 +28,7 @@
virtual ~TypeTraitsTestCase () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
TypeTraitsTestCase::TypeTraitsTestCase (void)
@@ -36,7 +36,7 @@
{
}
-bool
+void
TypeTraitsTestCase::DoRun (void)
{
NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (void)>::IsPointerToMember, 1, "Check");
@@ -45,8 +45,6 @@
NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (int) const>::IsPointerToMember, 1, "Check");
NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (void) const>::PointerToMemberTraits::nArgs, 0, "Check");
NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (int) const>::PointerToMemberTraits::nArgs, 1, "Check");
-
- return GetErrorStatus ();
}
class TypeTraitsTestSuite : public TestSuite
--- a/src/devices/lte/test/lte-bearer-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/lte/test/lte-bearer-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -56,7 +56,7 @@
virtual ~Ns3LteBearerTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -69,11 +69,9 @@
{
}
-bool
+void
Ns3LteBearerTestCase::DoRun (void)
{
- bool testResult = false;
-
// create downlink data radio bearer and its qos parameters
Ptr<RadioBearerInstance> bearer = CreateObject<RadioBearerInstance> ();
bearer->SetBearerDirection (RadioBearerInstance::DIRECTION_TYPE_DL);
@@ -90,24 +88,18 @@
bearer->Enqueue (p);
- if (!bearer->HasPackets ())
- {
- return true; // the queue should have 1 packet
- }
+ // the queue should have 1 packet
+ NS_TEST_ASSERT_MSG_EQ (bearer->HasPackets (), true, "The queue did not have any packets.");
bearer->Dequeue ();
- if (bearer->HasPackets ())
- {
- return true; // the queue should be empty
- }
+ // the queue should be empty
+ NS_TEST_ASSERT_MSG_EQ (bearer->HasPackets (), false, "The queue had packets.");
// Free memory; handle reference cycle that bearer has with RlcEntity
bearer->Dispose ();
bearer = 0;
Simulator::Destroy ();
-
- return (testResult);
}
// ==============================================================================
--- a/src/devices/lte/test/lte-device-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/lte/test/lte-device-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -54,7 +54,7 @@
virtual ~Ns3LteDeviceTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -67,11 +67,9 @@
{
}
-bool
+void
Ns3LteDeviceTestCase::DoRun (void)
{
- bool testResult = false;
-
LteHelper lte;
lte.EnableLogComponents ();
@@ -150,10 +148,7 @@
// ****** test if the ue is registered with the eNB ******
- if (!enb->GetUeManager ()->IsRegistered (ue))
- {
- return true;
- }
+ NS_TEST_ASSERT_MSG_EQ (enb->GetUeManager ()->IsRegistered (ue), true, "The ue was not registered with the eNB.");
// ****** test packet transmission******
@@ -178,9 +173,6 @@
Simulator::Run ();
Simulator::Destroy ();
-
-
- return (testResult);
}
// ==============================================================================
--- a/src/devices/lte/test/lte-phy-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/lte/test/lte-phy-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -49,7 +49,7 @@
virtual ~Ns3LtePhyTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -62,11 +62,9 @@
{
}
-bool
+void
Ns3LtePhyTestCase::DoRun (void)
{
- bool testResult = false;
-
LteHelper lte;
lte.EnableLogComponents ();
@@ -138,21 +136,12 @@
pb->AddPacket (p2);
- if (enb->GetPhy ()->SendPacket (pb))
- {
- testResult = true;
- }
+ NS_TEST_ASSERT_MSG_EQ (enb->GetPhy ()->SendPacket (pb), false, "SendPacket() should return false for eNB device.");
- if (ue->GetPhy ()->SendPacket (pb))
- {
- testResult = true;
- }
+ NS_TEST_ASSERT_MSG_EQ (ue->GetPhy ()->SendPacket (pb), false, "SendPacket() should return false for ue device.");
Simulator::Destroy ();
-
-
- return (testResult);
}
// ==============================================================================
--- a/src/devices/lte/test/lte-propagation-loss-model-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/lte/test/lte-propagation-loss-model-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -55,7 +55,7 @@
virtual ~Ns3LtePropagationLossModelTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -68,11 +68,9 @@
{
}
-bool
+void
Ns3LtePropagationLossModelTestCase::DoRun (void)
{
- bool testResult = false;
-
// CREATE PHY LAYER FOR BOTH UE AND ENB
Ptr<EnbLtePhy> phyEnb = CreateObject<EnbLtePhy> ();
Ptr<EnbLteSpectrumPhy> dlEnb = CreateObject<EnbLteSpectrumPhy> ();
@@ -167,30 +165,17 @@
}
- if (tx.size () != rx.size ())
- {
- return true;
- }
-
+ NS_TEST_ASSERT_MSG_EQ (tx.size (), rx.size (), "Sizes of tx and rx don't agree.");
int nbOfValues = tx.size ();
for (int i = 0; i < nbOfValues; i++)
{
- if (tx.at (i) == 0 && rx.at (i) != 0 )
- {
- return true;
- }
- if (tx.at (i) != 0 && (tx.at (i) <= rx.at (i)))
- {
- return true;
- }
+ NS_TEST_ASSERT_MSG_EQ (tx.at (i) == 0 && rx.at (i) != 0, false, "Problem with elements of tx and rx.");
+ NS_TEST_ASSERT_MSG_EQ (tx.at (i) != 0 && (tx.at (i) <= rx.at (i)), false, "Problem with elements of tx and rx.");
}
Simulator::Destroy ();
-
-
- return (testResult);
}
// ==============================================================================
--- a/src/devices/mesh/dot11s/test/dot11s-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/dot11s/test/dot11s-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -36,10 +36,10 @@
TestCase ("Dot11sMeshHeader roundtrip serialization")
{
}
- bool DoRun ();
+ void DoRun ();
};
-bool
+void
MeshHeaderTest::DoRun ()
{
{
@@ -81,7 +81,6 @@
packet->RemoveHeader (b);
NS_TEST_ASSERT_MSG_EQ (a, b, "Mesh header roundtrip serialization works, 1 address");
}
- return false;
}
//-----------------------------------------------------------------------------
/// Unit test for HwmpRtable
@@ -89,7 +88,7 @@
{
public:
HwmpRtableTest ();
- virtual bool DoRun ();
+ virtual void DoRun ();
private:
/// Test Add apth and lookup path;
@@ -193,7 +192,7 @@
}
}
-bool
+void
HwmpRtableTest::DoRun ()
{
table = CreateObject<HwmpRtable> ();
@@ -206,8 +205,6 @@
Simulator::Run ();
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
//-----------------------------------------------------------------------------
/// Built-in self test for PeerLinkFrameStart
@@ -217,10 +214,10 @@
TestCase ("PeerLinkFrames (open, confirm, close) unit tests")
{
}
- virtual bool DoRun ();
+ virtual void DoRun ();
};
-bool
+void
PeerLinkFrameStartTest::DoRun ()
{
{
@@ -271,7 +268,6 @@
packet->RemoveHeader (b);
NS_TEST_EXPECT_MSG_EQ (a, b, "PEER_LINK_CLOSE works");
}
- return GetErrorStatus ();
}
//-----------------------------------------------------------------------------
class Dot11sTestSuite : public TestSuite
--- a/src/devices/mesh/dot11s/test/hwmp-proactive-regression.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/dot11s/test/hwmp-proactive-regression.cc Mon Jan 17 12:53:20 2011 -0800
@@ -53,7 +53,7 @@
{
delete m_nodes;
}
-bool
+void
HwmpProactiveRegressionTest::DoRun ()
{
SeedManager::SetSeed(12345);
@@ -68,7 +68,6 @@
if (!WRITE_VECTORS) CheckResults ();
delete m_nodes, m_nodes = 0;
- return false;
}
void
HwmpProactiveRegressionTest::CreateNodes ()
--- a/src/devices/mesh/dot11s/test/hwmp-proactive-regression.h Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/dot11s/test/hwmp-proactive-regression.h Mon Jan 17 12:53:20 2011 -0800
@@ -60,7 +60,7 @@
HwmpProactiveRegressionTest ();
virtual ~HwmpProactiveRegressionTest();
- virtual bool DoRun ();
+ virtual void DoRun ();
void CheckResults ();
private:
--- a/src/devices/mesh/dot11s/test/hwmp-reactive-regression.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/dot11s/test/hwmp-reactive-regression.cc Mon Jan 17 12:53:20 2011 -0800
@@ -49,7 +49,7 @@
{
delete m_nodes;
}
-bool
+void
HwmpReactiveRegressionTest::DoRun ()
{
SeedManager::SetSeed(12345);
@@ -63,7 +63,6 @@
if (!WRITE_VECTORS) CheckResults ();
delete m_nodes, m_nodes = 0;
- return false;
}
void
HwmpReactiveRegressionTest::CreateNodes ()
--- a/src/devices/mesh/dot11s/test/hwmp-reactive-regression.h Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/dot11s/test/hwmp-reactive-regression.h Mon Jan 17 12:53:20 2011 -0800
@@ -74,7 +74,7 @@
HwmpReactiveRegressionTest ();
virtual ~HwmpReactiveRegressionTest();
- virtual bool DoRun ();
+ virtual void DoRun ();
void CheckResults ();
private:
/// XXX It is important to have pointers here
--- a/src/devices/mesh/dot11s/test/hwmp-simplest-regression.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/dot11s/test/hwmp-simplest-regression.cc Mon Jan 17 12:53:20 2011 -0800
@@ -52,7 +52,7 @@
{
delete m_nodes;
}
-bool
+void
HwmpSimplestRegressionTest::DoRun ()
{
SeedManager::SetSeed(12345);
@@ -67,7 +67,6 @@
if (!WRITE_VECTORS) CheckResults ();
delete m_nodes, m_nodes = 0;
- return false;
}
void
HwmpSimplestRegressionTest::CreateNodes ()
--- a/src/devices/mesh/dot11s/test/hwmp-simplest-regression.h Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/dot11s/test/hwmp-simplest-regression.h Mon Jan 17 12:53:20 2011 -0800
@@ -71,7 +71,7 @@
HwmpSimplestRegressionTest ();
virtual ~HwmpSimplestRegressionTest();
- virtual bool DoRun ();
+ virtual void DoRun ();
void CheckResults ();
private:
--- a/src/devices/mesh/dot11s/test/hwmp-target-flags-regression.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/dot11s/test/hwmp-target-flags-regression.cc Mon Jan 17 12:53:20 2011 -0800
@@ -52,7 +52,7 @@
{
delete m_nodes;
}
-bool
+void
HwmpDoRfRegressionTest::DoRun ()
{
SeedManager::SetSeed(12345);
@@ -67,7 +67,6 @@
if (!WRITE_VECTORS) CheckResults ();
delete m_nodes, m_nodes = 0;
- return false;
}
void
HwmpDoRfRegressionTest::CreateNodes ()
--- a/src/devices/mesh/dot11s/test/hwmp-target-flags-regression.h Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/dot11s/test/hwmp-target-flags-regression.h Mon Jan 17 12:53:20 2011 -0800
@@ -70,7 +70,7 @@
HwmpDoRfRegressionTest ();
virtual ~HwmpDoRfRegressionTest();
- virtual bool DoRun ();
+ virtual void DoRun ();
void CheckResults ();
private:
--- a/src/devices/mesh/dot11s/test/pmp-regression.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/dot11s/test/pmp-regression.cc Mon Jan 17 12:53:20 2011 -0800
@@ -50,7 +50,7 @@
delete m_nodes;
}
-bool
+void
PeerManagementProtocolRegressionTest::DoRun ()
{
SeedManager::SetSeed(12345);
@@ -64,7 +64,6 @@
if (!WRITE_VECTORS) CheckResults ();
delete m_nodes, m_nodes = 0;
- return GetErrorStatus ();
}
void
--- a/src/devices/mesh/dot11s/test/pmp-regression.h Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/dot11s/test/pmp-regression.h Mon Jan 17 12:53:20 2011 -0800
@@ -56,7 +56,7 @@
void CreateNodes ();
void CreateDevices ();
void CheckResults ();
- bool DoRun ();
+ void DoRun ();
};
#endif // PMP_REGRESSION_H
--- a/src/devices/mesh/flame/flame-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/flame/flame-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -34,10 +34,10 @@
TestCase ("FlameHeader roundtrip serialization")
{
}
- bool DoRun ();
+ void DoRun ();
};
-bool
+void
FlameHeaderTest::DoRun ()
{
FlameHeader a;
@@ -51,7 +51,6 @@
FlameHeader b;
packet->RemoveHeader (b);
NS_TEST_ASSERT_MSG_EQ (b, a, "FlameHeader roundtrip serialization works");
- return false;
}
//-----------------------------------------------------------------------------
@@ -61,7 +60,7 @@
{
public:
FlameRtableTest ();
- bool DoRun ();
+ void DoRun ();
private:
/// Test Add apth and lookup path;
@@ -121,7 +120,7 @@
NS_TEST_EXPECT_MSG_EQ (table->Lookup (dst).IsValid (), false, "Routing table records expirations works");
}
-bool
+void
FlameRtableTest::DoRun ()
{
table = CreateObject<FlameRtable> ();
@@ -132,8 +131,6 @@
Simulator::Run ();
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
--- a/src/devices/mesh/flame/test/flame-regression.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/flame/test/flame-regression.cc Mon Jan 17 12:53:20 2011 -0800
@@ -53,7 +53,7 @@
delete m_nodes;
}
-bool
+void
FlameRegressionTest::DoRun ()
{
SeedManager::SetSeed(12345);
@@ -68,7 +68,6 @@
if (!WRITE_VECTORS) CheckResults ();
delete m_nodes, m_nodes = 0;
- return false;
}
void
--- a/src/devices/mesh/flame/test/flame-regression.h Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/flame/test/flame-regression.h Mon Jan 17 12:53:20 2011 -0800
@@ -59,7 +59,7 @@
FlameRegressionTest ();
virtual ~FlameRegressionTest();
- virtual bool DoRun ();
+ virtual void DoRun ();
void CheckResults ();
private:
--- a/src/devices/mesh/mesh-information-element-vector.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/mesh/mesh-information-element-vector.cc Mon Jan 17 12:53:20 2011 -0800
@@ -102,10 +102,10 @@
TestCase ("Serializarion test for all mesh information elements")
{
};
- bool DoRun ();
+ void DoRun ();
};
-bool
+void
MeshInformationElementVectorBist::DoRun ()
{
MeshInformationElementVector vector;
@@ -199,8 +199,6 @@
MeshInformationElementVector resultVector;
packet->RemoveHeader (resultVector);
NS_TEST_ASSERT_MSG_EQ (vector, resultVector, "Roundtrip serialization of all known information elements works");
-
- return false;
}
class MeshTestSuite : public TestSuite
--- a/src/devices/point-to-point/point-to-point-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/point-to-point/point-to-point-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -11,7 +11,7 @@
public:
PointToPointTest ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
private:
void SendOnePacket (Ptr<PointToPointNetDevice> device);
@@ -29,7 +29,7 @@
}
-bool
+void
PointToPointTest::DoRun (void)
{
Ptr<Node> a = CreateObject<Node> ();
@@ -53,8 +53,6 @@
Simulator::Run ();
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
//-----------------------------------------------------------------------------
class PointToPointTestSuite : public TestSuite
--- a/src/devices/spectrum/spectrum-interference-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/spectrum/spectrum-interference-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -40,7 +40,7 @@
public:
SpectrumInterferenceTestCase (Ptr<SpectrumValue> s, uint32_t txBytes, bool rxCorrect, std::string name);
virtual ~SpectrumInterferenceTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void RetrieveTestResult (SpectrumInterference* si);
private:
@@ -68,7 +68,7 @@
-bool
+void
SpectrumInterferenceTestCase::DoRun (void)
{
Ptr<SpectrumValue> n = Create<SpectrumValue> (m_mySpectrumModel);
@@ -120,8 +120,6 @@
// the above will return and after RetrieveTestResults have
// been called and after all signals have expired
Simulator::Destroy ();
-
- return m_error;
}
--- a/src/devices/uan/test/uan-energy-model-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/uan/test/uan-energy-model-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -49,7 +49,7 @@
bool RxPacket (Ptr<NetDevice> dev, Ptr<const Packet> pkt, uint16_t mode, const Address &sender);
void SendOnePacket (Ptr<Node> node);
- bool DoRun (void);
+ void DoRun (void);
double m_simTime;
uint32_t m_bytesRx;
@@ -100,7 +100,7 @@
return true;
}
-bool
+void
AcousticModemEnergyTestCase::DoRun ()
{
// create a generic node
@@ -187,7 +187,6 @@
"Incorrect node consumed energy!");
Simulator::Destroy ();
- return false;
}
class AcousticModemEnergyDepletionTestCase : public TestCase
@@ -199,7 +198,7 @@
void DepletionHandler (void);
void SendOnePacket (Ptr<Node> node);
- bool DoRun (void);
+ void DoRun (void);
double m_simTime;
uint32_t m_callbackCount;
@@ -242,7 +241,7 @@
node);
}
-bool
+void
AcousticModemEnergyDepletionTestCase::DoRun (void)
{
// create a generic node
@@ -287,8 +286,6 @@
Simulator::Destroy ();
NS_TEST_ASSERT_MSG_EQ (m_callbackCount, 1, "Callback not invoked");
-
- return false;
}
// -------------------------------------------------------------------------- //
--- a/src/devices/uan/test/uan-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/uan/test/uan-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -39,7 +39,7 @@
public:
UanTest ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
private:
Ptr<UanNetDevice> CreateNode (Vector pos, Ptr<UanChannel> chan);
bool DoPhyTests ();
@@ -149,11 +149,11 @@
Ptr<UanPropModelIdeal> prop = CreateObject<UanPropModelIdeal> ();
// No collision (Get 2 packets)
- NS_TEST_ASSERT_MSG_EQ (DoOnePhyTest (Seconds (1.0), Seconds (3.001), 50, 50, prop),
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (DoOnePhyTest (Seconds (1.0), Seconds (3.001), 50, 50, prop),
34, "Should have received 34 bytes from 2 disjoint packets");
// Collision (Lose both packets)
- NS_TEST_ASSERT_MSG_EQ (DoOnePhyTest (Seconds (1.0), Seconds (2.99), 50, 50, prop),
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (DoOnePhyTest (Seconds (1.0), Seconds (2.99), 50, 50, prop),
0, "Expected collision resulting in loss of both packets");
@@ -171,15 +171,15 @@
#endif // UAN_PROP_BH_INSTALLED
// No collision (Get 2 packets)
- NS_TEST_ASSERT_MSG_EQ (DoOnePhyTest (Seconds (1.0), Seconds (3.001), 50, 50, prop),
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (DoOnePhyTest (Seconds (1.0), Seconds (3.001), 50, 50, prop),
34, "Should have received 34 bytes from 2 disjoint packets");
// Should correctly receive first arriving packet
- NS_TEST_ASSERT_MSG_EQ (DoOnePhyTest (Seconds (1.0), Seconds (1.0126), 50, 50, prop),
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (DoOnePhyTest (Seconds (1.0), Seconds (1.0126), 50, 50, prop),
17, "Should have recieved 17 bytes from first arriving packet");
// Packets should collide and both be lost
- NS_TEST_ASSERT_MSG_EQ (DoOnePhyTest (Seconds (1.0), Seconds (1.0 + 7.01 * (13.0 / 80.0)), 50, 50, prop),
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (DoOnePhyTest (Seconds (1.0), Seconds (1.0 + 7.01 * (13.0 / 80.0)), 50, 50, prop),
0, "Packets should collide, but received data");
// Phy Dual
@@ -207,25 +207,25 @@
m_phyFac.Set (phyList);
// No collision (Get 2 packets)
- NS_TEST_ASSERT_MSG_EQ (DoOnePhyTest (Seconds (1.0), Seconds (3.01), 50, 50, prop),
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (DoOnePhyTest (Seconds (1.0), Seconds (3.01), 50, 50, prop),
34, "Expected no collision");
- NS_TEST_ASSERT_MSG_EQ (DoOnePhyTest (Seconds (1.0), Seconds (2.99), 50, 50, prop, 0, 0),
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (DoOnePhyTest (Seconds (1.0), Seconds (2.99), 50, 50, prop, 0, 0),
0, "Expected collision with both packets lost");
- NS_TEST_ASSERT_MSG_EQ (DoOnePhyTest (Seconds (1.0), Seconds (2.99), 50, 50, prop, 0, 2),
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (DoOnePhyTest (Seconds (1.0), Seconds (2.99), 50, 50, prop, 0, 2),
17, "Expected collision with only one packets lost");
- NS_TEST_ASSERT_MSG_EQ (DoOnePhyTest (Seconds (1.0), Seconds (2.99), 50, 50, prop, 0, 5),
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (DoOnePhyTest (Seconds (1.0), Seconds (2.99), 50, 50, prop, 0, 5),
34, "Expected no collision");
- NS_TEST_ASSERT_MSG_EQ (DoOnePhyTest (Seconds (1.0), Seconds (2.99), 50, 50, prop, 2, 3),
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (DoOnePhyTest (Seconds (1.0), Seconds (2.99), 50, 50, prop, 2, 3),
34, "Expected no collision");
return false;
}
-bool
+void
UanTest::DoRun (void)
{
@@ -245,8 +245,8 @@
#endif // UAN_PROP_BH_INSTALLED
- return DoPhyTests ();
-
+ bool phyTestsError;
+ phyTestsError = DoPhyTests ();
}
--- a/src/devices/wifi/block-ack-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/wifi/block-ack-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -64,7 +64,7 @@
PacketBufferingCaseA ();
virtual ~PacketBufferingCaseA ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
std::list<uint16_t> m_expectedBuffer;
};
@@ -81,7 +81,7 @@
PacketBufferingCaseA::~PacketBufferingCaseA ()
{}
-bool
+void
PacketBufferingCaseA::DoRun (void)
{
std::list<uint16_t> m_buffer;
@@ -110,7 +110,6 @@
{
NS_TEST_EXPECT_MSG_EQ (*i, *j, "error in buffer order");
}
- return GetErrorStatus ();
}
/* ----- = old packets
@@ -142,7 +141,7 @@
PacketBufferingCaseB ();
virtual ~PacketBufferingCaseB ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
std::list<uint16_t> m_expectedBuffer;
};
@@ -160,7 +159,7 @@
PacketBufferingCaseB::~PacketBufferingCaseB ()
{}
-bool
+void
PacketBufferingCaseB::DoRun (void)
{
std::list<uint16_t> m_buffer;
@@ -196,7 +195,6 @@
{
NS_TEST_EXPECT_MSG_EQ (*i, *j, "error in buffer order");
}
- return GetErrorStatus ();
}
//Test for block ack header
@@ -205,7 +203,7 @@
public:
CtrlBAckResponseHeaderTest ();
private:
- virtual bool DoRun ();
+ virtual void DoRun ();
CtrlBAckResponseHeader m_blockAckHdr;
};
@@ -213,7 +211,7 @@
: TestCase ("Check the correctness of block ack compressed bitmap")
{}
-bool
+void
CtrlBAckResponseHeaderTest::DoRun (void)
{
m_blockAckHdr.SetType (COMPRESSED_BLOCK_ACK);
@@ -257,8 +255,6 @@
NS_TEST_EXPECT_MSG_EQ (m_blockAckHdr.IsPacketReceived (10), false, "error in compressed bitmap");
NS_TEST_EXPECT_MSG_EQ (m_blockAckHdr.IsPacketReceived (35), false, "error in compressed bitmap");
NS_TEST_EXPECT_MSG_EQ (m_blockAckHdr.IsPacketReceived (80), false, "error in compressed bitmap");
-
- return GetErrorStatus ();
}
class BlockAckTestSuite : public TestSuite
--- a/src/devices/wifi/dcf-manager-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/wifi/dcf-manager-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -58,7 +58,7 @@
{
public:
DcfManagerTest ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void NotifyAccessGranted (uint32_t i);
@@ -340,7 +340,7 @@
-bool
+void
DcfManagerTest::DoRun (void)
{
// 0 3 4 5 8 9 10 12
@@ -661,8 +661,6 @@
AddSwitchingEvt(80,20);
AddAccessRequest (101, 2, 110, 0);
EndTest ();
-
- return GetErrorStatus ();
}
//-----------------------------------------------------------------------------
--- a/src/devices/wifi/interference-helper-tx-duration-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/wifi/interference-helper-tx-duration-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -34,7 +34,7 @@
public:
InterferenceHelperTxDurationTest ();
virtual ~InterferenceHelperTxDurationTest ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
private:
@@ -109,7 +109,7 @@
return true;
}
-bool
+void
InterferenceHelperTxDurationTest::DoRun (void)
{
bool retval = true;
@@ -178,8 +178,6 @@
&& CheckTxDuration (1536, WifiPhy::GetErpOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 254)
&& CheckTxDuration (76, WifiPhy::GetErpOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 38)
&& CheckTxDuration (14, WifiPhy::GetErpOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 30);
-
- return (!retval);
}
class TxDurationTestSuite : public TestSuite
--- a/src/devices/wifi/wifi-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/wifi/wifi-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -45,7 +45,7 @@
public:
WifiTest ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
private:
void RunOne (void);
void CreateOne (Vector pos, Ptr<YansWifiChannel> channel);
@@ -116,7 +116,7 @@
Simulator::Stop (Seconds (10.0));
}
-bool
+void
WifiTest::DoRun (void)
{
m_mac.SetTypeId ("ns3::AdhocWifiMac");
@@ -147,7 +147,6 @@
m_mac.SetTypeId ("ns3::AdhocWifiMac");
RunOne ();
Simulator::Destroy ();
- return false;
}
//-----------------------------------------------------------------------------
@@ -155,7 +154,7 @@
{
public:
QosUtilsIsOldPacketTest () : TestCase ("QosUtilsIsOldPacket") {}
- virtual bool DoRun (void)
+ virtual void DoRun (void)
{
// startingSeq=0, seqNum=2047
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 2047), false, "2047 is new in comparison to 0");
@@ -173,8 +172,6 @@
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2048, 4095), false, "4095 is new in comparison to 2048");
// startingSeq=2049 seqNum=0
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2049, 0), false, "0 is new in comparison to 2049");
-
- return GetErrorStatus ();
}
};
@@ -184,7 +181,7 @@
public:
InterferenceHelperSequenceTest ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
private:
Ptr<Node> CreateOne (Vector pos, Ptr<YansWifiChannel> channel);
void SendOnePacket (Ptr<WifiNetDevice> dev);
@@ -244,7 +241,7 @@
return node;
}
-bool
+void
InterferenceHelperSequenceTest::DoRun (void)
{
m_mac.SetTypeId ("ns3::AdhocWifiMac");
@@ -284,7 +281,6 @@
Simulator::Run ();
Simulator::Destroy ();
- return false;
}
//-----------------------------------------------------------------------------
--- a/src/devices/wimax/mac-messages-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/wimax/mac-messages-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -50,7 +50,7 @@
virtual ~DsaRequestTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -63,7 +63,7 @@
{
}
-bool
+void
DsaRequestTestCase::DoRun (void)
{
IpcsClassifierRecord classifier = IpcsClassifierRecord ();
@@ -90,49 +90,16 @@
ServiceFlow sfRecv = dsaReqRecv.GetServiceFlow ();
- if (sfRecv.GetDirection () != ServiceFlow::SF_DIRECTION_DOWN)
- {
-
- return true;
- }
- if (sfRecv.GetSfid () != 100)
- {
- return true;
- }
- if (sfRecv.GetCsSpecification () != ServiceFlow::IPV4)
- {
- return true;
- }
- if (sfRecv.GetServiceSchedulingType () != ServiceFlow::SF_TYPE_UGS)
- {
- return true;
- }
- if (sfRecv.GetMaxSustainedTrafficRate () != 1000000)
- {
- return true;
- }
- if (sfRecv.GetMinReservedTrafficRate () != 1000000)
- {
- return true;
- }
- if (sfRecv.GetMinTolerableTrafficRate () != 1000000)
- {
- return true;
- }
- if (sfRecv.GetMaximumLatency () != 10)
- {
- return true;
- }
- if (sfRecv.GetMaxTrafficBurst () != 1000)
- {
- return true;
- }
- if (sfRecv.GetTrafficPriority () != 1)
- {
- return true;
- }
-
- return false; // Test is passed
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetDirection (), ServiceFlow::SF_DIRECTION_DOWN, "The sfRecv had the wrong direction.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetSfid (), 100, "The sfRecv had the wrong sfid.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetCsSpecification (), ServiceFlow::IPV4, "The sfRecv had the wrong cs specification.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetServiceSchedulingType (), ServiceFlow::SF_TYPE_UGS, "The sfRecv had the wrong service scheduling type.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMaxSustainedTrafficRate (), 1000000, "The sfRecv had the wrong maximum sustained traffic rate.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMinReservedTrafficRate (), 1000000, "The sfRecv had the wrong minimum reserved traffic rate.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMinTolerableTrafficRate (), 1000000, "The sfRecv had the wrong minimum tolerable traffic rate.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMaximumLatency (), 10, "The sfRecv had the wrong maximum latency.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMaxTrafficBurst (), 1000, "The sfRecv had the wrong maximum traffic burst.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetTrafficPriority (), 1, "The sfRecv had the wrong traffic priority.");
}
// ==============================================================================
--- a/src/devices/wimax/phy-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/wimax/phy-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -53,7 +53,7 @@
virtual ~Ns3WimaxSimpleOFDMTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
bool DoRunOnce (double);
};
@@ -101,7 +101,7 @@
}
-bool
+void
Ns3WimaxSimpleOFDMTestCase::DoRun (void)
{
@@ -112,10 +112,9 @@
std::cout << "Frame Duration = " << frameDuratioTab[i] << std::endl;
if (DoRunOnce (frameDuratioTab[i]) != false)
{
- return true;
+ return;
}
}
- return false;
}
/*
@@ -129,7 +128,7 @@
virtual ~Ns3WimaxSNRtoBLERTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
bool DoRunOnce (uint8_t);
};
@@ -159,15 +158,13 @@
return false;
}
-bool
+void
Ns3WimaxSNRtoBLERTestCase::DoRun (void)
{
for (int i = 0; i < 7; i++)
{
DoRunOnce (i);
}
-
- return false;
}
/*
--- a/src/devices/wimax/qos-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/wimax/qos-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -46,7 +46,7 @@
virtual ~Ns3WimaxSchedulingTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
bool DoRunOnce (WimaxHelper::SchedulerType scheduler);
};
@@ -143,18 +143,17 @@
}
-bool
+void
Ns3WimaxSchedulingTestCase::DoRun ()
{
if (DoRunOnce (WimaxHelper::SCHED_TYPE_SIMPLE) == true)
{
- return true;
+ return;
}
if (DoRunOnce (WimaxHelper::SCHED_TYPE_RTPS) == true)
{
- return true;
+ return;
}
- return false;
}
@@ -166,7 +165,7 @@
virtual ~Ns3WimaxSFTypeTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
bool DoRunOnce (ServiceFlow::SchedulingType);
};
@@ -262,22 +261,21 @@
}
-bool
+void
Ns3WimaxSFTypeTestCase::DoRun ()
{
if (DoRunOnce (ServiceFlow::SF_TYPE_UGS) == true)
{
- return true;
+ return;
}
if (DoRunOnce (ServiceFlow::SF_TYPE_RTPS) == true)
{
- return true;
+ return;
}
if (DoRunOnce (ServiceFlow::SF_TYPE_BE) == true)
{
- return true;
+ return;
}
- return false;
}
class Ns3WimaxQoSTestSuite : public TestSuite
--- a/src/devices/wimax/ss-mac-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/wimax/ss-mac-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -53,7 +53,7 @@
virtual ~Ns3WimaxNetworkEntryTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -66,7 +66,7 @@
{
}
-bool
+void
Ns3WimaxNetworkEntryTestCase::DoRun (void)
{
WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
@@ -96,8 +96,6 @@
"SS[" << i << "] IsNotRegistered");
}
Simulator::Destroy ();
- return (false); // Test was ok, all the SS are registered
-
}
/*
@@ -114,7 +112,7 @@
virtual ~Ns3WimaxManagementConnectionsTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -127,7 +125,7 @@
{
}
-bool
+void
Ns3WimaxManagementConnectionsTestCase::DoRun (void)
{
WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
@@ -157,8 +155,6 @@
true, "Management connections for SS[" << i << "] are not allocated");
}
Simulator::Destroy ();
- return (false);
-
}
class Ns3WimaxSSMacTestSuite : public TestSuite
{
--- a/src/devices/wimax/wimax-fragmentation-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/wimax/wimax-fragmentation-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -52,7 +52,7 @@
virtual ~Ns3WimaxFragmentationTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -65,7 +65,7 @@
{
}
-bool
+void
Ns3WimaxFragmentationTestCase::DoRun (void)
{
GenericMacHeader gnrcMacHdr;
@@ -178,7 +178,6 @@
delete connectionTx;
delete connectionRx;
Simulator::Destroy ();
- return (testResult);
}
// ==============================================================================
--- a/src/devices/wimax/wimax-service-flow-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/wimax/wimax-service-flow-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -52,7 +52,7 @@
virtual ~Ns3WimaxSfCreationTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -65,7 +65,7 @@
{
}
-bool
+void
Ns3WimaxSfCreationTestCase::DoRun (void)
{
@@ -153,7 +153,6 @@
Simulator::Stop (Seconds (duration));
Simulator::Run ();
Simulator::Destroy ();
- return false; // Test is passed
}
// ==============================================================================
--- a/src/devices/wimax/wimax-tlv-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/devices/wimax/wimax-tlv-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -52,7 +52,7 @@
virtual ~Ns3WimaxCsParamTlvTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -65,7 +65,7 @@
{
}
-bool
+void
Ns3WimaxCsParamTlvTestCase::DoRun (void)
{
@@ -111,42 +111,29 @@
IpcsClassifierRecord classifier =
csParamsRecv.GetPacketClassifierRule ();
- if (!classifier.CheckMatch (Ipv4Address ("10.1.1.1"),
+ NS_TEST_ASSERT_MSG_EQ (!classifier.CheckMatch (Ipv4Address ("10.1.1.1"),
Ipv4Address ("16.1.1.1"),
1050,
3050,
- 17))
- {
- return true;
- }
- if (!classifier.CheckMatch (Ipv4Address ("10.1.5.1"),
+ 17), false, "The classifier address did not match.");
+ NS_TEST_ASSERT_MSG_EQ (!classifier.CheckMatch (Ipv4Address ("10.1.5.1"),
Ipv4Address ("11.1.1.23"),
1070,
3040,
- 6))
- {
- return true;
- }
- if (classifier.CheckMatch (Ipv4Address ("11.1.1.1"),
+ 6), false, "The classifier address did not match.");
+ NS_TEST_ASSERT_MSG_EQ (classifier.CheckMatch (Ipv4Address ("11.1.1.1"),
Ipv4Address ("17.1.1.1"),
1050,
3050,
- 17))
- {
- return true;
- }
- if (classifier.CheckMatch (Ipv4Address ("10.1.1.1"),
+ 17), false, "The classifier addresses matched.");
+ NS_TEST_ASSERT_MSG_EQ (classifier.CheckMatch (Ipv4Address ("10.1.1.1"),
Ipv4Address ("16.1.1.1"),
1050,
3050,
- 8))
- {
- return true;
- }
+ 8), false, "The classifier addresses matched.");
}
}
}
- return (false); // Test is passed
}
// ==============================================================================
@@ -160,7 +147,7 @@
virtual ~Ns3WimaxSfTlvTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
@@ -173,7 +160,7 @@
{
}
-bool
+void
Ns3WimaxSfTlvTestCase::DoRun (void)
{
IpcsClassifierRecord classifier = IpcsClassifierRecord ();
@@ -199,22 +186,16 @@
ServiceFlow sfRecv = ServiceFlow (tlvReceived);
-
- if (sfRecv.GetDirection () != ServiceFlow::SF_DIRECTION_DOWN
- || sfRecv.GetSfid () != 100
- || sfRecv.GetCsSpecification () != ServiceFlow::IPV4
- || sfRecv.GetServiceSchedulingType () != ServiceFlow::SF_TYPE_UGS
- || sfRecv.GetMaxSustainedTrafficRate () != 1000000
- || sfRecv.GetMinReservedTrafficRate () != 1000000
- || sfRecv.GetMinTolerableTrafficRate () != 1000000
- || sfRecv.GetMaximumLatency () != 10
- || sfRecv.GetMaxTrafficBurst () != 1000
- || sfRecv.GetTrafficPriority () != 1)
- {
- return true;
- }
-
- return false; // Test is passed
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetDirection (), ServiceFlow::SF_DIRECTION_DOWN, "The sfRecv had the wrong direction.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetSfid (), 100, "The sfRecv had the wrong sfid.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetCsSpecification (), ServiceFlow::IPV4, "The sfRecv had the wrong cs specification.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetServiceSchedulingType (), ServiceFlow::SF_TYPE_UGS, "The sfRecv had the wrong service scheduling type.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMaxSustainedTrafficRate (), 1000000, "The sfRecv had the wrong maximum sustained traffic rate.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMinReservedTrafficRate (), 1000000, "The sfRecv had the wrong minimum reserved traffic rate.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMinTolerableTrafficRate (), 1000000, "The sfRecv had the wrong minimum tolerable traffic rate.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMaximumLatency (), 10, "The sfRecv had the wrong maximum latency.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetMaxTrafficBurst (), 1000, "The sfRecv had the wrong maximum traffic burst.");
+ NS_TEST_ASSERT_MSG_EQ (sfRecv.GetTrafficPriority (), 1, "The sfRecv had the wrong traffic priority.");
}
// ==============================================================================
--- a/src/helper/ipv4-address-helper.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/helper/ipv4-address-helper.cc Mon Jan 17 12:53:20 2011 -0800
@@ -189,7 +189,7 @@
public:
NetworkAllocatorHelperTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -203,7 +203,7 @@
Ipv4AddressGenerator::Reset ();
Simulator::Destroy ();
}
-bool
+void
NetworkAllocatorHelperTestCase::DoRun (void)
{
Ipv4Address address;
@@ -227,8 +227,6 @@
NS_TEST_EXPECT_MSG_EQ (network, Ipv4Address ("0.0.2.0"), "XXX");
address = h.NewAddress();
NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.0.2.1"), "XXX");
-
- return false;
}
class AddressAllocatorHelperTestCase : public TestCase
@@ -236,7 +234,7 @@
public:
AddressAllocatorHelperTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -251,7 +249,7 @@
Simulator::Destroy ();
}
-bool
+void
AddressAllocatorHelperTestCase::DoRun (void)
{
Ipv4Address network;
@@ -275,15 +273,13 @@
NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.0.1.3"), "XXX");
address = h.NewAddress();
NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.0.1.4"), "XXX");
-
- return false;
}
class ResetAllocatorHelperTestCase : public TestCase
{
public:
ResetAllocatorHelperTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -291,7 +287,7 @@
: TestCase ("Make sure the reset to base behavior is working")
{}
-bool
+void
ResetAllocatorHelperTestCase::DoRun (void)
{
Ipv4Address network;
@@ -332,8 +328,6 @@
NS_TEST_EXPECT_MSG_EQ (network, Ipv4Address ("0.0.2.0"), "XXX");
address = h.NewAddress();
NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.0.2.3"), "XXX");
-
- return false;
}
void
--- a/src/helper/ns2-mobility-helper.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/helper/ns2-mobility-helper.cc Mon Jan 17 12:53:20 2011 -0800
@@ -754,7 +754,7 @@
{
m_traceFile = GetTempDir () + "Ns2MobilityHelperTest.tcl";
std::ofstream of (m_traceFile.c_str ());
- NS_TEST_ASSERT_MSG_EQ (of.is_open (), true, "Need to write tmp. file");
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (of.is_open (), true, "Need to write tmp. file");
of << m_trace;
of.close ();
return false; // no errors
@@ -779,9 +779,9 @@
{
ReferencePoint const & rp = m_reference[m_nextRefPoint];
Ptr<Node> node = Names::Find<Node> (rp.node);
- NS_TEST_ASSERT_MSG_NE (node, 0, "Can't find node with id " << rp.node);
+ NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL (node, 0, "Can't find node with id " << rp.node);
Ptr<MobilityModel> mob = node->GetObject<MobilityModel> ();
- NS_TEST_ASSERT_MSG_NE (mob, 0, "Can't find mobility for node " << rp.node);
+ NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL (mob, 0, "Can't find mobility for node " << rp.node);
NS_TEST_EXPECT_MSG_EQ (rp.pos, mob->GetPosition (), "Initial position mismatch for node " << rp.node);
NS_TEST_EXPECT_MSG_EQ (rp.vel, mob->GetVelocity (), "Initial velocity mismatch for node " << rp.node);
@@ -814,21 +814,21 @@
NS_TEST_EXPECT_MSG_EQ (vel, ref.vel, "Velocity mismatch at time " << time.GetSeconds () << " s for node " << id);
}
/// Go
- bool DoRun ()
+ void DoRun ()
{
NS_TEST_ASSERT_MSG_EQ (m_trace.empty (), false, "Need trace");
NS_TEST_ASSERT_MSG_EQ (m_reference.empty (), false, "Need reference");
if (WriteTrace ())
{
- return GetErrorStatus ();
+ return;
}
CreateNodes ();
Ns2MobilityHelper mobility (m_traceFile);
mobility.Install ();
if (CheckInitialPositions ())
{
- return GetErrorStatus ();
+ return;
}
Config::Connect ("/NodeList/*/$ns3::MobilityModel/CourseChange",
MakeCallback (&Ns2MobilityHelperTest::CourseChange, this));
@@ -837,7 +837,6 @@
Names::Clear ();
std::remove (m_traceFile.c_str ());
Simulator::Destroy ();
- return GetErrorStatus ();
}
};
--- a/src/internet-stack/ipv4-raw-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/internet-stack/ipv4-raw-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -79,7 +79,7 @@
void SendData_IpHdr (Ptr<Socket> socket, std::string to);
public:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
Ipv4RawSocketImplTest ();
void ReceivePacket (Ptr<Socket> socket, Ptr<Packet> packet, const Address &from);
@@ -171,7 +171,7 @@
Simulator::Run ();
}
-bool
+void
Ipv4RawSocketImplTest::DoRun (void)
{
// Create topology
@@ -310,8 +310,6 @@
m_receivedPacket2 = 0;
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
//-----------------------------------------------------------------------------
class Ipv4RawTestSuite : public TestSuite
--- a/src/internet-stack/ipv4-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/internet-stack/ipv4-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -48,7 +48,7 @@
* \brief Run unit tests for this class.
* \return false if all tests have passed, false otherwise
*/
- virtual bool
+ virtual void
DoRun (void);
};
@@ -61,7 +61,7 @@
Ipv4L3ProtocolTestCase::~Ipv4L3ProtocolTestCase ()
{
}
-bool
+void
Ipv4L3ProtocolTestCase::DoRun (void)
{
Ptr<Node> node = CreateObject<Node> ();
@@ -95,7 +95,6 @@
NS_TEST_ASSERT_MSG_EQ (ifaceAddr4, output,
"The addresses should be identical");
Simulator::Destroy ();
- return false;
}
static class IPv4L3ProtocolTestSuite : public TestSuite
--- a/src/internet-stack/ipv6-extension-header-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/internet-stack/ipv6-extension-header-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -38,7 +38,7 @@
public:
TestEmptyOptionField () : TestCase("TestEmptyOptionField") {}
- virtual bool DoRun()
+ virtual void DoRun()
{
Ipv6ExtensionDestinationHeader header;
NS_TEST_EXPECT_MSG_EQ(header.GetSerializedSize() % 8, 0, "length of extension header is not a multiple of 8");
@@ -49,8 +49,6 @@
const uint8_t* data = buf.PeekData();
NS_TEST_EXPECT_MSG_EQ(*(data+2), 1, "padding is missing"); //expecting a padN header
-
- return GetErrorStatus();
}
};
@@ -87,7 +85,7 @@
public:
TestOptionWithoutAlignment () : TestCase("TestOptionWithoutAlignment") {}
- virtual bool DoRun()
+ virtual void DoRun()
{
Ipv6ExtensionDestinationHeader header;
OptionWithoutAlignmentHeader optionHeader;
@@ -102,8 +100,6 @@
const uint8_t* data = buf.PeekData();
NS_TEST_EXPECT_MSG_EQ(*(data+2), OptionWithoutAlignmentHeader::TYPE, "option without alignment is not first in header field");
-
- return GetErrorStatus();
}
};
@@ -150,7 +146,7 @@
public:
TestOptionWithAlignment () : TestCase("TestOptionWithAlignment") {}
- virtual bool DoRun()
+ virtual void DoRun()
{
Ipv6ExtensionDestinationHeader header;
OptionWithAlignmentHeader optionHeader;
@@ -169,8 +165,6 @@
NS_TEST_EXPECT_MSG_EQ(*(data+4), OptionWithAlignmentHeader::TYPE, "option with alignment is not padded correctly");
NS_TEST_EXPECT_MSG_EQ(*(data+8), 1, "padding is missing"); //expecting a padN header
NS_TEST_EXPECT_MSG_EQ(*(data+10), jumboHeader.GetType(), "option with alignment is not padded correctly");
-
- return GetErrorStatus();
}
};
@@ -195,7 +189,7 @@
public:
TestFulfilledAlignment () : TestCase("TestCorrectAlignment") {}
- virtual bool DoRun()
+ virtual void DoRun()
{
Ipv6ExtensionDestinationHeader header;
Ipv6OptionJumbogramHeader jumboHeader; //has an alignment of 4n+2
@@ -212,8 +206,6 @@
const uint8_t* data = buf.PeekData();
NS_TEST_EXPECT_MSG_EQ(*(data+2), jumboHeader.GetType(), "option with fulfilled alignment is padded anyway");
NS_TEST_EXPECT_MSG_EQ(*(data+8), OptionWithAlignmentHeader::TYPE, "option with fulfilled alignment is padded anyway");
-
- return GetErrorStatus();
}
};
--- a/src/internet-stack/ipv6-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/internet-stack/ipv6-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -49,7 +49,7 @@
* \brief Run unit tests for this class.
* \return false if all tests have passed, false otherwise
*/
- virtual bool
+ virtual void
DoRun ();
};
Ipv6L3ProtocolTestCase::Ipv6L3ProtocolTestCase () :
@@ -59,7 +59,7 @@
Ipv6L3ProtocolTestCase::~Ipv6L3ProtocolTestCase ()
{
}
-bool
+void
Ipv6L3ProtocolTestCase::DoRun ()
{
Ptr<Node> node = CreateObject<Node> ();
@@ -136,7 +136,6 @@
index = ipv6->GetInterfaceForAddress ("2001:ffff:5678:9000::1"); /* address we just remove */
NS_TEST_ASSERT_MSG_EQ (index, (uint32_t) -1, "Address should not be found??");
Simulator::Destroy ();
- return false;
}//end DoRun
static class IPv6L3ProtocolTestSuite : public TestSuite
{
--- a/src/internet-stack/tcp-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/internet-stack/tcp-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -57,7 +57,7 @@
uint32_t serverWriteSize,
uint32_t serverReadSize);
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
void SetupDefaultSim (void);
@@ -123,7 +123,7 @@
m_serverReadSize (serverReadSize)
{}
-bool
+void
TcpTestCase::DoRun (void)
{
m_currentSourceTxBytes = 0;
@@ -152,8 +152,6 @@
"Server received expected data buffers");
NS_TEST_EXPECT_MSG_EQ (memcmp (m_sourceTxPayload, m_sourceRxPayload, m_totalBytes), 0,
"Source received back expected data buffers");
-
- return false;
}
void
TcpTestCase::DoTeardown (void)
--- a/src/internet-stack/udp-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/internet-stack/udp-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -77,7 +77,7 @@
{
public:
UdpSocketLoopbackTest ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void ReceivePkt (Ptr<Socket> socket);
Ptr<Packet> m_receivedPacket;
@@ -96,7 +96,7 @@
NS_ASSERT (availableData == m_receivedPacket->GetSize ());
}
-bool
+void
UdpSocketLoopbackTest::DoRun ()
{
Ptr<Node> rxNode = CreateObject<Node> ();
@@ -112,7 +112,6 @@
Simulator::Run ();
Simulator::Destroy ();
NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 246, "first socket should not receive it (it is bound specifically to the second interface's address");
- return GetErrorStatus ();
}
class UdpSocketImplTest: public TestCase
@@ -123,7 +122,7 @@
void SendData (Ptr<Socket> socket, std::string to);
public:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
UdpSocketImplTest ();
void ReceivePacket (Ptr<Socket> socket, Ptr<Packet> packet, const Address &from);
@@ -181,7 +180,7 @@
Simulator::Run ();
}
-bool
+void
UdpSocketImplTest::DoRun (void)
{
// Create topology
@@ -310,7 +309,6 @@
Simulator::Destroy ();
- return GetErrorStatus ();
}
//-----------------------------------------------------------------------------
--- a/src/mobility/steady-state-random-waypoint-mobility-model.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/mobility/steady-state-random-waypoint-mobility-model.cc Mon Jan 17 12:53:20 2011 -0800
@@ -275,11 +275,11 @@
NodeContainer nodes;
double NodeCount;
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void DistribCompare ();
};
-bool
+void
SteadyStateRandomWaypointTest::DoRun (void)
{
SeedManager::SetSeed(123);
@@ -307,8 +307,6 @@
Simulator::Stop (Seconds (totalTime));
Simulator::Run ();
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
void
--- a/src/mobility/waypoint-mobility-model.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/mobility/waypoint-mobility-model.cc Mon Jan 17 12:53:20 2011 -0800
@@ -235,11 +235,11 @@
std::deque<Waypoint> waypoints;
bool lazyNotify;
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void ForceUpdates (void);
void CourseChangeCallback (std::string path, Ptr<const MobilityModel> model);
};
-bool
+void
WaypointMobilityModelNotifyTest::DoRun (void)
{
nodeCount = 1;
@@ -282,8 +282,6 @@
Simulator::Stop (Seconds ((double)waypointCount + 2.0));
Simulator::Run ();
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
void
WaypointMobilityModelNotifyTest::ForceUpdates (void)
--- a/src/node/drop-tail-queue.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/node/drop-tail-queue.cc Mon Jan 17 12:53:20 2011 -0800
@@ -160,13 +160,13 @@
{
public:
DropTailQueueTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
DropTailQueueTestCase::DropTailQueueTestCase ()
: TestCase ("Sanity check on the drop tail queue implementation")
{}
-bool
+void
DropTailQueueTestCase::DoRun (void)
{
Ptr<DropTailQueue> queue = CreateObject<DropTailQueue> ();
@@ -208,8 +208,6 @@
p = queue->Dequeue ();
NS_TEST_EXPECT_MSG_EQ ((p == 0), true, "There are really no packets in there");
-
- return false;
}
static class DropTailQueueTestSuite : public TestSuite
--- a/src/node/ipv4-address-generator.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/node/ipv4-address-generator.cc Mon Jan 17 12:53:20 2011 -0800
@@ -467,7 +467,7 @@
{
public:
NetworkNumberAllocatorTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -479,7 +479,7 @@
{
Ipv4AddressGenerator::Reset ();
}
-bool
+void
NetworkNumberAllocatorTestCase::DoRun (void)
{
Ipv4Address network;
@@ -510,8 +510,6 @@
NS_TEST_EXPECT_MSG_EQ (network, Ipv4Address ("0.3.0.0"), "XXX");
network = Ipv4AddressGenerator::NextNetwork (Ipv4Mask ("255.255.255.0"));
NS_TEST_EXPECT_MSG_EQ (network, Ipv4Address ("0.0.3.0"), "XXX");
-
- return false;
}
class AddressAllocatorTestCase : public TestCase
@@ -519,7 +517,7 @@
public:
AddressAllocatorTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -527,7 +525,7 @@
: TestCase ("Sanity check on allocation of addresses")
{}
-bool
+void
AddressAllocatorTestCase::DoRun (void)
{
Ipv4Address address;
@@ -552,8 +550,6 @@
NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.0.1.3"), "XXX");
address = Ipv4AddressGenerator::NextAddress (Ipv4Mask ("255.255.255.0"));
NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.0.1.4"), "XXX");
-
- return false;
}
void
@@ -568,7 +564,7 @@
{
public:
NetworkAndAddressTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -583,7 +579,7 @@
Simulator::Destroy ();
}
-bool
+void
NetworkAndAddressTestCase::DoRun (void)
{
Ipv4Address address;
@@ -624,7 +620,6 @@
NS_TEST_EXPECT_MSG_EQ (network, Ipv4Address ("0.0.4.0"), "XXX");
address = Ipv4AddressGenerator::NextAddress (Ipv4Mask ("255.255.255.0"));
NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.0.4.5"), "XXX");
- return false;
}
class ExampleAddressGeneratorTestCase : public TestCase
@@ -632,7 +627,7 @@
public:
ExampleAddressGeneratorTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
};
@@ -646,7 +641,7 @@
Ipv4AddressGenerator::Reset ();
}
-bool
+void
ExampleAddressGeneratorTestCase::DoRun (void)
{
Ipv4Address address;
@@ -676,8 +671,6 @@
//
address = Ipv4AddressGenerator::NextAddress (Ipv4Mask ("255.255.255.0"));
NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("192.168.1.3"), "XXX");
-
- return false;
}
class AddressCollisionTestCase : public TestCase
@@ -685,7 +678,7 @@
public:
AddressCollisionTestCase ();
private:
- bool DoRun (void);
+ void DoRun (void);
void DoTeardown (void);
};
@@ -699,7 +692,7 @@
Ipv4AddressGenerator::Reset ();
Simulator::Destroy ();
}
-bool
+void
AddressCollisionTestCase::DoRun (void)
{
Ipv4AddressGenerator::AddAllocated ("0.0.0.5");
@@ -742,8 +735,6 @@
added = Ipv4AddressGenerator::AddAllocated ("0.0.0.21");
NS_TEST_EXPECT_MSG_EQ (added, false, "XXX");
-
- return false;
}
--- a/src/node/ipv4-packet-info-tag.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/node/ipv4-packet-info-tag.cc Mon Jan 17 12:53:20 2011 -0800
@@ -166,7 +166,7 @@
public:
Ipv4PacketInfoTagTest ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void RxCb (Ptr<Socket> socket);
void DoSendData (Ptr<Socket> socket, std::string to);
};
@@ -208,7 +208,7 @@
}
}
-bool
+void
Ipv4PacketInfoTagTest::DoRun (void)
{
NodeContainer n;
@@ -264,8 +264,6 @@
&Ipv4PacketInfoTagTest::DoSendData, this, socket, "10.1.1.1");
Simulator::Run ();
Simulator::Destroy ();
-
- return 0;
}
static class Ipv4PacketInfoTagTestSuite : public TestSuite
--- a/src/node/ipv6-packet-info-tag.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/node/ipv6-packet-info-tag.cc Mon Jan 17 12:53:20 2011 -0800
@@ -165,7 +165,7 @@
public:
Ipv6PacketInfoTagTest ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void RxCb (Ptr<Socket> socket);
void DoSendData (Ptr<Socket> socket, std::string to);
};
@@ -208,7 +208,7 @@
}
}
-bool
+void
Ipv6PacketInfoTagTest::DoRun (void)
{
NodeContainer n;
@@ -274,7 +274,6 @@
Simulator::Destroy ();
// IPv6 test
- return 0;
}
static class Ipv6PacketInfoTagTestSuite : public TestSuite
--- a/src/node/packetbb-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/node/packetbb-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -37,7 +37,7 @@
virtual ~PbbTestCase (void);
protected:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
private:
bool TestSerialize (void);
@@ -62,14 +62,13 @@
return;
}
-bool
+void
PbbTestCase::DoRun (void)
{
NS_TEST_ASSERT_MSG_EQ (TestSerialize (), false,
"serialization failed");
NS_TEST_ASSERT_MSG_EQ (TestDeserialize (), false,
"deserialization failed");
- return GetErrorStatus ();
}
bool
@@ -79,13 +78,13 @@
newBuffer.AddAtStart (m_refPacket->GetSerializedSize ());
m_refPacket->Serialize (newBuffer.Begin ());
- NS_TEST_ASSERT_MSG_EQ (newBuffer.GetSize (), m_refBuffer.GetSize (),
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (newBuffer.GetSize (), m_refBuffer.GetSize (),
"serialization failed, buffers have different sizes");
int memrv = memcmp (newBuffer.PeekData (), m_refBuffer.PeekData (),
newBuffer.GetSize ());
- NS_TEST_ASSERT_MSG_EQ (memrv, 0,
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (memrv, 0,
"serialization faled, buffers differ");
return GetErrorStatus ();
@@ -97,10 +96,10 @@
Ptr<PbbPacket> newPacket = Create<PbbPacket> ();
uint32_t numbytes = newPacket->Deserialize (m_refBuffer.Begin ());
- NS_TEST_ASSERT_MSG_EQ (numbytes, m_refBuffer.GetSize (),
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (numbytes, m_refBuffer.GetSize (),
"deserialization failed, did not use all bytes");
- NS_TEST_ASSERT_MSG_EQ (*newPacket, *m_refPacket,
+ NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL (*newPacket, *m_refPacket,
"deserialization failed, objects do not match");
return GetErrorStatus ();
--- a/src/routing/aodv/aodv-id-cache.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/aodv/aodv-id-cache.cc Mon Jan 17 12:53:20 2011 -0800
@@ -68,7 +68,7 @@
{
IdCacheTest () : TestCase ("Id Cache"), cache (Seconds(10))
{}
- virtual bool DoRun();
+ virtual void DoRun();
void CheckTimeout1 ();
void CheckTimeout2 ();
void CheckTimeout3 ();
@@ -76,7 +76,7 @@
IdCache cache;
};
-bool
+void
IdCacheTest::DoRun ()
{
NS_TEST_EXPECT_MSG_EQ (cache.GetLifeTime(), Seconds(10), "Lifetime");
@@ -97,8 +97,6 @@
Simulator::Schedule (Seconds(30), &IdCacheTest::CheckTimeout3, this);
Simulator::Run ();
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
void
--- a/src/routing/aodv/aodv-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/aodv/aodv-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -33,7 +33,7 @@
struct NeighborTest : public TestCase
{
NeighborTest () : TestCase ("Neighbor"), neighbor (0) { }
- virtual bool DoRun ();
+ virtual void DoRun ();
void Handler (Ipv4Address addr);
void CheckTimeout1 ();
void CheckTimeout2 ();
@@ -71,7 +71,7 @@
NS_TEST_EXPECT_MSG_EQ (neighbor->IsNeighbor (Ipv4Address ("3.3.3.3")), false, "Neighbor doesn't exist");
}
-bool
+void
NeighborTest::DoRun ()
{
Neighbors nb (Seconds (1));
@@ -93,16 +93,14 @@
Simulator::Schedule (Seconds (30), &NeighborTest::CheckTimeout3, this);
Simulator::Run ();
Simulator::Destroy ();
-
- return GetErrorStatus ();
-}
+ }
//-----------------------------------------------------------------------------
struct TypeHeaderTest : public TestCase
{
TypeHeaderTest () : TestCase ("AODV TypeHeader")
{
}
- virtual bool DoRun ()
+ virtual void DoRun ()
{
TypeHeader h (AODVTYPE_RREQ);
NS_TEST_EXPECT_MSG_EQ (h.IsValid (), true, "Default header is valid");
@@ -114,7 +112,6 @@
uint32_t bytes = p->RemoveHeader (h2);
NS_TEST_EXPECT_MSG_EQ (bytes, 1, "Type header is 1 byte long");
NS_TEST_EXPECT_MSG_EQ (h, h2, "Round trip serialization works");
- return GetErrorStatus ();
}
};
//-----------------------------------------------------------------------------
@@ -124,7 +121,7 @@
RreqHeaderTest () : TestCase ("AODV RREQ")
{
}
- virtual bool DoRun ()
+ virtual void DoRun ()
{
RreqHeader h (/*flags*/0, /*reserved*/0, /*hopCount*/6, /*requestID*/1, /*dst*/Ipv4Address ("1.2.3.4"),
/*dstSeqNo*/40, /*origin*/Ipv4Address ("4.3.2.1"), /*originSeqNo*/10);
@@ -163,7 +160,6 @@
NS_TEST_EXPECT_MSG_EQ (bytes, 23, "RREP is 23 bytes long");
NS_TEST_EXPECT_MSG_EQ (h, h2, "Round trip serialization works");
- return GetErrorStatus ();
}
};
//-----------------------------------------------------------------------------
@@ -171,7 +167,7 @@
struct RrepHeaderTest : public TestCase
{
RrepHeaderTest () : TestCase ("AODV RREP") {}
- virtual bool DoRun ()
+ virtual void DoRun ()
{
RrepHeader h (/*prefixSize*/0, /*hopCount*/12, /*dst*/Ipv4Address ("1.2.3.4"), /*dstSeqNo*/2,
/*origin*/Ipv4Address ("4.3.2.1"), /*lifetime*/Seconds (3));
@@ -209,7 +205,6 @@
uint32_t bytes = p->RemoveHeader (h2);
NS_TEST_EXPECT_MSG_EQ (bytes, 19, "RREP is 19 bytes long");
NS_TEST_EXPECT_MSG_EQ (h, h2, "Round trip serialization works");
- return GetErrorStatus ();
}
};
//-----------------------------------------------------------------------------
@@ -219,7 +214,7 @@
RrepAckHeaderTest () : TestCase ("AODV RREP-ACK")
{
}
- virtual bool DoRun()
+ virtual void DoRun()
{
RrepAckHeader h;
Ptr<Packet> p = Create<Packet> ();
@@ -228,7 +223,6 @@
uint32_t bytes = p->RemoveHeader(h2);
NS_TEST_EXPECT_MSG_EQ (bytes, 1, "ACK is 1 byte long");
NS_TEST_EXPECT_MSG_EQ (h, h2, "Round trip serialization works");
- return GetErrorStatus ();
}
};
//-----------------------------------------------------------------------------
@@ -238,7 +232,7 @@
RerrHeaderTest () : TestCase ("AODV RERR")
{
}
- virtual bool DoRun()
+ virtual void DoRun()
{
RerrHeader h;
h.SetNoDelete(true);
@@ -257,7 +251,6 @@
uint32_t bytes = p->RemoveHeader(h2);
NS_TEST_EXPECT_MSG_EQ (bytes, h.GetSerializedSize(), "(De)Serialized size match");
NS_TEST_EXPECT_MSG_EQ (h, h2, "Round trip serialization works");
- return GetErrorStatus ();
}
};
//-----------------------------------------------------------------------------
@@ -269,7 +262,7 @@
void Error (Ptr<const Packet>, const Ipv4Header &, Socket::SocketErrno) {}
void Unicast2 (Ptr<Ipv4Route> route, Ptr<const Packet> packet, const Ipv4Header & header) {}
void Error2 (Ptr<const Packet>, const Ipv4Header &, Socket::SocketErrno) {}
- virtual bool DoRun()
+ virtual void DoRun()
{
Ptr<const Packet> packet = Create<Packet> ();
Ipv4Header h;
@@ -296,8 +289,6 @@
NS_TEST_EXPECT_MSG_EQ (ecb2.IsEqual (entry.GetErrorCallback ()), true, "trivial");
entry.SetUnicastForwardCallback (ucb2);
NS_TEST_EXPECT_MSG_EQ (ucb2.IsEqual (entry.GetUnicastForwardCallback ()), true, "trivial");
-
- return GetErrorStatus();
}
};
//-----------------------------------------------------------------------------
@@ -305,7 +296,7 @@
struct AodvRqueueTest : public TestCase
{
AodvRqueueTest () : TestCase ("Rqueue"), q (64, Seconds (30)) {}
- virtual bool DoRun ();
+ virtual void DoRun ();
void Unicast (Ptr<Ipv4Route> route, Ptr<const Packet> packet, const Ipv4Header & header) {}
void Error (Ptr<const Packet>, const Ipv4Header &, Socket::SocketErrno) {}
void CheckSizeLimit ();
@@ -314,7 +305,7 @@
RequestQueue q;
};
-bool
+void
AodvRqueueTest::DoRun ()
{
NS_TEST_EXPECT_MSG_EQ (q.GetMaxQueueLen (), 64, "trivial");
@@ -371,8 +362,6 @@
Simulator::Run ();
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
void
@@ -403,7 +392,7 @@
struct AodvRtableEntryTest : public TestCase
{
AodvRtableEntryTest () : TestCase ("RtableEntry") {}
- virtual bool DoRun()
+ virtual void DoRun()
{
Ptr<NetDevice> dev;
Ipv4InterfaceAddress iface;
@@ -475,7 +464,6 @@
rt.GetPrecursors (prec);
NS_TEST_EXPECT_MSG_EQ (prec.size (), 2, "trivial");
Simulator::Destroy ();
- return GetErrorStatus ();
}
};
//-----------------------------------------------------------------------------
@@ -483,7 +471,7 @@
struct AodvRtableTest : public TestCase
{
AodvRtableTest () : TestCase ("Rtable") {}
- virtual bool DoRun()
+ virtual void DoRun()
{
RoutingTable rtable (Seconds (2));
NS_TEST_EXPECT_MSG_EQ (rtable.GetBadLinkLifetime (), Seconds (2), "trivial");
@@ -529,7 +517,6 @@
NS_TEST_EXPECT_MSG_EQ (rtable.DeleteRoute (Ipv4Address ("1.2.3.4")), true, "trivial");
NS_TEST_EXPECT_MSG_EQ (rtable.DeleteRoute (Ipv4Address ("1.2.3.4")), false, "trivial");
Simulator::Destroy ();
- return GetErrorStatus ();
}
};
//-----------------------------------------------------------------------------
--- a/src/routing/aodv/test/aodv-regression.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/aodv/test/aodv-regression.cc Mon Jan 17 12:53:20 2011 -0800
@@ -89,7 +89,7 @@
delete m_nodes;
}
-bool
+void
ChainRegressionTest::DoRun ()
{
SeedManager::SetSeed(12345);
@@ -110,7 +110,6 @@
if (!WRITE_VECTORS) CheckResults ();
delete m_nodes, m_nodes = 0;
- return GetErrorStatus ();
}
void
--- a/src/routing/aodv/test/aodv-regression.h Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/aodv/test/aodv-regression.h Mon Jan 17 12:53:20 2011 -0800
@@ -187,7 +187,7 @@
/// Compare traces with reference ones
void CheckResults ();
/// Go
- bool DoRun ();
+ void DoRun ();
};
}
--- a/src/routing/aodv/test/bug-772.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/aodv/test/bug-772.cc Mon Jan 17 12:53:20 2011 -0800
@@ -70,7 +70,7 @@
delete m_nodes;
}
-bool
+void
Bug772ChainTest::DoRun ()
{
SeedManager::SetSeed(12345);
@@ -85,7 +85,6 @@
if (!WRITE_VECTORS) CheckResults ();
delete m_nodes, m_nodes = 0;
- return GetErrorStatus ();
}
void
--- a/src/routing/aodv/test/bug-772.h Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/aodv/test/bug-772.h Mon Jan 17 12:53:20 2011 -0800
@@ -71,7 +71,7 @@
/// Compare traces with reference ones
void CheckResults ();
/// Go
- bool DoRun ();
+ void DoRun ();
};
}
--- a/src/routing/aodv/test/loopback.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/aodv/test/loopback.cc Mon Jan 17 12:53:20 2011 -0800
@@ -54,7 +54,7 @@
g_count ++;
}
-bool
+void
LoopbackTestCase::DoRun ()
{
NodeContainer nodes;
@@ -97,7 +97,6 @@
// Check that 4 packets delivered
NS_TEST_ASSERT_MSG_EQ (g_count, 4, "Exactly 4 ping replies must be delivered.");
- return GetErrorStatus ();
}
}
--- a/src/routing/aodv/test/loopback.h Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/aodv/test/loopback.h Mon Jan 17 12:53:20 2011 -0800
@@ -36,7 +36,7 @@
{
LoopbackTestCase () : TestCase ("Ping 127.0.0.1 test") {}
/// Run test
- bool DoRun ();
+ void DoRun ();
};
}
--- a/src/routing/dsdv/test/dsdv-testcase.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/dsdv/test/dsdv-testcase.cc Mon Jan 17 12:53:20 2011 -0800
@@ -53,7 +53,7 @@
public:
DsdvHeaderTestCase ();
~DsdvHeaderTestCase ();
- virtual bool
+ virtual void
DoRun (void);
};
DsdvHeaderTestCase::DsdvHeaderTestCase ()
@@ -63,7 +63,7 @@
DsdvHeaderTestCase::~DsdvHeaderTestCase ()
{
}
-bool
+void
DsdvHeaderTestCase::DoRun ()
{
Ptr<Packet> packet = Create<Packet> ();
@@ -96,8 +96,6 @@
NS_TEST_ASSERT_MSG_EQ (hdr1.GetDstSeqno (),2,"XXX");
NS_TEST_ASSERT_MSG_EQ (hdr1.GetHopCount (),2,"XXX");
}
-
- return GetErrorStatus ();
}
class DsdvTableTestCase : public TestCase
@@ -105,7 +103,7 @@
public:
DsdvTableTestCase ();
~DsdvTableTestCase ();
- virtual bool
+ virtual void
DoRun (void);
};
@@ -116,7 +114,7 @@
DsdvTableTestCase::~DsdvTableTestCase ()
{
}
-bool
+void
DsdvTableTestCase::DoRun ()
{
dsdv::RoutingTable rtable;
@@ -184,7 +182,6 @@
NS_TEST_ASSERT_MSG_EQ (rtable.RoutingTableSize (),4,"Rtable size incorrect");
}
Simulator::Destroy ();
- return GetErrorStatus ();
}
class DsdvTestSuite : public TestSuite
--- a/src/routing/global-routing/model/global-route-manager-impl.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/global-routing/model/global-route-manager-impl.cc Mon Jan 17 12:53:20 2011 -0800
@@ -2201,13 +2201,13 @@
{
public:
GlobalRouteManagerImplTestCase();
- virtual bool DoRun(void);
+ virtual void DoRun(void);
};
GlobalRouteManagerImplTestCase::GlobalRouteManagerImplTestCase()
: TestCase("GlobalRouteManagerImplTestCase")
{}
-bool
+void
GlobalRouteManagerImplTestCase::DoRun(void)
{
CandidateQueue candidate;
@@ -2385,7 +2385,6 @@
// XXX
// No testing has actually been done other than making sure that this code
// does not crash
- return GetErrorStatus ();
}
--- a/src/routing/list-routing/model/ipv4-list-routing.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/list-routing/model/ipv4-list-routing.cc Mon Jan 17 12:53:20 2011 -0800
@@ -333,13 +333,13 @@
{
public:
Ipv4ListRoutingNegativeTestCase();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
Ipv4ListRoutingNegativeTestCase::Ipv4ListRoutingNegativeTestCase()
: TestCase("Check negative priorities")
{}
-bool
+void
Ipv4ListRoutingNegativeTestCase::DoRun (void)
{
Ptr<Ipv4ListRouting> lr = CreateObject<Ipv4ListRouting> ();
@@ -354,22 +354,19 @@
Ptr<Ipv4RoutingProtocol> firstRp = lr->GetRoutingProtocol (0, first);
NS_TEST_ASSERT_MSG_EQ (-5, first, "XXX");
NS_TEST_ASSERT_MSG_EQ (firstRp, bRouting, "XXX");
-
- // XXX
- return false;
}
class Ipv4ListRoutingPositiveTestCase : public TestCase
{
public:
Ipv4ListRoutingPositiveTestCase();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
Ipv4ListRoutingPositiveTestCase::Ipv4ListRoutingPositiveTestCase()
: TestCase("Check positive priorities")
{}
-bool
+void
Ipv4ListRoutingPositiveTestCase::DoRun (void)
{
Ptr<Ipv4ListRouting> lr = CreateObject<Ipv4ListRouting> ();
@@ -389,9 +386,6 @@
Ptr<Ipv4RoutingProtocol> secondRp = lr->GetRoutingProtocol (1, second);
NS_TEST_ASSERT_MSG_EQ (5, second, "XXX");
NS_TEST_ASSERT_MSG_EQ (secondRp, bRouting, "XXX");
-
- // XXX
- return false;
}
static class Ipv4ListRoutingTestSuite : public TestSuite
--- a/src/routing/list-routing/model/ipv6-list-routing.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/list-routing/model/ipv6-list-routing.cc Mon Jan 17 12:53:20 2011 -0800
@@ -376,13 +376,13 @@
{
public:
Ipv6ListRoutingNegativeTestCase();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
Ipv6ListRoutingNegativeTestCase::Ipv6ListRoutingNegativeTestCase()
: TestCase("Check negative priorities")
{}
- bool
+ void
Ipv6ListRoutingNegativeTestCase::DoRun (void)
{
Ptr<Ipv6ListRouting> lr = CreateObject<Ipv6ListRouting> ();
@@ -397,22 +397,19 @@
Ptr<Ipv6RoutingProtocol> firstRp = lr->GetRoutingProtocol (0, first);
NS_TEST_ASSERT_MSG_EQ (-5, first, "XXX");
NS_TEST_ASSERT_MSG_EQ (firstRp, bRouting, "XXX");
-
- // XXX
- return false;
}
class Ipv6ListRoutingPositiveTestCase : public TestCase
{
public:
Ipv6ListRoutingPositiveTestCase();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
Ipv6ListRoutingPositiveTestCase::Ipv6ListRoutingPositiveTestCase()
: TestCase("Check positive priorities")
{}
- bool
+ void
Ipv6ListRoutingPositiveTestCase::DoRun (void)
{
Ptr<Ipv6ListRouting> lr = CreateObject<Ipv6ListRouting> ();
@@ -432,9 +429,6 @@
Ptr<Ipv6RoutingProtocol> secondRp = lr->GetRoutingProtocol (1, second);
NS_TEST_ASSERT_MSG_EQ (5, second, "XXX");
NS_TEST_ASSERT_MSG_EQ (secondRp, bRouting, "XXX");
-
- // XXX
- return false;
}
static class Ipv6ListRoutingTestSuite : public TestSuite
--- a/src/routing/olsr/model/olsr-header.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/olsr/model/olsr-header.cc Mon Jan 17 12:53:20 2011 -0800
@@ -509,13 +509,13 @@
class OlsrEmfTestCase : public TestCase {
public:
OlsrEmfTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
OlsrEmfTestCase::OlsrEmfTestCase ()
: TestCase ("Check Emf olsr time conversion")
{}
-bool
+void
OlsrEmfTestCase::DoRun (void)
{
for (int time = 1; time <= 30; time++)
@@ -525,20 +525,19 @@
NS_TEST_ASSERT_MSG_EQ((seconds < 0 || fabs (seconds - time) > 0.1), false,
"XXX");
}
- return false;
}
class OlsrMidTestCase : public TestCase {
public:
OlsrMidTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
OlsrMidTestCase::OlsrMidTestCase ()
: TestCase ("Check Mid olsr messages")
{}
-bool
+void
OlsrMidTestCase::DoRun (void)
{
Packet packet;
@@ -631,20 +630,19 @@
NS_TEST_ASSERT_MSG_EQ (sizeLeft, 0, "XXX");
}
}
- return false;
}
class OlsrHelloTestCase : public TestCase {
public:
OlsrHelloTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
OlsrHelloTestCase::OlsrHelloTestCase ()
: TestCase ("Check Hello olsr messages")
{}
-bool
+void
OlsrHelloTestCase::DoRun (void)
{
Packet packet;
@@ -692,19 +690,18 @@
NS_TEST_ASSERT_MSG_EQ (packet.GetSize (), 0, "All bytes in packet were not read");
- return false;
}
class OlsrTcTestCase : public TestCase {
public:
OlsrTcTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
OlsrTcTestCase::OlsrTcTestCase ()
: TestCase ("Check Tc olsr messages")
{}
-bool
+void
OlsrTcTestCase::DoRun (void)
{
Packet packet;
@@ -730,20 +727,19 @@
NS_TEST_ASSERT_MSG_EQ (packet.GetSize (), 0, "XXX");
- return false;
}
class OlsrHnaTestCase : public TestCase {
public:
OlsrHnaTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
OlsrHnaTestCase::OlsrHnaTestCase ()
: TestCase ("Check Hna olsr messages")
{}
-bool
+void
OlsrHnaTestCase::DoRun (void)
{
Packet packet;
@@ -774,7 +770,6 @@
NS_TEST_ASSERT_MSG_EQ (packet.GetSize (), 0, "All bytes in packet were not read");
- return false;
}
--- a/src/routing/olsr/model/olsr-routing-protocol.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/olsr/model/olsr-routing-protocol.cc Mon Jan 17 12:53:20 2011 -0800
@@ -3204,7 +3204,7 @@
OlsrMprTestCase::~OlsrMprTestCase ()
{
}
-bool
+void
OlsrMprTestCase::DoRun ()
{
Ptr<RoutingProtocol> protocol = CreateObject<RoutingProtocol> ();
@@ -3311,8 +3311,6 @@
mpr = state.GetMprSet ();
NS_TEST_EXPECT_MSG_EQ (mpr.size (), 3 , "An only address must be chosen.");
NS_TEST_EXPECT_MSG_EQ ((mpr.find ("10.0.0.9") == mpr.end ()), true, "Node 1 must NOT select node 8 as MPR");
-
- return false;
}
static class OlsrProtocolTestSuite : public TestSuite
--- a/src/routing/olsr/model/olsr-routing-protocol.h Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/olsr/model/olsr-routing-protocol.h Mon Jan 17 12:53:20 2011 -0800
@@ -69,7 +69,7 @@
OlsrMprTestCase ();
~OlsrMprTestCase ();
/// \brief Run test case
- virtual bool DoRun (void);
+ virtual void DoRun (void);
;
};
--- a/src/routing/olsr/test/bug780-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/olsr/test/bug780-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -74,7 +74,7 @@
{
}
-bool
+void
Bug780Test::DoRun ()
{
SeedManager::SetSeed(123);
@@ -88,7 +88,6 @@
{
CheckResults ();
}
- return GetErrorStatus ();
}
void
--- a/src/routing/olsr/test/bug780-test.h Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/olsr/test/bug780-test.h Mon Jan 17 12:53:20 2011 -0800
@@ -41,7 +41,7 @@
/// Compare traces with reference ones
void CheckResults ();
/// Go
- bool DoRun ();
+ void DoRun ();
};
}
--- a/src/routing/olsr/test/hello-regression-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/olsr/test/hello-regression-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -51,7 +51,7 @@
{
}
-bool
+void
HelloRegressionTest::DoRun ()
{
SeedManager::SetSeed(12345);
@@ -62,7 +62,6 @@
Simulator::Destroy ();
if (!WRITE_VECTORS) CheckResults ();
- return GetErrorStatus ();
}
void
--- a/src/routing/olsr/test/hello-regression-test.h Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/olsr/test/hello-regression-test.h Mon Jan 17 12:53:20 2011 -0800
@@ -61,7 +61,7 @@
/// Compare traces with reference ones
void CheckResults ();
/// Go
- bool DoRun ();
+ void DoRun ();
};
}
--- a/src/routing/olsr/test/tc-regression-test.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/olsr/test/tc-regression-test.cc Mon Jan 17 12:53:20 2011 -0800
@@ -56,7 +56,7 @@
{
}
-bool
+void
TcRegressionTest::DoRun ()
{
SeedManager::SetSeed(12345);
@@ -67,7 +67,6 @@
Simulator::Destroy ();
if (!WRITE_VECTORS) CheckResults ();
- return GetErrorStatus ();
}
void
--- a/src/routing/olsr/test/tc-regression-test.h Mon Jan 10 15:55:29 2011 -0800
+++ b/src/routing/olsr/test/tc-regression-test.h Mon Jan 17 12:53:20 2011 -0800
@@ -88,7 +88,7 @@
/// Compare traces with reference ones
void CheckResults ();
/// Go
- bool DoRun ();
+ void DoRun ();
};
}
--- a/src/simulator/high-precision-128.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/simulator/high-precision-128.cc Mon Jan 17 12:53:20 2011 -0800
@@ -290,7 +290,7 @@
{
public:
HpFracTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void CheckFrac (int64_t hi, uint64_t lo);
};
@@ -308,14 +308,13 @@
: TestCase ("Check that we can manipulate the high and low part of every number")
{
}
-bool
+void
HpFracTestCase::DoRun (void)
{
CheckFrac (1, 0);
CheckFrac (1, 1);
CheckFrac (-1, 0);
CheckFrac (-1, 1);
- return GetErrorStatus ();
}
@@ -323,7 +322,7 @@
{
public:
HpInputTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void CheckString (std::string str, int64_t hi, uint64_t lo);
};
HpInputTestCase::HpInputTestCase ()
@@ -340,7 +339,7 @@
NS_TEST_EXPECT_MSG_EQ (hp.GetHigh (), hi, "High parts do not match for input string " << str);
NS_TEST_EXPECT_MSG_EQ (hp.GetLow (), lo, "Low parts do not match for input string " << str);
}
-bool
+void
HpInputTestCase::DoRun (void)
{
CheckString ("1", 1, 0);
@@ -357,15 +356,13 @@
CheckString ("1.0000000", 1, 0);
CheckString ("1.08446744073709551615", 1, 8446744073709551615LL);
CheckString ("-1.08446744073709551615", -1, 8446744073709551615LL);
-
- return GetErrorStatus ();
}
class HpInputOutputTestCase : public TestCase
{
public:
HpInputOutputTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void CheckString (std::string str);
};
HpInputOutputTestCase::HpInputOutputTestCase ()
@@ -383,7 +380,7 @@
oss << hp;
NS_TEST_EXPECT_MSG_EQ (oss.str (), str, "Converted string does not match expected string");
}
-bool
+void
HpInputOutputTestCase::DoRun (void)
{
CheckString ("+1.0");
@@ -393,8 +390,6 @@
CheckString ("-1.08446744073709551615");
CheckString ("+1.18446744073709551615");
CheckString ("-1.18446744073709551615");
-
- return GetErrorStatus ();
}
--- a/src/simulator/high-precision.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/simulator/high-precision.cc Mon Jan 17 12:53:20 2011 -0800
@@ -55,14 +55,14 @@
{
public:
HpArithmeticTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
HpArithmeticTestCase::HpArithmeticTestCase ()
: TestCase ("Check basic arithmetic operations")
{
}
-bool
+void
HpArithmeticTestCase::DoRun (void)
{
HighPrecision a, b;
@@ -171,22 +171,20 @@
a.Div (V (3));
a.Mul (V (3));
CHECK_EXPECTED (a, 1999999999);
-
- return GetErrorStatus ();
}
class HpBug455TestCase : public TestCase
{
public:
HpBug455TestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
HpBug455TestCase::HpBug455TestCase ()
: TestCase ("Test case for bug 455")
{
}
-bool
+void
HpBug455TestCase::DoRun (void)
{
HighPrecision a = HighPrecision (0.1);
@@ -204,8 +202,6 @@
a = HighPrecision (0.5);
a.Mul (HighPrecision (-5));
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), -2.5, "only second operand negative");
-
- return GetErrorStatus ();
}
@@ -213,14 +209,14 @@
{
public:
HpBug863TestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
HpBug863TestCase::HpBug863TestCase ()
: TestCase ("Test case for bug 863")
{
}
-bool
+void
HpBug863TestCase::DoRun (void)
{
HighPrecision a = HighPrecision (0.9);
@@ -239,22 +235,20 @@
a = HighPrecision (-0.5);
a.Div (HighPrecision (-0.5));
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), 1.0, "both arguments negative");
-
- return GetErrorStatus ();
}
class HpCompareTestCase : public TestCase
{
public:
HpCompareTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
HpCompareTestCase::HpCompareTestCase ()
: TestCase ("Check basic compare operations")
{
}
-bool
+void
HpCompareTestCase::DoRun (void)
{
HighPrecision a, b;
@@ -278,15 +272,13 @@
a = V (1);
b = V (1);
NS_TEST_ASSERT_MSG_EQ (a.Compare (b), 0, "a is equal to b");
-
- return GetErrorStatus ();
}
class HpInvertTestCase : public TestCase
{
public:
HpInvertTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
HpInvertTestCase::HpInvertTestCase ()
@@ -294,7 +286,7 @@
{
}
-bool
+void
HpInvertTestCase::DoRun (void)
{
#define TEST(factor) \
@@ -342,7 +334,6 @@
TEST(100000000000000LL);
TEST(1000000000000000LL);
#undef TEST
- return GetErrorStatus ();
}
--- a/src/simulator/simulator.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/simulator/simulator.cc Mon Jan 17 12:53:20 2011 -0800
@@ -393,7 +393,7 @@
{
public:
SimulatorEventsTestCase (ObjectFactory schedulerFactory);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void A (int a);
void B (int b);
void C (int c);
@@ -475,7 +475,7 @@
m_destroy = true;
}
}
-bool
+void
SimulatorEventsTestCase::DoRun (void)
{
m_a = true;
@@ -528,8 +528,6 @@
Simulator::Destroy ();
NS_TEST_EXPECT_MSG_EQ (m_destroyId.IsExpired (), true, "Event should have expired now");
NS_TEST_EXPECT_MSG_EQ (m_destroy, true, "Event should have run");
-
- return false;
}
class SimulatorTemplateTestCase : public TestCase
@@ -540,7 +538,7 @@
void Ref (void) const {}
void Unref (void) const {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void bar0 (void) {}
void bar1 (int) {}
@@ -614,7 +612,7 @@
SimulatorTemplateTestCase::SimulatorTemplateTestCase ()
: TestCase ("Check that all templates are instanciated correctly. This is a compilation test, it cannot fail at runtime.")
{}
-bool
+void
SimulatorTemplateTestCase::DoRun (void)
{
// Test schedule of const methods
@@ -820,8 +818,6 @@
Simulator::Run ();
Simulator::Destroy ();
-
- return false;
}
class SimulatorTestSuite : public TestSuite
--- a/src/simulator/time.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/simulator/time.cc Mon Jan 17 12:53:20 2011 -0800
@@ -198,7 +198,7 @@
{
public:
Bug863TestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
Bug863TestCase::Bug863TestCase ()
@@ -206,11 +206,10 @@
{
}
-bool Bug863TestCase::DoRun (void)
+void Bug863TestCase::DoRun (void)
{
Scalar result = Scalar (0.9) / Scalar (1.0);
NS_TEST_ASSERT_MSG_EQ ((result == Scalar (0.9)), true, "Invalid arithmetic result");
- return false;
}
class TimeSimpleTestCase : public TestCase
@@ -218,7 +217,7 @@
public:
TimeSimpleTestCase (enum Time::Unit resolution);
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTearDown (void);
enum Time::Unit m_originalResolution;
enum Time::Unit m_resolution;
@@ -228,7 +227,7 @@
: TestCase ("Sanity check of common time operations"),
m_resolution (resolution)
{}
-bool
+void
TimeSimpleTestCase::DoRun (void)
{
m_originalResolution = Time::GetResolution ();
@@ -251,7 +250,6 @@
NS_TEST_ASSERT_MSG_EQ (FemtoSeconds (1).GetFemtoSeconds (), 1,
"is 1fs really 1fs ?");
#endif
- return false;
}
void
@@ -265,14 +263,14 @@
public:
ArithTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
ArithTestCase::ArithTestCase ()
: TestCase ("check arithmetic operators")
{
}
-bool
+void
ArithTestCase::DoRun (void)
{
Time a, b, c;
@@ -293,7 +291,6 @@
x = a != b;
//a = 1.0;
//a = 1;
- return false;
}
--- a/src/simulator/timer.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/simulator/timer.cc Mon Jan 17 12:53:20 2011 -0800
@@ -213,14 +213,14 @@
{
public:
TimerStateTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
TimerStateTestCase::TimerStateTestCase ()
: TestCase ("Check correct state transitions")
{
}
-bool
+void
TimerStateTestCase::DoRun (void)
{
Timer timer = Timer (Timer::CANCEL_ON_DESTROY);
@@ -252,14 +252,13 @@
NS_TEST_ASSERT_MSG_EQ (timer.IsExpired (), true, "");
NS_TEST_ASSERT_MSG_EQ (!timer.IsSuspended (), true, "");
NS_TEST_ASSERT_MSG_EQ (timer.GetState (), Timer::EXPIRED, "");
- return false;
}
class TimerTemplateTestCase : public TestCase
{
public:
TimerTemplateTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
void bazi (int)
{
@@ -298,7 +297,7 @@
{
}
-bool
+void
TimerTemplateTestCase::DoRun (void)
{
Timer timer = Timer (Timer::CANCEL_ON_DESTROY);
@@ -361,8 +360,6 @@
Simulator::Run ();
Simulator::Destroy ();
-
- return false;
}
void
--- a/src/simulator/watchdog.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/simulator/watchdog.cc Mon Jan 17 12:53:20 2011 -0800
@@ -67,7 +67,7 @@
{
public:
WatchdogTestCase ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void Expire (Time expected);
bool m_expired;
Time m_expiredTime;
@@ -86,7 +86,7 @@
m_expiredArgument = expected;
}
-bool
+void
WatchdogTestCase::DoRun (void)
{
m_expired = false;
@@ -104,8 +104,6 @@
NS_TEST_ASSERT_MSG_EQ (m_expired, true, "The timer did not expire ??");
NS_TEST_ASSERT_MSG_EQ (m_expiredTime, MicroSeconds (40), "The timer did not expire at the expected time ?");
NS_TEST_ASSERT_MSG_EQ (m_expiredArgument, MicroSeconds (40), "We did not get the right argument");
-
- return false;
}
--- a/src/test/csma-system-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/test/csma-system-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -58,7 +58,7 @@
virtual ~CsmaBridgeTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void SinkRx (Ptr<const Packet> p, const Address &ad);
uint32_t m_count;
};
@@ -91,7 +91,7 @@
//
// - CBR/UDP test flow from n0 to n1; test that packets received on n1
//
-bool
+void
CsmaBridgeTestCase::DoRun (void)
{
NodeContainer terminals;
@@ -155,8 +155,6 @@
// We should have sent and received 10 packets
NS_TEST_ASSERT_MSG_EQ (m_count, 10, "Bridge should have passed 10 packets");
-
- return GetErrorStatus ();
}
class CsmaBroadcastTestCase : public TestCase
@@ -166,7 +164,7 @@
virtual ~CsmaBroadcastTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void SinkRxNode1 (Ptr<const Packet> p, const Address &ad);
void SinkRxNode2 (Ptr<const Packet> p, const Address &ad);
void DropEvent (Ptr<const Packet> p);
@@ -216,7 +214,7 @@
// n0 originates UDP broadcast to 255.255.255.255/discard port, which
// is replicated and received on both n1 and n2
//
-bool
+void
CsmaBroadcastTestCase::DoRun (void)
{
NodeContainer c;
@@ -279,8 +277,6 @@
// We should have sent and received 10 packets
NS_TEST_ASSERT_MSG_EQ (m_countNode1, 10, "Node 1 should have received 10 packets");
NS_TEST_ASSERT_MSG_EQ (m_countNode2, 10, "Node 2 should have received 10 packets");
-
- return GetErrorStatus ();
}
class CsmaMulticastTestCase : public TestCase
@@ -290,7 +286,7 @@
virtual ~CsmaMulticastTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void SinkRx (Ptr<const Packet> p, const Address &ad);
void DropEvent (Ptr<const Packet> p);
uint32_t m_count;
@@ -334,7 +330,7 @@
// - Nodes n0, n1, n2, n3, and n4 receive the multicast frame.
// - Node n4 listens for the data
//
-bool
+void
CsmaMulticastTestCase::DoRun (void)
{
//
@@ -443,8 +439,6 @@
// We should have sent and received 10 packets
NS_TEST_ASSERT_MSG_EQ (m_count, 10, "Node 4 should have received 10 packets");
-
- return GetErrorStatus ();
}
class CsmaOneSubnetTestCase : public TestCase
@@ -454,7 +448,7 @@
virtual ~CsmaOneSubnetTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void SinkRxNode0 (Ptr<const Packet> p, const Address &ad);
void SinkRxNode1 (Ptr<const Packet> p, const Address &ad);
void DropEvent (Ptr<const Packet> p);
@@ -501,7 +495,7 @@
// - CBR/UDP flows from n0 to n1 and from n3 to n0
// - DropTail queues
//
-bool
+void
CsmaOneSubnetTestCase::DoRun (void)
{
NodeContainer nodes;
@@ -575,8 +569,6 @@
// We should have sent and received 10 packets
NS_TEST_ASSERT_MSG_EQ (m_countNode0, 10, "Node 0 should have received 10 packets");
NS_TEST_ASSERT_MSG_EQ (m_countNode1, 10, "Node 1 should have received 10 packets");
-
- return GetErrorStatus ();
}
class CsmaPacketSocketTestCase : public TestCase
@@ -586,7 +578,7 @@
virtual ~CsmaPacketSocketTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void SinkRx (std::string path, Ptr<const Packet> p, const Address &address);
void DropEvent (Ptr<const Packet> p);
uint32_t m_count;
@@ -626,7 +618,7 @@
// -- We will test reception at node n0
// - Default 512 byte packets generated by traffic generator
//
-bool
+void
CsmaPacketSocketTestCase::DoRun (void)
{
// Here, we will explicitly create four nodes.
@@ -686,8 +678,6 @@
// We should have received 10 packets on node 0
NS_TEST_ASSERT_MSG_EQ (m_count, 10, "Node 0 should have received 10 packets");
-
- return GetErrorStatus ();
}
class CsmaPingTestCase : public TestCase
@@ -697,7 +687,7 @@
virtual ~CsmaPingTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void SinkRx (Ptr<const Packet> p, const Address &ad);
void PingRtt (std::string context, Time rtt);
void DropEvent (Ptr<const Packet> p);
@@ -743,7 +733,7 @@
// node n0,n1,n3 pings to node n2
// node n0 generates protocol 2 (IGMP) to node n3
//
-bool
+void
CsmaPingTestCase::DoRun (void)
{
// Here, we will explicitly create four nodes.
@@ -811,8 +801,6 @@
// We should have 3 pingers that ping every second for 3 seconds.
NS_TEST_ASSERT_MSG_EQ (m_countPingRtt, 9, "Node 2 should have been pinged 9 times");
-
- return GetErrorStatus ();
}
class CsmaRawIpSocketTestCase : public TestCase
@@ -822,7 +810,7 @@
virtual ~CsmaRawIpSocketTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void SinkRx (Ptr<const Packet> p, const Address &ad);
void DropEvent (Ptr<const Packet> p);
uint32_t m_count;
@@ -861,7 +849,7 @@
// Node n0 sends data to node n3 over a raw IP socket. The protocol
// number used is 2.
//
-bool
+void
CsmaRawIpSocketTestCase::DoRun (void)
{
// Here, we will explicitly create four nodes.
@@ -913,8 +901,6 @@
// We should have sent and received 10 packets
NS_TEST_ASSERT_MSG_EQ (m_count, 10, "Node 3 should have received 10 packets");
-
- return GetErrorStatus ();
}
class CsmaStarTestCase : public TestCase
@@ -924,7 +910,7 @@
virtual ~CsmaStarTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void SinkRx (Ptr<const Packet> p, const Address &ad);
void DropEvent (Ptr<const Packet> p);
uint32_t m_count;
@@ -970,7 +956,7 @@
// ======= ======= .
// CSMA CSMA .
//
-bool
+void
CsmaStarTestCase::DoRun (void)
{
//
@@ -1099,8 +1085,6 @@
// The hub node should have received 10 packets from the nFill + 1
// nodes on each spoke.
NS_TEST_ASSERT_MSG_EQ (m_count, 10 * ( nSpokes * (nFill + 1)), "Hub node did not receive the proper number of packets");
-
- return GetErrorStatus ();
}
class CsmaSystemTestSuite : public TestSuite
--- a/src/test/error-model-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/test/error-model-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -45,7 +45,7 @@
virtual ~ErrorModelSimple ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
bool Receive (Ptr<NetDevice> nd, Ptr<const Packet> p, uint16_t protocol, const Address& addr);
void DropEvent (Ptr<const Packet> p);
uint32_t m_count;
@@ -75,10 +75,9 @@
m_drops++;
}
-bool
+void
ErrorModelSimple::DoRun (void)
{
- bool retval = false;
// Set some arbitrary deterministic values
SeedManager::SetSeed (7);
SeedManager::SetRun (5);
@@ -109,11 +108,8 @@
// For this combination of values, we expect about 1 packet in 1000 to be
// dropped. For this specific RNG stream, we see 9992 receptions and 8 drops
- if (m_count != 9992 || m_drops != 8)
- {
- retval = true;
- }
- return retval;
+ NS_TEST_ASSERT_MSG_EQ (m_count, 9992, "Wrong number of receptions.");
+ NS_TEST_ASSERT_MSG_EQ (m_drops, 8, "Wrong number of drops.");
}
// This is the start of an error model test suite. For starters, this is
--- a/src/test/global-routing-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/test/global-routing-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -55,7 +55,7 @@
private:
void SinkRx (std::string path, Ptr<const Packet> p, const Address &address);
void HandleRead (Ptr<Socket>);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
int m_count;
std::vector<uint8_t> m_firstInterface;
std::vector<uint8_t> m_secondInterface;
@@ -137,7 +137,7 @@
// times (1-2), (4-6), (8-10), (11-12), (14-16) and the interface
// facing n1 receives packets at times (2-4), (6-8), (12-13)
//
-bool
+void
DynamicGlobalRoutingTestCase::DoRun (void)
{
// The below value configures the default behavior of global routing.
@@ -278,8 +278,6 @@
NS_TEST_ASSERT_MSG_EQ (m_firstInterface[14], 5, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_firstInterface[15], 5, "Dynamic global routing did not deliver all packets");
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
class GlobalRoutingSlash32TestCase : public TestCase
@@ -289,7 +287,7 @@
virtual ~GlobalRoutingSlash32TestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
// Add some help text to this case to describe what it is intended to test
@@ -306,7 +304,7 @@
//
// (a.a.a.a/32)A<--x.x.x.0/30-->B<--y.y.y.0/30-->C(c.c.c.c/32)
//
-bool
+void
GlobalRoutingSlash32TestCase::DoRun (void)
{
Ptr<Node> nA = CreateObject<Node> ();
@@ -390,8 +388,6 @@
Ptr<PacketSink> sinkPtr = DynamicCast <PacketSink> (apps.Get (0));
NS_TEST_ASSERT_MSG_EQ (sinkPtr->GetTotalRx (), 6656, "Static routing with /32 did not deliver all packets");
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
--- a/src/test/mobility-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/test/mobility-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -45,7 +45,7 @@
private:
void TestXPosition (double expectedXPos);
void CourseChangeCallback (std::string path, Ptr<const MobilityModel> model);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
Ptr<Node> m_node;
Ptr<WaypointMobilityModel> m_mob;
int m_courseChanges;
@@ -76,7 +76,7 @@
m_courseChanges++;
}
-bool
+void
WaypointLazyNotifyFalse::DoRun (void)
{
m_node = CreateObject<Node> ();
@@ -93,7 +93,6 @@
Simulator::Schedule (Seconds (5.0), &WaypointLazyNotifyFalse::TestXPosition, this, 5);
Simulator::Run ();
Simulator::Destroy ();
- return GetErrorStatus ();
}
class WaypointLazyNotifyTrue : public TestCase
@@ -105,7 +104,7 @@
private:
void TestXPosition (double expectedXPos);
void CourseChangeCallback (std::string path, Ptr<const MobilityModel> model);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
Ptr<Node> m_node;
Ptr<WaypointMobilityModel> m_mob;
};
@@ -134,7 +133,7 @@
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (15, Simulator::Now ().GetSeconds (), 0.001, "Course change not notified correctly", __FILE__, __LINE__);
}
-bool
+void
WaypointLazyNotifyTrue::DoRun (void)
{
m_node = CreateObject<Node> ();
@@ -151,7 +150,6 @@
Simulator::Schedule (Seconds (15.0), &WaypointLazyNotifyTrue::TestXPosition, this, 15);
Simulator::Run ();
Simulator::Destroy ();
- return GetErrorStatus ();
}
class WaypointInitialPositionIsWaypoint : public TestCase
@@ -163,7 +161,7 @@
private:
void TestXPosition (Ptr<const WaypointMobilityModel> model, double expectedXPos);
void TestNumWaypoints (Ptr<const WaypointMobilityModel> model, uint32_t num);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
Ptr<WaypointMobilityModel> m_mob1;
Ptr<WaypointMobilityModel> m_mob2;
Ptr<WaypointMobilityModel> m_mob3;
@@ -193,7 +191,7 @@
NS_TEST_EXPECT_MSG_EQ (model->WaypointsLeft (), num, "Unexpected number of waypoints left");
}
-bool
+void
WaypointInitialPositionIsWaypoint::DoRun (void)
{
// Case 1: InitialPositionIsWaypoint == false, and we call SetPosition
@@ -276,7 +274,6 @@
Simulator::Run ();
Simulator::Destroy ();
- return GetErrorStatus ();
}
class WaypointMobilityModelViaHelper : public TestCase
@@ -287,7 +284,7 @@
private:
void TestXPosition (Ptr<const WaypointMobilityModel> mob, double expectedXPos);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
WaypointMobilityModelViaHelper::WaypointMobilityModelViaHelper ()
@@ -307,7 +304,7 @@
}
// WaypointMobilityModel tests using the helper
-bool
+void
WaypointMobilityModelViaHelper::DoRun (void)
{
NodeContainer c;
@@ -355,7 +352,6 @@
Simulator::Run ();
Simulator::Destroy ();
- return GetErrorStatus ();
}
class MobilityTestSuite : public TestSuite
--- a/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -180,7 +180,7 @@
virtual ~Ns3TcpCwndTestCase1 ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
bool m_writeResults;
class CwndEvent {
@@ -215,7 +215,7 @@
m_responses.Add (event);
}
-bool
+void
Ns3TcpCwndTestCase1::DoRun (void)
{
//
@@ -359,8 +359,6 @@
NS_TEST_ASSERT_MSG_EQ (event.m_oldCwnd, from, "Wrong old cwnd value in cwnd change event " << i);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, to, "Wrong new cwnd value in cwnd change event " << i);
}
-
- return GetErrorStatus ();
}
@@ -385,7 +383,7 @@
virtual ~Ns3TcpCwndTestCase2 ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
bool m_writeResults;
class CwndEvent {
@@ -420,7 +418,7 @@
m_responses.Add (event);
}
-bool
+void
Ns3TcpCwndTestCase2::DoRun (void)
{
// Set up some default values for the simulation.
@@ -558,8 +556,6 @@
// Fast retransmit again; cwnd should be back to 8*MSS
event = m_responses.Get (42);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, 8*MSS, "Wrong new cwnd value in cwnd change event " << 42);
-
- return GetErrorStatus ();
}
class Ns3TcpCwndTestSuite : public TestSuite
@@ -575,4 +571,4 @@
AddTestCase (new Ns3TcpCwndTestCase2);
}
-static Ns3TcpCwndTestSuite ns3TcpCwndTestSuite;
+Ns3TcpCwndTestSuite ns3TcpCwndTestSuite;
--- a/src/test/ns3tcp/ns3tcp-interop-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/test/ns3tcp/ns3tcp-interop-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -84,7 +84,7 @@
private:
virtual void DoSetup (void);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
void Ipv4L3Tx (std::string context, Ptr<const Packet> packet, Ptr<Ipv4> ipv4, uint32_t interface);
@@ -191,7 +191,7 @@
}
}
-bool
+void
Ns3TcpInteroperabilityTestCase::DoRun (void)
{
//
@@ -297,8 +297,6 @@
Simulator::Stop (Seconds(20));
Simulator::Run ();
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
class Ns3TcpInteroperabilityTestSuite : public TestSuite
--- a/src/test/ns3tcp/ns3tcp-loss-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/test/ns3tcp/ns3tcp-loss-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -58,7 +58,7 @@
private:
virtual void DoSetup (void);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
std::string m_pcapFilename;
@@ -165,7 +165,7 @@
}
}
-bool
+void
Ns3TcpLossTestCase1::DoRun (void)
{
uint16_t sinkPort = 50000;
@@ -232,8 +232,6 @@
Simulator::Stop (simStopTimeObj);
Simulator::Run ();
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
class Ns3TcpLossTestCase2 : public TestCase
@@ -244,7 +242,7 @@
private:
virtual void DoSetup (void);
- virtual bool DoRun (void);
+ virtual void DoRun (void);
virtual void DoTeardown (void);
std::string m_pcapFilename;
@@ -348,7 +346,7 @@
}
}
-bool
+void
Ns3TcpLossTestCase2::DoRun (void)
{
uint16_t sinkPort = 50000;
@@ -414,8 +412,6 @@
Simulator::Stop (simStopTimeObj);
Simulator::Run ();
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
class Ns3TcpLossTestSuite : public TestSuite
--- a/src/test/ns3tcp/ns3tcp-socket-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/test/ns3tcp/ns3tcp-socket-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -52,7 +52,7 @@
virtual ~Ns3TcpSocketTestCase1 () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
bool m_writeResults;
void SinkRx (std::string path, Ptr<const Packet> p, const Address &address);
@@ -73,7 +73,7 @@
m_responses.Add (p->GetSize ());
}
-bool
+void
Ns3TcpSocketTestCase1::DoRun (void)
{
uint16_t sinkPort = 50000;
@@ -148,8 +148,6 @@
uint32_t out = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (in, out, "Mismatch: expected " << in << " bytes, got " << out << " bytes");
}
-
- return GetErrorStatus ();
}
class Ns3TcpSocketTestCase2 : public TestCase
@@ -159,7 +157,7 @@
virtual ~Ns3TcpSocketTestCase2 () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
bool m_writeResults;
void SinkRx (std::string path, Ptr<const Packet> p, const Address &address);
@@ -180,7 +178,7 @@
m_responses.Add (p->GetSize ());
}
-bool
+void
Ns3TcpSocketTestCase2::DoRun (void)
{
uint16_t sinkPort = 50000;
@@ -262,8 +260,6 @@
uint32_t out = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (in, out, "Mismatch: expected " << in << " bytes, got " << out << " bytes");
}
-
- return GetErrorStatus ();
}
class Ns3TcpSocketTestSuite : public TestSuite
--- a/src/test/ns3wifi/wifi-interference-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/test/ns3wifi/wifi-interference-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -56,7 +56,7 @@
virtual ~WifiInterferenceTestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
void ReceivePacket (Ptr<Socket> socket);
static void GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval);
void PrintEndSync (std::string context, uint32_t dataRate, double snr, double per);
@@ -226,7 +226,7 @@
return m_PER;
}
-bool
+void
WifiInterferenceTestCase::DoRun (void)
{
@@ -261,8 +261,6 @@
NS_TEST_ASSERT_MSG_EQ (PERDiff1, PERDiff2,
"The PER difference due to 1 microsecond difference in arrival shouldn't depend on absolute arrival");
-
- return false;
}
class WifiInterferenceTestSuite : public TestSuite
--- a/src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -47,7 +47,7 @@
{
public:
WifiMsduAggregatorThroughputTest ();
- virtual bool DoRun (void);
+ virtual void DoRun (void);
private:
bool m_writeResults;
@@ -59,7 +59,7 @@
{
}
-bool
+void
WifiMsduAggregatorThroughputTest::DoRun (void)
{
WifiHelper wifi = WifiHelper::Default ();
@@ -188,8 +188,6 @@
NS_TEST_ASSERT_MSG_GT(totalOctetsThrough, 600000,
"A-MSDU test fails for low throughput of "
<< totalOctetsThrough << " octets");
-
- return false;
}
--- a/src/test/nsctcp/nsctcp-loss-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/test/nsctcp/nsctcp-loss-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -54,7 +54,7 @@
virtual ~NscTcpLossTestCase1 () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
bool m_writeResults;
void SinkRx (std::string path, Ptr<const Packet> p, const Address &address);
@@ -75,7 +75,7 @@
m_responses.Add (p->GetSize ());
}
-bool
+void
NscTcpLossTestCase1::DoRun (void)
{
uint16_t sinkPort = 50000;
@@ -153,8 +153,6 @@
uint32_t out = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (in, out, "Mismatch: expected " << in << " bytes, got " << out << " bytes");
}
-
- return GetErrorStatus ();
}
class NscTcpLossTestCase2 : public TestCase
@@ -164,7 +162,7 @@
virtual ~NscTcpLossTestCase2 () {}
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
bool m_writeResults;
void SinkRx (std::string path, Ptr<const Packet> p, const Address &address);
@@ -185,7 +183,7 @@
m_responses.Add (p->GetSize ());
}
-bool
+void
NscTcpLossTestCase2::DoRun (void)
{
uint16_t sinkPort = 50000;
@@ -262,8 +260,6 @@
uint32_t out = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (in, out, "Mismatch: expected " << in << " bytes, got " << out << " bytes");
}
-
- return GetErrorStatus ();
}
class NscTcpLossTestSuite : public TestSuite
--- a/src/test/sample-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/test/sample-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -15,7 +15,7 @@
virtual ~SampleTestCase1 ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
// Add some help text to this case to describe what it is intended to test
@@ -34,16 +34,13 @@
// This method is the pure virtual method from class TestCase that every
// TestCase must implement
//
-bool
+void
SampleTestCase1::DoRun (void)
{
// A wide variety of test macros are available in src/core/test.h
NS_TEST_ASSERT_MSG_EQ (true, true, "true doesn't equal true for some reason");
// Use this one for floating point comparisons
NS_TEST_ASSERT_MSG_EQ_TOL (0.01, 0.01, 0.001, "Numbers are not equal within tolerance");
-
- // Return false if an error has _not_ occurred
- return false;
}
// The TestSuite class names the TestSuite, identifies what type of TestSuite,
--- a/src/test/static-routing-test-suite.cc Mon Jan 10 15:55:29 2011 -0800
+++ b/src/test/static-routing-test-suite.cc Mon Jan 17 12:53:20 2011 -0800
@@ -49,7 +49,7 @@
virtual ~StaticRoutingSlash32TestCase ();
private:
- virtual bool DoRun (void);
+ virtual void DoRun (void);
};
// Add some help text to this case to describe what it is intended to test
@@ -66,7 +66,7 @@
//
// (a.a.a.a/32)A<--x.x.x.0/30-->B<--y.y.y.0/30-->C(c.c.c.c/32)
//
-bool
+void
StaticRoutingSlash32TestCase::DoRun (void)
{
Ptr<Node> nA = CreateObject<Node> ();
@@ -155,8 +155,6 @@
Ptr<PacketSink> sinkPtr = DynamicCast <PacketSink> (apps.Get (0));
NS_TEST_ASSERT_MSG_EQ (sinkPtr->GetTotalRx (), 6656, "Static routing with /32 did not deliver all packets");
Simulator::Destroy ();
-
- return GetErrorStatus ();
}
class StaticRoutingTestSuite : public TestSuite