diff --git a/CHANGES.html b/CHANGES.html index 88ce89915..a73b6b11b 100644 --- a/CHANGES.html +++ b/CHANGES.html @@ -43,6 +43,28 @@ the cracks, unfortunately. If you, as a user, can suggest improvements to this file based on your experience, please contribute a patch or drop us a note on ns-developers mailing list.

+
+

Changes from ns-3.10 to ns-3.11

+ +

Changes to build system:

+ + +

New API:

+ + +

Changes to existing API:

+ + +

Changed behavior:

+ +

Changes from ns-3.9 to ns-3.10

diff --git a/doc/testing/source/testing-framework.rst b/doc/testing/source/testing-framework.rst index 687070aef..76005ce6c 100644 --- a/doc/testing/source/testing-framework.rst +++ b/doc/testing/source/testing-framework.rst @@ -654,7 +654,7 @@ case a name and override the ``DoRun`` method to run the test. class MyTestCase : public TestCase { MyTestCase (); - virtual bool DoRun (void); + virtual void DoRun (void); }; MyTestCase::MyTestCase () @@ -662,11 +662,10 @@ case a name and override the ``DoRun`` method to run the test. { } - bool + void MyTestCase::DoRun (void) { NS_TEST_ASSERT_MSG_EQ (true, true, "Some failure message"); - return GetErrorStatus (); } Utilities diff --git a/src/applications/udp-client-server/udp-client-server-test.cc b/src/applications/udp-client-server/udp-client-server-test.cc index b875ccec6..8bb6cde48 100644 --- a/src/applications/udp-client-server/udp-client-server-test.cc +++ b/src/applications/udp-client-server/udp-client-server-test.cc @@ -48,7 +48,7 @@ public: virtual ~UdpClientServerTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -61,7 +61,7 @@ UdpClientServerTestCase::~UdpClientServerTestCase () { } -bool UdpClientServerTestCase::DoRun (void) +void UdpClientServerTestCase::DoRun (void) { NodeContainer n; n.Create (2); @@ -102,8 +102,6 @@ bool UdpClientServerTestCase::DoRun (void) 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 @@ public: virtual ~UdpTraceClientServerTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -131,7 +129,7 @@ UdpTraceClientServerTestCase::~UdpTraceClientServerTestCase () { } -bool UdpTraceClientServerTestCase::DoRun (void) +void UdpTraceClientServerTestCase::DoRun (void) { NodeContainer n; n.Create (2); @@ -167,8 +165,6 @@ bool UdpTraceClientServerTestCase::DoRun (void) 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 @@ public: virtual ~PacketLossCounterTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -196,7 +192,7 @@ PacketLossCounterTestCase::~PacketLossCounterTestCase () { } -bool PacketLossCounterTestCase::DoRun (void) +void PacketLossCounterTestCase::DoRun (void) { PacketLossCounter lossCounter(32); lossCounter.NotifyReceived(32); //out of order @@ -245,9 +241,6 @@ bool PacketLossCounterTestCase::DoRun (void) 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 { diff --git a/src/common/buffer-test.cc b/src/common/buffer-test.cc index cfc45ecd3..80743876d 100644 --- a/src/common/buffer-test.cc +++ b/src/common/buffer-test.cc @@ -11,7 +11,7 @@ class BufferTest : public TestCase { 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 @@ BufferTest::EnsureWrittenBytes (Buffer b, uint32_t n, uint8_t array[]) } \ } -bool +void BufferTest::DoRun (void) { Buffer buffer; @@ -317,8 +317,6 @@ BufferTest::DoRun (void) 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 diff --git a/src/common/packet-metadata-test.cc b/src/common/packet-metadata-test.cc index 491ddded5..9c9d03a68 100644 --- a/src/common/packet-metadata-test.cc +++ b/src/common/packet-metadata-test.cc @@ -253,7 +253,7 @@ public: PacketMetadataTest (); virtual ~PacketMetadataTest (); bool CheckHistory (Ptr p, const char *file, int line, uint32_t n, ...); - virtual bool DoRun (void); + virtual void DoRun (void); private: Ptr DoAddHeader (Ptr p); }; @@ -400,7 +400,7 @@ PacketMetadataTest::DoAddHeader (Ptr p) return p; } -bool +void PacketMetadataTest::DoRun (void) { bool result = true; @@ -774,8 +774,6 @@ PacketMetadataTest::DoRun (void) CHECK_HISTORY (p, 1, 500); p->RemoveAtStart (10); CHECK_HISTORY (p, 1, 490); - - return !result; } //----------------------------------------------------------------------------- class PacketMetadataTestSuite : public TestSuite diff --git a/src/common/packet.cc b/src/common/packet.cc index 92bf86477..c40a5453e 100644 --- a/src/common/packet.cc +++ b/src/common/packet.cc @@ -1079,7 +1079,7 @@ class PacketTest : public TestCase { public: PacketTest (); - virtual bool DoRun (void); + virtual void DoRun (void); private: void DoCheck (Ptr p, const char *file, int line, uint32_t n, ...); }; @@ -1126,7 +1126,7 @@ PacketTest::DoCheck (Ptr p, const char *file, int line, uint32_t n NS_TEST_EXPECT_MSG_EQ (j, expected.size (), "Size match"); } -bool +void PacketTest::DoRun (void) { Ptr pkt1 = Create (reinterpret_cast ("hello"), 5); @@ -1307,8 +1307,6 @@ PacketTest::DoRun (void) CHECK (tmp, 1, E (20, 1, 1001)); #endif } - - return GetErrorStatus (); } //----------------------------------------------------------------------------- class PacketTestSuite : public TestSuite diff --git a/src/common/pcap-file-test-suite.cc b/src/common/pcap-file-test-suite.cc index b6f690a6d..b483cc6b4 100644 --- a/src/common/pcap-file-test-suite.cc +++ b/src/common/pcap-file-test-suite.cc @@ -86,7 +86,7 @@ public: 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 @@ WriteModeCreateTestCase::DoTeardown (void) remove (m_testFilename.c_str ()); } -bool +void WriteModeCreateTestCase::DoRun (void) { PcapFile f; @@ -184,8 +184,6 @@ WriteModeCreateTestCase::DoRun (void) 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 @@ public: 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 @@ ReadModeCreateTestCase::DoTeardown (void) remove (m_testFilename.c_str ()); } -bool +void ReadModeCreateTestCase::DoRun (void) { PcapFile f; @@ -291,8 +289,6 @@ ReadModeCreateTestCase::DoRun (void) ") does not return error"); f.Close (); f.Clear (); - - return false; } #if 0 @@ -308,7 +304,7 @@ public: 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 @@ AppendModeCreateTestCase::DoTeardown (void) remove (m_testFilename.c_str ()); } -bool +void AppendModeCreateTestCase::DoRun (void) { PcapFile f; @@ -399,8 +395,6 @@ AppendModeCreateTestCase::DoRun (void) 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 @@ public: 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 @@ FileHeaderTestCase::DoTeardown (void) remove (m_testFilename.c_str ()); } -bool +void FileHeaderTestCase::DoRun (void) { PcapFile f; @@ -639,8 +633,6 @@ FileHeaderTestCase::DoRun (void) NS_TEST_ASSERT_MSG_EQ (f.GetDataLinkType (), 1234, "Read back data link type incorrectly"); f.Close (); - - return false; } // =========================================================================== @@ -655,7 +647,7 @@ public: 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 @@ RecordHeaderTestCase::DoTeardown (void) remove (m_testFilename.c_str ()); } -bool +void RecordHeaderTestCase::DoRun (void) { PcapFile f; @@ -943,8 +935,6 @@ RecordHeaderTestCase::DoRun (void) } f.Close (); - - return false; } // =========================================================================== @@ -959,7 +949,7 @@ public: 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 @@ PacketEntry knownPackets[] = { }; -bool +void ReadFileTestCase::DoRun (void) { PcapFile f; @@ -1055,8 +1045,6 @@ ReadFileTestCase::DoRun (void) 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 @@ public: DiffTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; DiffTestCase::DiffTestCase () @@ -1076,7 +1064,7 @@ DiffTestCase::DiffTestCase () { } -bool +void DiffTestCase::DoRun (void) { // @@ -1111,8 +1099,6 @@ DiffTestCase::DoRun (void) 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 diff --git a/src/common/propagation-loss-model-test-suite.cc b/src/common/propagation-loss-model-test-suite.cc index 91f8ea9b9..07577fa74 100644 --- a/src/common/propagation-loss-model-test-suite.cc +++ b/src/common/propagation-loss-model-test-suite.cc @@ -41,7 +41,7 @@ public: virtual ~FriisPropagationLossModelTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); typedef struct { Vector m_position; @@ -62,7 +62,7 @@ FriisPropagationLossModelTestCase::~FriisPropagationLossModelTestCase () { } -bool +void FriisPropagationLossModelTestCase::DoRun (void) { // The ns-3 testing manual gives more background on the values selected @@ -127,8 +127,6 @@ FriisPropagationLossModelTestCase::DoRun (void) 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 @@ public: virtual ~TwoRayGroundPropagationLossModelTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); typedef struct { @@ -163,7 +161,7 @@ TwoRayGroundPropagationLossModelTestCase::~TwoRayGroundPropagationLossModelTestC { } -bool +void TwoRayGroundPropagationLossModelTestCase::DoRun (void) { // wavelength at 2.4 GHz is 0.125m @@ -258,8 +256,6 @@ TwoRayGroundPropagationLossModelTestCase::DoRun (void) 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 @@ public: virtual ~LogDistancePropagationLossModelTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); typedef struct { Vector m_position; @@ -291,7 +287,7 @@ LogDistancePropagationLossModelTestCase::~LogDistancePropagationLossModelTestCas { } -bool +void LogDistancePropagationLossModelTestCase::DoRun (void) { // reference loss at 2.4 GHz is 40.045997 @@ -348,8 +344,6 @@ LogDistancePropagationLossModelTestCase::DoRun (void) 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 @@ public: virtual ~MatrixPropagationLossModelTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; MatrixPropagationLossModelTestCase::MatrixPropagationLossModelTestCase () @@ -371,7 +365,7 @@ MatrixPropagationLossModelTestCase::~MatrixPropagationLossModelTestCase () { } -bool +void MatrixPropagationLossModelTestCase::DoRun (void) { Ptr n[3]; @@ -401,8 +395,6 @@ MatrixPropagationLossModelTestCase::DoRun (void) 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 @@ public: virtual ~RangePropagationLossModelTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; RangePropagationLossModelTestCase::RangePropagationLossModelTestCase () @@ -424,7 +416,7 @@ RangePropagationLossModelTestCase::~RangePropagationLossModelTestCase () { } -bool +void RangePropagationLossModelTestCase::DoRun (void) { Config::SetDefault ("ns3::RangePropagationLossModel::MaxRange", DoubleValue (127.2)); @@ -443,8 +435,6 @@ RangePropagationLossModelTestCase::DoRun (void) 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 diff --git a/src/common/sequence-number.cc b/src/common/sequence-number.cc index 7c770457c..1fe310a1e 100644 --- a/src/common/sequence-number.cc +++ b/src/common/sequence-number.cc @@ -74,7 +74,7 @@ public: SequenceNumberTestCase (); virtual ~SequenceNumberTestCase (); - virtual bool DoRun (void); + virtual void DoRun (void); }; SequenceNumberTestCase::SequenceNumberTestCase () @@ -94,7 +94,7 @@ SequenceNumberTestCase::SequenceNumberTracer (SequenceNumber32 oldval, SequenceN 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 @@ bool SequenceNumberTestCase::DoRun (void) obj->Dispose (); } - - return false; } static class SequenceNumberTestSuite : public TestSuite diff --git a/src/common/spectrum-value-test.cc b/src/common/spectrum-value-test.cc index 716fbe58c..0c98e99f1 100644 --- a/src/common/spectrum-value-test.cc +++ b/src/common/spectrum-value-test.cc @@ -38,7 +38,7 @@ class SpectrumValueTestCase : public TestCase 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 @@ SpectrumValueTestCase::MoreOrLessEqual (SpectrumValue x, SpectrumValue y) return (Norm (z) < TOLERANCE); } -bool +void SpectrumValueTestCase::DoRun (void) { bool error = !MoreOrLessEqual (m_a, m_b); @@ -86,7 +86,6 @@ SpectrumValueTestCase::DoRun (void) std::string ("no message"), __FILE__, __LINE__); } - return error; } diff --git a/src/contrib/energy/test/basic-energy-model-test.cc b/src/contrib/energy/test/basic-energy-model-test.cc index ff8630701..3a7aefd3e 100644 --- a/src/contrib/energy/test/basic-energy-model-test.cc +++ b/src/contrib/energy/test/basic-energy-model-test.cc @@ -50,7 +50,7 @@ public: virtual ~BasicEnergyUpdateTest (); private: - bool DoRun (void); + void DoRun (void); /** * \param state Radio state to switch to. @@ -80,7 +80,7 @@ BasicEnergyUpdateTest::~BasicEnergyUpdateTest () { } -bool +void BasicEnergyUpdateTest::DoRun (void) { // set types @@ -88,29 +88,11 @@ BasicEnergyUpdateTest::DoRun (void) 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 @@ BasicEnergyUpdateTest::StateSwitchTest (WifiPhy::State state) 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 devModel = DynamicCast (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 @@ BasicEnergyUpdateTest::StateSwitchTest (WifiPhy::State state) 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 @@ public: virtual ~BasicEnergyDepletionTest (); private: - bool DoRun (void); + void DoRun (void); /** * Callback invoked when energy is drained from source. @@ -273,7 +255,7 @@ BasicEnergyDepletionTest::~BasicEnergyDepletionTest () { } -bool +void BasicEnergyDepletionTest::DoRun (void) { /* @@ -284,16 +266,11 @@ BasicEnergyDepletionTest::DoRun (void) 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 @@ BasicEnergyDepletionTest::DepletionTestCase (double simTimeS, 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; } diff --git a/src/contrib/energy/test/li-ion-energy-source-test.cc b/src/contrib/energy/test/li-ion-energy-source-test.cc index bd2f11018..0b8402ce3 100644 --- a/src/contrib/energy/test/li-ion-energy-source-test.cc +++ b/src/contrib/energy/test/li-ion-energy-source-test.cc @@ -35,7 +35,7 @@ public: LiIonEnergyTestCase (); ~LiIonEnergyTestCase (); - bool DoRun (void); + void DoRun (void); double m_simTime; Ptr m_node; @@ -51,7 +51,7 @@ LiIonEnergyTestCase::~LiIonEnergyTestCase () m_node = 0; } -bool +void LiIonEnergyTestCase::DoRun () { m_node = CreateObject (); @@ -76,8 +76,6 @@ LiIonEnergyTestCase::DoRun () NS_TEST_ASSERT_MSG_EQ_TOL (es->GetSupplyVoltage (), 3.6, 1.0e-3, "Incorrect consumed energy!"); - - return false; } class LiIonEnergySourceTestSuite : public TestSuite diff --git a/src/contrib/energy/test/rv-battery-model-test.cc b/src/contrib/energy/test/rv-battery-model-test.cc index 475659551..d0f279b4e 100644 --- a/src/contrib/energy/test/rv-battery-model-test.cc +++ b/src/contrib/energy/test/rv-battery-model-test.cc @@ -61,7 +61,7 @@ private: * * Runs test. */ - bool DoRun (void); + void DoRun (void); /** * \param load Load value, in Amperes (A). @@ -637,35 +637,21 @@ BatteryLifetimeTest::CreateLoadProfiles (void) 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 @@ BatteryLifetimeTest::DoRun (void) m_loadProfiles[i].timeStamps, m_loadProfiles[i].itsyLifetime)) { - return false; + return; } } @@ -698,11 +684,9 @@ BatteryLifetimeTest::DoRun (void) m_loadProfiles[i].timeStamps, m_loadProfiles[i].dualFoilLifeTime)) { - return false; + return; } } - - return false; // error free } bool @@ -776,11 +760,11 @@ BatteryLifetimeTest::ConstantLoadTest (double load, Time expLifetime) 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 @@ BatteryLifetimeTest::VariableLoadTest (std::vector loads, 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!"); diff --git a/src/contrib/event-garbage-collector.cc b/src/contrib/event-garbage-collector.cc index 8a8dc154e..24d827f26 100644 --- a/src/contrib/event-garbage-collector.cc +++ b/src/contrib/event-garbage-collector.cc @@ -102,7 +102,7 @@ public: EventGarbageCollectorTestCase (); virtual ~EventGarbageCollectorTestCase (); - virtual bool DoRun (void); + virtual void DoRun (void); }; EventGarbageCollectorTestCase::EventGarbageCollectorTestCase () @@ -124,7 +124,7 @@ EventGarbageCollectorTestCase::EventGarbageCollectorCallback () } } -bool EventGarbageCollectorTestCase::DoRun (void) +void EventGarbageCollectorTestCase::DoRun (void) { m_events = new EventGarbageCollector (); @@ -139,7 +139,6 @@ bool EventGarbageCollectorTestCase::DoRun (void) 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 diff --git a/src/contrib/flow-monitor/model/histogram.cc b/src/contrib/flow-monitor/model/histogram.cc index 9144f3a87..636329d1a 100644 --- a/src/contrib/flow-monitor/model/histogram.cc +++ b/src/contrib/flow-monitor/model/histogram.cc @@ -156,7 +156,7 @@ class HistogramTestCase : public ns3::TestCase { private: public: HistogramTestCase (); - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -166,7 +166,7 @@ HistogramTestCase::HistogramTestCase () {} -bool +void HistogramTestCase::DoRun (void) { Histogram h0(3.5); @@ -195,8 +195,6 @@ HistogramTestCase::DoRun (void) NS_TEST_EXPECT_MSG_EQ (h0.GetNBins (), 22, ""); NS_TEST_EXPECT_MSG_EQ (h0.GetBinCount (21), 1, ""); } - - return false; } static class HistogramTestSuite : public TestSuite diff --git a/src/contrib/topology-read/rocketfuel-topology-reader.cc b/src/contrib/topology-read/rocketfuel-topology-reader.cc index 4ba6f0f67..ad847272f 100644 --- a/src/contrib/topology-read/rocketfuel-topology-reader.cc +++ b/src/contrib/topology-read/rocketfuel-topology-reader.cc @@ -429,7 +429,7 @@ class RocketfuelTopologyReaderTest: public TestCase public: RocketfuelTopologyReaderTest (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; RocketfuelTopologyReaderTest::RocketfuelTopologyReaderTest () @@ -437,7 +437,7 @@ RocketfuelTopologyReaderTest::RocketfuelTopologyReaderTest () {} -bool +void RocketfuelTopologyReaderTest::DoRun (void) { Ptr inFile; @@ -453,24 +453,16 @@ RocketfuelTopologyReaderTest::DoRun (void) 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 diff --git a/src/core/attribute-test-suite.cc b/src/core/attribute-test-suite.cc index f217f3c91..94895c674 100644 --- a/src/core/attribute-test-suite.cc +++ b/src/core/attribute-test-suite.cc @@ -233,7 +233,7 @@ public: virtual ~AttributeTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); bool CheckGetCodePaths (Ptr p, std::string attributeName, std::string expectedString, T expectedValue); }; @@ -263,15 +263,15 @@ AttributeTestCase::CheckGetCodePaths ( // 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 @@ AttributeTestCase::CheckGetCodePaths ( // =========================================================================== // The actual Attribute type test cases are specialized for each Attribute type // =========================================================================== -template <> bool +template <> void AttributeTestCase::DoRun (void) { AttributeList attrs; @@ -381,11 +381,9 @@ AttributeTestCase::DoRun (void) 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::DoRun (void) { Ptr p; @@ -493,11 +491,9 @@ AttributeTestCase::DoRun (void) 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::DoRun (void) { Ptr p; @@ -566,11 +562,9 @@ AttributeTestCase::DoRun (void) // 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::DoRun (void) { Ptr p; @@ -594,11 +588,9 @@ AttributeTestCase::DoRun (void) 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::DoRun (void) { Ptr p; @@ -651,11 +643,9 @@ AttributeTestCase::DoRun (void) 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::DoRun (void) { Ptr p; @@ -675,8 +665,6 @@ AttributeTestCase::DoRun (void) // 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 @@ public: virtual ~ObjectVectorAttributeTestCase () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); }; ObjectVectorAttributeTestCase::ObjectVectorAttributeTestCase (std::string description) @@ -698,7 +686,7 @@ ObjectVectorAttributeTestCase::ObjectVectorAttributeTestCase (std::string descri { } -bool +void ObjectVectorAttributeTestCase::DoRun (void) { Ptr p; @@ -743,8 +731,6 @@ ObjectVectorAttributeTestCase::DoRun (void) // p->GetAttribute ("TestVector1", vector); NS_TEST_ASSERT_MSG_EQ (vector.GetN (), 2, "ObjectVectorValue \"TestVector1\" should be incremented"); - - return GetErrorStatus (); } // =========================================================================== @@ -758,7 +744,7 @@ public: virtual ~IntegerTraceSourceAttributeTestCase () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); }; IntegerTraceSourceAttributeTestCase::IntegerTraceSourceAttributeTestCase (std::string description) @@ -766,7 +752,7 @@ IntegerTraceSourceAttributeTestCase::IntegerTraceSourceAttributeTestCase (std::s { } -bool +void IntegerTraceSourceAttributeTestCase::DoRun (void) { Ptr p; @@ -837,8 +823,6 @@ IntegerTraceSourceAttributeTestCase::DoRun (void) 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 @@ public: 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 @@ IntegerTraceSourceTestCase::IntegerTraceSourceTestCase (std::string description) { } -bool +void IntegerTraceSourceTestCase::DoRun (void) { Ptr p; @@ -911,8 +895,6 @@ IntegerTraceSourceTestCase::DoRun (void) 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 @@ public: 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 @@ TracedCallbackTestCase::TracedCallbackTestCase (std::string description) { } -bool +void TracedCallbackTestCase::DoRun (void) { Ptr p; @@ -987,8 +969,6 @@ TracedCallbackTestCase::DoRun (void) 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 @@ public: 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 @@ PointerAttributeTestCase::PointerAttributeTestCase (std::string description) { } -bool +void PointerAttributeTestCase::DoRun (void) { Ptr p; @@ -1077,8 +1057,6 @@ PointerAttributeTestCase::DoRun (void) p->GetAttribute ("Pointer", ptr); derived = ptr.Get (); NS_TEST_ASSERT_MSG_NE (p, 0, "Retrieved zero PointerValue Attribute after initializing to non-zero Ptr"); - - return GetErrorStatus (); } // =========================================================================== @@ -1098,7 +1076,7 @@ public: } private: - virtual bool DoRun (void); + virtual void DoRun (void); Callback m_cbValue; @@ -1112,7 +1090,7 @@ CallbackValueTestCase::CallbackValueTestCase (std::string description) { } -bool +void CallbackValueTestCase::DoRun (void) { Ptr p; @@ -1160,9 +1138,7 @@ CallbackValueTestCase::DoRun (void) // 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. diff --git a/src/core/callback-test-suite.cc b/src/core/callback-test-suite.cc index 8dbc548ae..5968399dd 100644 --- a/src/core/callback-test-suite.cc +++ b/src/core/callback-test-suite.cc @@ -37,7 +37,7 @@ public: 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 @@ BasicCallbackTestCase::DoSetup (void) gBasicCallbackTest7 = false; } -bool +void BasicCallbackTestCase::DoRun (void) { // @@ -150,8 +150,6 @@ BasicCallbackTestCase::DoRun (void) Callback target7 = Callback (&BasicCallbackTarget7, true, true); target7 (1); NS_TEST_ASSERT_MSG_EQ (gBasicCallbackTest7, true, "Callback did not fire"); - - return GetErrorStatus (); } // =========================================================================== @@ -169,7 +167,7 @@ public: 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 @@ MakeCallbackTestCase::DoSetup (void) gMakeCallbackTest7 = false; } -bool +void MakeCallbackTestCase::DoRun (void) { // @@ -282,8 +280,6 @@ MakeCallbackTestCase::DoRun (void) Callback target7 = MakeCallback (&MakeCallbackTarget7); target7 (1); NS_TEST_ASSERT_MSG_EQ (gMakeCallbackTest7, true, "Callback did not fire"); - - return GetErrorStatus (); } // =========================================================================== @@ -296,7 +292,7 @@ public: virtual ~MakeBoundCallbackTestCase () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoSetup (void); }; @@ -339,7 +335,7 @@ MakeBoundCallbackTestCase::DoSetup (void) gMakeBoundCallbackTest3b = 0; } -bool +void MakeBoundCallbackTestCase::DoRun (void) { // @@ -380,8 +376,6 @@ MakeBoundCallbackTestCase::DoRun (void) 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 @@ public: 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 @@ NullifyCallbackTestCase::DoSetup (void) m_test1 = false; } -bool +void NullifyCallbackTestCase::DoRun (void) { // @@ -429,8 +423,6 @@ NullifyCallbackTestCase::DoRun (void) target1.Nullify (); NS_TEST_ASSERT_MSG_EQ (target1.IsNull (), true, "Nullified Callback reports not IsNull()"); - - return GetErrorStatus (); } // =========================================================================== @@ -446,7 +438,7 @@ public: void Target1 (void) {m_test1 = true;} private: - virtual bool DoRun (void); + virtual void DoRun (void); bool m_test1; }; @@ -513,7 +505,7 @@ MakeCallbackTemplatesTestCase::MakeCallbackTemplatesTestCase () { } -bool +void MakeCallbackTemplatesTestCase::DoRun (void) { CallbackTestClass that; @@ -562,8 +554,6 @@ MakeCallbackTemplatesTestCase::DoRun (void) MakeBoundCallback (&TestFRFive, 1); that.CheckParentalRights (); - - return GetErrorStatus (); } // =========================================================================== diff --git a/src/core/command-line.cc b/src/core/command-line.cc index 100247b3f..93384eb99 100644 --- a/src/core/command-line.cc +++ b/src/core/command-line.cc @@ -352,7 +352,7 @@ public: virtual ~CommandLineBooleanTestCase () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -361,7 +361,7 @@ CommandLineBooleanTestCase::CommandLineBooleanTestCase () { } -bool +void CommandLineBooleanTestCase::DoRun (void) { CommandLine cmd; @@ -374,8 +374,6 @@ CommandLineBooleanTestCase::DoRun (void) 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 @@ public: virtual ~CommandLineIntTestCase () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -397,7 +395,7 @@ CommandLineIntTestCase::CommandLineIntTestCase () { } -bool +void CommandLineIntTestCase::DoRun (void) { CommandLine cmd; @@ -414,8 +412,6 @@ CommandLineIntTestCase::DoRun (void) 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 @@ public: virtual ~CommandLineUnsignedIntTestCase () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -437,7 +433,7 @@ CommandLineUnsignedIntTestCase::CommandLineUnsignedIntTestCase () { } -bool +void CommandLineUnsignedIntTestCase::DoRun (void) { CommandLine cmd; @@ -451,8 +447,6 @@ CommandLineUnsignedIntTestCase::DoRun (void) 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 @@ public: virtual ~CommandLineStringTestCase () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -474,7 +468,7 @@ CommandLineStringTestCase::CommandLineStringTestCase () { } -bool +void CommandLineStringTestCase::DoRun (void) { CommandLine cmd; @@ -488,8 +482,6 @@ CommandLineStringTestCase::DoRun (void) 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 (); } // =========================================================================== diff --git a/src/core/config.cc b/src/core/config.cc index 5621809bd..f124e8bdb 100644 --- a/src/core/config.cc +++ b/src/core/config.cc @@ -766,7 +766,7 @@ public: virtual ~RootNamespaceConfigTestCase () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); }; RootNamespaceConfigTestCase::RootNamespaceConfigTestCase () @@ -774,7 +774,7 @@ RootNamespaceConfigTestCase::RootNamespaceConfigTestCase () { } -bool +void RootNamespaceConfigTestCase::DoRun (void) { IntegerValue iv; @@ -812,8 +812,6 @@ RootNamespaceConfigTestCase::DoRun (void) 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 @@ public: virtual ~UnderRootNamespaceConfigTestCase () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); }; UnderRootNamespaceConfigTestCase::UnderRootNamespaceConfigTestCase () @@ -834,7 +832,7 @@ UnderRootNamespaceConfigTestCase::UnderRootNamespaceConfigTestCase () { } -bool +void UnderRootNamespaceConfigTestCase::DoRun (void) { IntegerValue iv; @@ -912,8 +910,6 @@ UnderRootNamespaceConfigTestCase::DoRun (void) 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 @@ public: virtual ~ObjectVectorConfigTestCase () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); }; ObjectVectorConfigTestCase::ObjectVectorConfigTestCase () @@ -934,7 +930,7 @@ ObjectVectorConfigTestCase::ObjectVectorConfigTestCase () { } -bool +void ObjectVectorConfigTestCase::DoRun (void) { IntegerValue iv; @@ -1068,8 +1064,6 @@ ObjectVectorConfigTestCase::DoRun (void) 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 @@ public: 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 @@ ObjectVectorTraceConfigTestCase::ObjectVectorTraceConfigTestCase () { } -bool +void ObjectVectorTraceConfigTestCase::DoRun (void) { IntegerValue iv; @@ -1217,8 +1211,6 @@ ObjectVectorTraceConfigTestCase::DoRun (void) 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 (); } // =========================================================================== diff --git a/src/core/global-value.cc b/src/core/global-value.cc index dec19215c..769edbac0 100644 --- a/src/core/global-value.cc +++ b/src/core/global-value.cc @@ -218,7 +218,7 @@ public: virtual ~GlobalValueTestCase () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); }; GlobalValueTestCase::GlobalValueTestCase () @@ -226,7 +226,7 @@ GlobalValueTestCase::GlobalValueTestCase () { } -bool +void GlobalValueTestCase::DoRun (void) { // @@ -256,8 +256,6 @@ GlobalValueTestCase::DoRun (void) break; } } - - return GetErrorStatus (); } // =========================================================================== diff --git a/src/core/names-test-suite.cc b/src/core/names-test-suite.cc index 5d55a9c4e..cb01157c6 100644 --- a/src/core/names-test-suite.cc +++ b/src/core/names-test-suite.cc @@ -70,7 +70,7 @@ public: virtual ~BasicAddTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -89,7 +89,7 @@ BasicAddTestCase::DoTeardown (void) Names::Clear (); } -bool +void BasicAddTestCase::DoRun (void) { std::string found; @@ -117,8 +117,6 @@ BasicAddTestCase::DoRun (void) 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 @@ public: virtual ~StringContextAddTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -157,7 +155,7 @@ StringContextAddTestCase::DoTeardown (void) Names::Clear (); } -bool +void StringContextAddTestCase::DoRun (void) { std::string found; @@ -185,8 +183,6 @@ StringContextAddTestCase::DoRun (void) 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 @@ public: virtual ~FullyQualifiedAddTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -222,7 +218,7 @@ FullyQualifiedAddTestCase::DoTeardown (void) Names::Clear (); } -bool +void FullyQualifiedAddTestCase::DoRun (void) { std::string found; @@ -250,8 +246,6 @@ FullyQualifiedAddTestCase::DoRun (void) 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 @@ public: virtual ~RelativeAddTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -290,7 +284,7 @@ RelativeAddTestCase::DoTeardown (void) Names::Clear (); } -bool +void RelativeAddTestCase::DoRun (void) { std::string found; @@ -318,8 +312,6 @@ RelativeAddTestCase::DoRun (void) 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 @@ public: virtual ~BasicRenameTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -357,7 +349,7 @@ BasicRenameTestCase::DoTeardown (void) Names::Clear (); } -bool +void BasicRenameTestCase::DoRun (void) { std::string found; @@ -383,8 +375,6 @@ BasicRenameTestCase::DoRun (void) 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 @@ public: virtual ~StringContextRenameTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -419,7 +409,7 @@ StringContextRenameTestCase::DoTeardown (void) Names::Clear (); } -bool +void StringContextRenameTestCase::DoRun (void) { std::string found; @@ -445,8 +435,6 @@ StringContextRenameTestCase::DoRun (void) 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 @@ public: virtual ~FullyQualifiedRenameTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -481,7 +469,7 @@ FullyQualifiedRenameTestCase::DoTeardown (void) Names::Clear (); } -bool +void FullyQualifiedRenameTestCase::DoRun (void) { std::string found; @@ -507,8 +495,6 @@ FullyQualifiedRenameTestCase::DoRun (void) 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 @@ public: virtual ~RelativeRenameTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -543,7 +529,7 @@ RelativeRenameTestCase::DoTeardown (void) Names::Clear (); } -bool +void RelativeRenameTestCase::DoRun (void) { std::string found; @@ -569,8 +555,6 @@ RelativeRenameTestCase::DoRun (void) 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 @@ public: virtual ~FindPathTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -605,7 +589,7 @@ FindPathTestCase::DoTeardown (void) Names::Clear (); } -bool +void FindPathTestCase::DoRun (void) { std::string found; @@ -625,8 +609,6 @@ FindPathTestCase::DoRun (void) Ptr objectNotThere = CreateObject (); found = Names::FindPath (objectNotThere); NS_TEST_ASSERT_MSG_EQ (found, "", "Unexpectedly found a non-existent Object"); - - return false; } // =========================================================================== @@ -642,7 +624,7 @@ public: virtual ~BasicFindTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -661,7 +643,7 @@ BasicFindTestCase::DoTeardown (void) Names::Clear (); } -bool +void BasicFindTestCase::DoRun (void) { Ptr found; @@ -689,8 +671,6 @@ BasicFindTestCase::DoRun (void) found = Names::Find (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 @@ public: virtual ~StringContextFindTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -725,7 +705,7 @@ StringContextFindTestCase::DoTeardown (void) Names::Clear (); } -bool +void StringContextFindTestCase::DoRun (void) { Ptr found; @@ -753,8 +733,6 @@ StringContextFindTestCase::DoRun (void) found = Names::Find ("/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 @@ public: virtual ~FullyQualifiedFindTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -789,7 +767,7 @@ FullyQualifiedFindTestCase::DoTeardown (void) Names::Clear (); } -bool +void FullyQualifiedFindTestCase::DoRun (void) { Ptr found; @@ -817,8 +795,6 @@ FullyQualifiedFindTestCase::DoRun (void) found = Names::Find ("/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 @@ public: virtual ~RelativeFindTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -853,7 +829,7 @@ RelativeFindTestCase::DoTeardown (void) Names::Clear (); } -bool +void RelativeFindTestCase::DoRun (void) { Ptr found; @@ -881,8 +857,6 @@ RelativeFindTestCase::DoRun (void) found = Names::Find ("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 @@ public: virtual ~AlternateFindTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -915,7 +889,7 @@ AlternateFindTestCase::DoTeardown (void) Names::Clear (); } -bool +void AlternateFindTestCase::DoRun (void) { Ptr testObject = CreateObject (); @@ -943,8 +917,6 @@ AlternateFindTestCase::DoRun (void) foundTestObject = Names::Find ("Alternate Test Object"); NS_TEST_ASSERT_MSG_EQ (foundTestObject, 0, "Unexpectedly able to GetObject on an AlternateTestObject"); - - return false; } class NamesTestSuite : public TestSuite diff --git a/src/core/object.cc b/src/core/object.cc index 6ee3cfef6..657d21922 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -475,7 +475,7 @@ public: virtual ~CreateObjectTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; CreateObjectTestCase::CreateObjectTestCase () @@ -487,7 +487,7 @@ CreateObjectTestCase::~CreateObjectTestCase () { } -bool +void CreateObjectTestCase::DoRun (void) { Ptr baseA = CreateObject (); @@ -529,8 +529,6 @@ CreateObjectTestCase::DoRun (void) // object. // NS_TEST_ASSERT_MSG_EQ (baseA->GetObject (DerivedA::GetTypeId ()), baseA, "GetObject returns different Ptr"); - - return GetErrorStatus (); } // =========================================================================== @@ -543,7 +541,7 @@ public: virtual ~AggregateObjectTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; AggregateObjectTestCase::AggregateObjectTestCase () @@ -555,7 +553,7 @@ AggregateObjectTestCase::~AggregateObjectTestCase () { } -bool +void AggregateObjectTestCase::DoRun (void) { Ptr baseA = CreateObject (); @@ -702,8 +700,6 @@ AggregateObjectTestCase::DoRun (void) baseA = baseB->GetObject (); NS_TEST_ASSERT_MSG_NE (baseA, 0, "Unable to GetObject on released object"); - - return GetErrorStatus (); } // =========================================================================== @@ -716,7 +712,7 @@ public: virtual ~ObjectFactoryTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; ObjectFactoryTestCase::ObjectFactoryTestCase () @@ -728,7 +724,7 @@ ObjectFactoryTestCase::~ObjectFactoryTestCase () { } -bool +void ObjectFactoryTestCase::DoRun (void) { ObjectFactory factory; @@ -776,8 +772,6 @@ ObjectFactoryTestCase::DoRun (void) // declaration. // NS_TEST_ASSERT_MSG_NE (a->GetObject (), 0, "Unexpectedly able to work around C++ type system"); - - return GetErrorStatus (); } // =========================================================================== diff --git a/src/core/ptr-test-suite.cc b/src/core/ptr-test-suite.cc index a639d2555..a6447307c 100644 --- a/src/core/ptr-test-suite.cc +++ b/src/core/ptr-test-suite.cc @@ -53,7 +53,7 @@ public: PtrTestCase (); void DestroyNotify (void); private: - virtual bool DoRun (void); + virtual void DoRun (void); Ptr CallTest (Ptr p); Ptr const CallTestConst (Ptr const p); uint32_t m_nDestroyed; @@ -114,7 +114,7 @@ PtrTestCase::CallTestConst (Ptr const p) } -bool +void PtrTestCase::DoRun (void) { m_nDestroyed = false; @@ -257,8 +257,6 @@ PtrTestCase::DoRun (void) 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 diff --git a/src/core/random-variable.cc b/src/core/random-variable.cc index 983b0fb95..be31c39ec 100644 --- a/src/core/random-variable.cc +++ b/src/core/random-variable.cc @@ -2055,7 +2055,7 @@ public: } private: - virtual bool DoRun (void); + virtual void DoRun (void); }; BasicRandomNumberTestCase::BasicRandomNumberTestCase () @@ -2063,7 +2063,7 @@ BasicRandomNumberTestCase::BasicRandomNumberTestCase () { } -bool +void BasicRandomNumberTestCase::DoRun (void) { const double desiredMean = 1.0; @@ -2106,8 +2106,6 @@ BasicRandomNumberTestCase::DoRun (void) } 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 @@ public: } private: - virtual bool DoRun (void); + virtual void DoRun (void); }; RandomNumberSerializationTestCase::RandomNumberSerializationTestCase () @@ -2127,7 +2125,7 @@ RandomNumberSerializationTestCase::RandomNumberSerializationTestCase () { } -bool +void RandomNumberSerializationTestCase::DoRun (void) { RandomVariableValue val; @@ -2145,8 +2143,6 @@ RandomNumberSerializationTestCase::DoRun (void) 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 diff --git a/src/core/rng-test-suite.cc b/src/core/rng-test-suite.cc index a6ee5a56f..13cb86124 100644 --- a/src/core/rng-test-suite.cc +++ b/src/core/rng-test-suite.cc @@ -55,7 +55,7 @@ public: double ChiSquaredTest (UniformVariable &u); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; RngUniformTestCase::RngUniformTestCase () @@ -102,7 +102,7 @@ RngUniformTestCase::ChiSquaredTest (UniformVariable &u) return chiSquared; } -bool +void RngUniformTestCase::DoRun (void) { SeedManager::SetSeed (time (0)); @@ -120,7 +120,6 @@ RngUniformTestCase::DoRun (void) sum /= (double)N_RUNS; NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range"); - return false; } // =========================================================================== @@ -139,7 +138,7 @@ public: double ChiSquaredTest (NormalVariable &n); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; RngNormalTestCase::RngNormalTestCase () @@ -200,7 +199,7 @@ RngNormalTestCase::ChiSquaredTest (NormalVariable &n) return chiSquared; } -bool +void RngNormalTestCase::DoRun (void) { SeedManager::SetSeed (time (0)); @@ -218,7 +217,6 @@ RngNormalTestCase::DoRun (void) sum /= (double)N_RUNS; NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range"); - return false; } // =========================================================================== @@ -237,7 +235,7 @@ public: double ChiSquaredTest (ExponentialVariable &n); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; RngExponentialTestCase::RngExponentialTestCase () @@ -297,7 +295,7 @@ RngExponentialTestCase::ChiSquaredTest (ExponentialVariable &e) return chiSquared; } -bool +void RngExponentialTestCase::DoRun (void) { SeedManager::SetSeed (time (0)); @@ -315,7 +313,6 @@ RngExponentialTestCase::DoRun (void) sum /= (double)N_RUNS; NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range"); - return false; } // =========================================================================== @@ -334,7 +331,7 @@ public: double ChiSquaredTest (ParetoVariable &p); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; RngParetoTestCase::RngParetoTestCase () @@ -395,7 +392,7 @@ RngParetoTestCase::ChiSquaredTest (ParetoVariable &p) return chiSquared; } -bool +void RngParetoTestCase::DoRun (void) { SeedManager::SetSeed (time (0)); @@ -413,7 +410,6 @@ RngParetoTestCase::DoRun (void) sum /= (double)N_RUNS; NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range"); - return false; } class RngTestSuite : public TestSuite diff --git a/src/core/test.cc b/src/core/test.cc index f1d3d82b5..56b0e90d4 100644 --- a/src/core/test.cc +++ b/src/core/test.cc @@ -21,6 +21,8 @@ #include "abort.h" #include +// 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 @@ TestCase::ReportEnd (void) DoReportStart (); } -bool +void TestCase::Run (void) { // @@ -150,8 +152,7 @@ TestCase::Run (void) DoReportStart (); DoSetup (); - bool result = DoRun (); - UpdateErrorStatus (result); + DoRun (); DoTeardown (); @@ -175,7 +176,7 @@ TestCase::Run (void) DoReportEnd (); - return GetErrorStatus (); + return; } void @@ -456,10 +457,7 @@ TestSuite::Run (void) DoReportStart (); DoSetup (); - - bool result = DoRun (); - UpdateErrorStatus (result); - + DoRun (); DoTeardown (); if (GetErrorStatus () == false) @@ -663,7 +661,7 @@ TestSuite::DoSetup (void) { } -bool +void TestSuite::DoRun (void) { SetErrorStatus (false); @@ -682,19 +680,18 @@ TestSuite::DoRun (void) // // 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 diff --git a/src/core/test.h b/src/core/test.h index 8b07ab3f8..d719b4b98 100644 --- a/src/core/test.h +++ b/src/core/test.h @@ -51,12 +51,6 @@ extern bool gBreakOnFailure; #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 @@ extern bool gBreakOnFailure; actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ if (!ContinueOnFailure ()) \ { \ - return true; \ + return; \ } \ } \ } while (false) @@ -113,6 +107,61 @@ extern bool gBreakOnFailure; #define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg) \ NS_TEST_ASSERT_MSG_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) +/** + * \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 * @@ -189,7 +238,7 @@ extern bool gBreakOnFailure; ReportTestFailure (condStream.str (), actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ if (!ContinueOnFailure ()) \ { \ - return true; \ + return; \ } \ } \ } while (false) @@ -245,6 +294,85 @@ extern bool gBreakOnFailure; #define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg) \ NS_TEST_ASSERT_MSG_EQ_TOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__) +/** + * \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::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 * @@ -342,7 +470,7 @@ extern bool gBreakOnFailure; actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ if (!ContinueOnFailure ()) \ { \ - return true; \ + return; \ } \ } \ } while (false) @@ -375,6 +503,60 @@ extern bool gBreakOnFailure; #define NS_TEST_ASSERT_MSG_NE(actual, limit, msg) \ NS_TEST_ASSERT_MSG_NE_INTERNAL (actual, limit, msg, __FILE__, __LINE__) +/** + * \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 * @@ -447,7 +629,7 @@ extern bool gBreakOnFailure; actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ if (!ContinueOnFailure ()) \ { \ - return true; \ + return; \ } \ } \ } while (false) @@ -531,7 +713,7 @@ extern bool gBreakOnFailure; actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ if (!ContinueOnFailure ()) \ { \ - return true; \ + return; \ } \ } \ } while (false) @@ -626,9 +808,8 @@ public: /** * \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 @@ protected: /** * \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 @@ protected: /** * \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 diff --git a/src/core/traced-callback-test-suite.cc b/src/core/traced-callback-test-suite.cc index 2637720e7..2a304a486 100644 --- a/src/core/traced-callback-test-suite.cc +++ b/src/core/traced-callback-test-suite.cc @@ -28,7 +28,7 @@ public: 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 @@ BasicTracedCallbackTestCase::CbTwo (uint8_t a, double b) m_two = true; } -bool +void BasicTracedCallbackTestCase::DoRun (void) { // @@ -106,8 +106,6 @@ BasicTracedCallbackTestCase::DoRun (void) 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 diff --git a/src/core/type-traits-test-suite.cc b/src/core/type-traits-test-suite.cc index c84c266df..e274eec3a 100644 --- a/src/core/type-traits-test-suite.cc +++ b/src/core/type-traits-test-suite.cc @@ -28,7 +28,7 @@ public: virtual ~TypeTraitsTestCase () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); }; TypeTraitsTestCase::TypeTraitsTestCase (void) @@ -36,7 +36,7 @@ TypeTraitsTestCase::TypeTraitsTestCase (void) { } -bool +void TypeTraitsTestCase::DoRun (void) { NS_TEST_ASSERT_MSG_EQ (TypeTraits::IsPointerToMember, 1, "Check"); @@ -45,8 +45,6 @@ TypeTraitsTestCase::DoRun (void) NS_TEST_ASSERT_MSG_EQ (TypeTraits::IsPointerToMember, 1, "Check"); NS_TEST_ASSERT_MSG_EQ (TypeTraits::PointerToMemberTraits::nArgs, 0, "Check"); NS_TEST_ASSERT_MSG_EQ (TypeTraits::PointerToMemberTraits::nArgs, 1, "Check"); - - return GetErrorStatus (); } class TypeTraitsTestSuite : public TestSuite diff --git a/src/devices/lte/test/lte-bearer-test.cc b/src/devices/lte/test/lte-bearer-test.cc index 9d60cb53c..5b9fcac63 100644 --- a/src/devices/lte/test/lte-bearer-test.cc +++ b/src/devices/lte/test/lte-bearer-test.cc @@ -56,7 +56,7 @@ public: virtual ~Ns3LteBearerTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -69,11 +69,9 @@ Ns3LteBearerTestCase::~Ns3LteBearerTestCase () { } -bool +void Ns3LteBearerTestCase::DoRun (void) { - bool testResult = false; - // create downlink data radio bearer and its qos parameters Ptr bearer = CreateObject (); bearer->SetBearerDirection (RadioBearerInstance::DIRECTION_TYPE_DL); @@ -90,24 +88,18 @@ Ns3LteBearerTestCase::DoRun (void) 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); } // ============================================================================== diff --git a/src/devices/lte/test/lte-device-test.cc b/src/devices/lte/test/lte-device-test.cc index de0434aeb..214abf763 100644 --- a/src/devices/lte/test/lte-device-test.cc +++ b/src/devices/lte/test/lte-device-test.cc @@ -54,7 +54,7 @@ public: virtual ~Ns3LteDeviceTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -67,11 +67,9 @@ Ns3LteDeviceTestCase::~Ns3LteDeviceTestCase () { } -bool +void Ns3LteDeviceTestCase::DoRun (void) { - bool testResult = false; - LteHelper lte; lte.EnableLogComponents (); @@ -150,10 +148,7 @@ Ns3LteDeviceTestCase::DoRun (void) // ****** 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 @@ Ns3LteDeviceTestCase::DoRun (void) Simulator::Run (); Simulator::Destroy (); - - - return (testResult); } // ============================================================================== diff --git a/src/devices/lte/test/lte-phy-test.cc b/src/devices/lte/test/lte-phy-test.cc index 87df34aed..be2ecaaff 100644 --- a/src/devices/lte/test/lte-phy-test.cc +++ b/src/devices/lte/test/lte-phy-test.cc @@ -49,7 +49,7 @@ public: virtual ~Ns3LtePhyTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -62,11 +62,9 @@ Ns3LtePhyTestCase::~Ns3LtePhyTestCase () { } -bool +void Ns3LtePhyTestCase::DoRun (void) { - bool testResult = false; - LteHelper lte; lte.EnableLogComponents (); @@ -138,21 +136,12 @@ Ns3LtePhyTestCase::DoRun (void) 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); } // ============================================================================== diff --git a/src/devices/lte/test/lte-propagation-loss-model-test.cc b/src/devices/lte/test/lte-propagation-loss-model-test.cc index 1a48ce628..c2bbacb46 100644 --- a/src/devices/lte/test/lte-propagation-loss-model-test.cc +++ b/src/devices/lte/test/lte-propagation-loss-model-test.cc @@ -55,7 +55,7 @@ public: virtual ~Ns3LtePropagationLossModelTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -68,11 +68,9 @@ Ns3LtePropagationLossModelTestCase::~Ns3LtePropagationLossModelTestCase () { } -bool +void Ns3LtePropagationLossModelTestCase::DoRun (void) { - bool testResult = false; - // CREATE PHY LAYER FOR BOTH UE AND ENB Ptr phyEnb = CreateObject (); Ptr dlEnb = CreateObject (); @@ -167,30 +165,17 @@ Ns3LtePropagationLossModelTestCase::DoRun (void) } - 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); } // ============================================================================== diff --git a/src/devices/mesh/dot11s/test/dot11s-test-suite.cc b/src/devices/mesh/dot11s/test/dot11s-test-suite.cc index 3e83b4a43..0d2030533 100644 --- a/src/devices/mesh/dot11s/test/dot11s-test-suite.cc +++ b/src/devices/mesh/dot11s/test/dot11s-test-suite.cc @@ -36,10 +36,10 @@ struct MeshHeaderTest : public TestCase TestCase ("Dot11sMeshHeader roundtrip serialization") { } - bool DoRun (); + void DoRun (); }; -bool +void MeshHeaderTest::DoRun () { { @@ -81,7 +81,6 @@ MeshHeaderTest::DoRun () 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 @@ class HwmpRtableTest : public TestCase { public: HwmpRtableTest (); - virtual bool DoRun (); + virtual void DoRun (); private: /// Test Add apth and lookup path; @@ -193,7 +192,7 @@ HwmpRtableTest::TestPrecursorFind () } } -bool +void HwmpRtableTest::DoRun () { table = CreateObject (); @@ -206,8 +205,6 @@ HwmpRtableTest::DoRun () Simulator::Run (); Simulator::Destroy (); - - return GetErrorStatus (); } //----------------------------------------------------------------------------- /// Built-in self test for PeerLinkFrameStart @@ -217,10 +214,10 @@ struct PeerLinkFrameStartTest : public TestCase TestCase ("PeerLinkFrames (open, confirm, close) unit tests") { } - virtual bool DoRun (); + virtual void DoRun (); }; -bool +void PeerLinkFrameStartTest::DoRun () { { @@ -271,7 +268,6 @@ PeerLinkFrameStartTest::DoRun () packet->RemoveHeader (b); NS_TEST_EXPECT_MSG_EQ (a, b, "PEER_LINK_CLOSE works"); } - return GetErrorStatus (); } //----------------------------------------------------------------------------- class Dot11sTestSuite : public TestSuite diff --git a/src/devices/mesh/dot11s/test/hwmp-proactive-regression.cc b/src/devices/mesh/dot11s/test/hwmp-proactive-regression.cc index 0ed35bd5b..c50be4e4e 100644 --- a/src/devices/mesh/dot11s/test/hwmp-proactive-regression.cc +++ b/src/devices/mesh/dot11s/test/hwmp-proactive-regression.cc @@ -53,7 +53,7 @@ HwmpProactiveRegressionTest::~HwmpProactiveRegressionTest () { delete m_nodes; } -bool +void HwmpProactiveRegressionTest::DoRun () { SeedManager::SetSeed(12345); @@ -68,7 +68,6 @@ HwmpProactiveRegressionTest::DoRun () if (!WRITE_VECTORS) CheckResults (); delete m_nodes, m_nodes = 0; - return false; } void HwmpProactiveRegressionTest::CreateNodes () diff --git a/src/devices/mesh/dot11s/test/hwmp-proactive-regression.h b/src/devices/mesh/dot11s/test/hwmp-proactive-regression.h index cd38ce09e..ba4dca9d1 100644 --- a/src/devices/mesh/dot11s/test/hwmp-proactive-regression.h +++ b/src/devices/mesh/dot11s/test/hwmp-proactive-regression.h @@ -60,7 +60,7 @@ public: HwmpProactiveRegressionTest (); virtual ~HwmpProactiveRegressionTest(); - virtual bool DoRun (); + virtual void DoRun (); void CheckResults (); private: diff --git a/src/devices/mesh/dot11s/test/hwmp-reactive-regression.cc b/src/devices/mesh/dot11s/test/hwmp-reactive-regression.cc index 2734c9b21..d7613cf35 100644 --- a/src/devices/mesh/dot11s/test/hwmp-reactive-regression.cc +++ b/src/devices/mesh/dot11s/test/hwmp-reactive-regression.cc @@ -49,7 +49,7 @@ HwmpReactiveRegressionTest::~HwmpReactiveRegressionTest () { delete m_nodes; } -bool +void HwmpReactiveRegressionTest::DoRun () { SeedManager::SetSeed(12345); @@ -63,7 +63,6 @@ HwmpReactiveRegressionTest::DoRun () if (!WRITE_VECTORS) CheckResults (); delete m_nodes, m_nodes = 0; - return false; } void HwmpReactiveRegressionTest::CreateNodes () diff --git a/src/devices/mesh/dot11s/test/hwmp-reactive-regression.h b/src/devices/mesh/dot11s/test/hwmp-reactive-regression.h index cad72ac0c..ee6d55f15 100644 --- a/src/devices/mesh/dot11s/test/hwmp-reactive-regression.h +++ b/src/devices/mesh/dot11s/test/hwmp-reactive-regression.h @@ -74,7 +74,7 @@ public: HwmpReactiveRegressionTest (); virtual ~HwmpReactiveRegressionTest(); - virtual bool DoRun (); + virtual void DoRun (); void CheckResults (); private: /// XXX It is important to have pointers here diff --git a/src/devices/mesh/dot11s/test/hwmp-simplest-regression.cc b/src/devices/mesh/dot11s/test/hwmp-simplest-regression.cc index fe9998e31..cf6d177eb 100644 --- a/src/devices/mesh/dot11s/test/hwmp-simplest-regression.cc +++ b/src/devices/mesh/dot11s/test/hwmp-simplest-regression.cc @@ -52,7 +52,7 @@ HwmpSimplestRegressionTest::~HwmpSimplestRegressionTest () { delete m_nodes; } -bool +void HwmpSimplestRegressionTest::DoRun () { SeedManager::SetSeed(12345); @@ -67,7 +67,6 @@ HwmpSimplestRegressionTest::DoRun () if (!WRITE_VECTORS) CheckResults (); delete m_nodes, m_nodes = 0; - return false; } void HwmpSimplestRegressionTest::CreateNodes () diff --git a/src/devices/mesh/dot11s/test/hwmp-simplest-regression.h b/src/devices/mesh/dot11s/test/hwmp-simplest-regression.h index cdbed35b2..936368fbc 100644 --- a/src/devices/mesh/dot11s/test/hwmp-simplest-regression.h +++ b/src/devices/mesh/dot11s/test/hwmp-simplest-regression.h @@ -71,7 +71,7 @@ public: HwmpSimplestRegressionTest (); virtual ~HwmpSimplestRegressionTest(); - virtual bool DoRun (); + virtual void DoRun (); void CheckResults (); private: diff --git a/src/devices/mesh/dot11s/test/hwmp-target-flags-regression.cc b/src/devices/mesh/dot11s/test/hwmp-target-flags-regression.cc index 06bee94b7..f53adc034 100644 --- a/src/devices/mesh/dot11s/test/hwmp-target-flags-regression.cc +++ b/src/devices/mesh/dot11s/test/hwmp-target-flags-regression.cc @@ -52,7 +52,7 @@ HwmpDoRfRegressionTest::~HwmpDoRfRegressionTest () { delete m_nodes; } -bool +void HwmpDoRfRegressionTest::DoRun () { SeedManager::SetSeed(12345); @@ -67,7 +67,6 @@ HwmpDoRfRegressionTest::DoRun () if (!WRITE_VECTORS) CheckResults (); delete m_nodes, m_nodes = 0; - return false; } void HwmpDoRfRegressionTest::CreateNodes () diff --git a/src/devices/mesh/dot11s/test/hwmp-target-flags-regression.h b/src/devices/mesh/dot11s/test/hwmp-target-flags-regression.h index 123844d87..f514c0fad 100644 --- a/src/devices/mesh/dot11s/test/hwmp-target-flags-regression.h +++ b/src/devices/mesh/dot11s/test/hwmp-target-flags-regression.h @@ -70,7 +70,7 @@ public: HwmpDoRfRegressionTest (); virtual ~HwmpDoRfRegressionTest(); - virtual bool DoRun (); + virtual void DoRun (); void CheckResults (); private: diff --git a/src/devices/mesh/dot11s/test/pmp-regression.cc b/src/devices/mesh/dot11s/test/pmp-regression.cc index 9bb40c367..67135a77b 100644 --- a/src/devices/mesh/dot11s/test/pmp-regression.cc +++ b/src/devices/mesh/dot11s/test/pmp-regression.cc @@ -50,7 +50,7 @@ PeerManagementProtocolRegressionTest::~PeerManagementProtocolRegressionTest () delete m_nodes; } -bool +void PeerManagementProtocolRegressionTest::DoRun () { SeedManager::SetSeed(12345); @@ -64,7 +64,6 @@ PeerManagementProtocolRegressionTest::DoRun () if (!WRITE_VECTORS) CheckResults (); delete m_nodes, m_nodes = 0; - return GetErrorStatus (); } void diff --git a/src/devices/mesh/dot11s/test/pmp-regression.h b/src/devices/mesh/dot11s/test/pmp-regression.h index f98d7655a..ae80d2a77 100644 --- a/src/devices/mesh/dot11s/test/pmp-regression.h +++ b/src/devices/mesh/dot11s/test/pmp-regression.h @@ -56,7 +56,7 @@ private: void CreateNodes (); void CreateDevices (); void CheckResults (); - bool DoRun (); + void DoRun (); }; #endif // PMP_REGRESSION_H diff --git a/src/devices/mesh/flame/flame-test-suite.cc b/src/devices/mesh/flame/flame-test-suite.cc index 2ecb9ce74..0cbb291b8 100644 --- a/src/devices/mesh/flame/flame-test-suite.cc +++ b/src/devices/mesh/flame/flame-test-suite.cc @@ -34,10 +34,10 @@ struct FlameHeaderTest : public TestCase TestCase ("FlameHeader roundtrip serialization") { } - bool DoRun (); + void DoRun (); }; -bool +void FlameHeaderTest::DoRun () { FlameHeader a; @@ -51,7 +51,6 @@ FlameHeaderTest::DoRun () FlameHeader b; packet->RemoveHeader (b); NS_TEST_ASSERT_MSG_EQ (b, a, "FlameHeader roundtrip serialization works"); - return false; } //----------------------------------------------------------------------------- @@ -61,7 +60,7 @@ class FlameRtableTest : public TestCase { public: FlameRtableTest (); - bool DoRun (); + void DoRun (); private: /// Test Add apth and lookup path; @@ -121,7 +120,7 @@ FlameRtableTest::TestExpire () NS_TEST_EXPECT_MSG_EQ (table->Lookup (dst).IsValid (), false, "Routing table records expirations works"); } -bool +void FlameRtableTest::DoRun () { table = CreateObject (); @@ -132,8 +131,6 @@ FlameRtableTest::DoRun () Simulator::Run (); Simulator::Destroy (); - - return GetErrorStatus (); } diff --git a/src/devices/mesh/flame/test/flame-regression.cc b/src/devices/mesh/flame/test/flame-regression.cc index 7797fc047..670078acd 100644 --- a/src/devices/mesh/flame/test/flame-regression.cc +++ b/src/devices/mesh/flame/test/flame-regression.cc @@ -53,7 +53,7 @@ FlameRegressionTest::~FlameRegressionTest () delete m_nodes; } -bool +void FlameRegressionTest::DoRun () { SeedManager::SetSeed(12345); @@ -68,7 +68,6 @@ FlameRegressionTest::DoRun () if (!WRITE_VECTORS) CheckResults (); delete m_nodes, m_nodes = 0; - return false; } void diff --git a/src/devices/mesh/flame/test/flame-regression.h b/src/devices/mesh/flame/test/flame-regression.h index 404529682..d79f1193f 100644 --- a/src/devices/mesh/flame/test/flame-regression.h +++ b/src/devices/mesh/flame/test/flame-regression.h @@ -59,7 +59,7 @@ public: FlameRegressionTest (); virtual ~FlameRegressionTest(); - virtual bool DoRun (); + virtual void DoRun (); void CheckResults (); private: diff --git a/src/devices/mesh/mesh-information-element-vector.cc b/src/devices/mesh/mesh-information-element-vector.cc index 3c162a157..e4c1fa1c4 100644 --- a/src/devices/mesh/mesh-information-element-vector.cc +++ b/src/devices/mesh/mesh-information-element-vector.cc @@ -102,10 +102,10 @@ struct MeshInformationElementVectorBist : public TestCase TestCase ("Serializarion test for all mesh information elements") { }; - bool DoRun (); + void DoRun (); }; -bool +void MeshInformationElementVectorBist::DoRun () { MeshInformationElementVector vector; @@ -199,8 +199,6 @@ MeshInformationElementVectorBist::DoRun () 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 diff --git a/src/devices/point-to-point/point-to-point-test.cc b/src/devices/point-to-point/point-to-point-test.cc index 83020d143..3189edcf2 100644 --- a/src/devices/point-to-point/point-to-point-test.cc +++ b/src/devices/point-to-point/point-to-point-test.cc @@ -11,7 +11,7 @@ class PointToPointTest : public TestCase public: PointToPointTest (); - virtual bool DoRun (void); + virtual void DoRun (void); private: void SendOnePacket (Ptr device); @@ -29,7 +29,7 @@ PointToPointTest::SendOnePacket (Ptr device) } -bool +void PointToPointTest::DoRun (void) { Ptr a = CreateObject (); @@ -53,8 +53,6 @@ PointToPointTest::DoRun (void) Simulator::Run (); Simulator::Destroy (); - - return GetErrorStatus (); } //----------------------------------------------------------------------------- class PointToPointTestSuite : public TestSuite diff --git a/src/devices/spectrum/spectrum-interference-test.cc b/src/devices/spectrum/spectrum-interference-test.cc index d4d376233..4379dc313 100644 --- a/src/devices/spectrum/spectrum-interference-test.cc +++ b/src/devices/spectrum/spectrum-interference-test.cc @@ -40,7 +40,7 @@ class SpectrumInterferenceTestCase : public TestCase public: SpectrumInterferenceTestCase (Ptr 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 @@ SpectrumInterferenceTestCase::~SpectrumInterferenceTestCase () -bool +void SpectrumInterferenceTestCase::DoRun (void) { Ptr n = Create (m_mySpectrumModel); @@ -120,8 +120,6 @@ SpectrumInterferenceTestCase::DoRun (void) // the above will return and after RetrieveTestResults have // been called and after all signals have expired Simulator::Destroy (); - - return m_error; } diff --git a/src/devices/uan/test/uan-energy-model-test.cc b/src/devices/uan/test/uan-energy-model-test.cc index bf2c036f2..38cf4eb60 100644 --- a/src/devices/uan/test/uan-energy-model-test.cc +++ b/src/devices/uan/test/uan-energy-model-test.cc @@ -49,7 +49,7 @@ public: bool RxPacket (Ptr dev, Ptr pkt, uint16_t mode, const Address &sender); void SendOnePacket (Ptr node); - bool DoRun (void); + void DoRun (void); double m_simTime; uint32_t m_bytesRx; @@ -100,7 +100,7 @@ AcousticModemEnergyTestCase::RxPacket (Ptr dev, Ptr pkt return true; } -bool +void AcousticModemEnergyTestCase::DoRun () { // create a generic node @@ -187,7 +187,6 @@ AcousticModemEnergyTestCase::DoRun () "Incorrect node consumed energy!"); Simulator::Destroy (); - return false; } class AcousticModemEnergyDepletionTestCase : public TestCase @@ -199,7 +198,7 @@ public: void DepletionHandler (void); void SendOnePacket (Ptr node); - bool DoRun (void); + void DoRun (void); double m_simTime; uint32_t m_callbackCount; @@ -242,7 +241,7 @@ AcousticModemEnergyDepletionTestCase::SendOnePacket (Ptr node) node); } -bool +void AcousticModemEnergyDepletionTestCase::DoRun (void) { // create a generic node @@ -287,8 +286,6 @@ AcousticModemEnergyDepletionTestCase::DoRun (void) Simulator::Destroy (); NS_TEST_ASSERT_MSG_EQ (m_callbackCount, 1, "Callback not invoked"); - - return false; } // -------------------------------------------------------------------------- // diff --git a/src/devices/uan/test/uan-test.cc b/src/devices/uan/test/uan-test.cc index 9ba3a223e..c8e9433cd 100644 --- a/src/devices/uan/test/uan-test.cc +++ b/src/devices/uan/test/uan-test.cc @@ -39,7 +39,7 @@ class UanTest : public TestCase public: UanTest (); - virtual bool DoRun (void); + virtual void DoRun (void); private: Ptr CreateNode (Vector pos, Ptr chan); bool DoPhyTests (); @@ -149,11 +149,11 @@ UanTest::DoPhyTests () Ptr prop = CreateObject (); // 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 @@ UanTest::DoPhyTests () #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 @@ UanTest::DoPhyTests () 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 @@ UanTest::DoRun (void) #endif // UAN_PROP_BH_INSTALLED - return DoPhyTests (); - + bool phyTestsError; + phyTestsError = DoPhyTests (); } diff --git a/src/devices/wifi/block-ack-test-suite.cc b/src/devices/wifi/block-ack-test-suite.cc index f0f6382b1..cd94519ff 100644 --- a/src/devices/wifi/block-ack-test-suite.cc +++ b/src/devices/wifi/block-ack-test-suite.cc @@ -64,7 +64,7 @@ public: PacketBufferingCaseA (); virtual ~PacketBufferingCaseA (); private: - virtual bool DoRun (void); + virtual void DoRun (void); std::list m_expectedBuffer; }; @@ -81,7 +81,7 @@ PacketBufferingCaseA::PacketBufferingCaseA () PacketBufferingCaseA::~PacketBufferingCaseA () {} -bool +void PacketBufferingCaseA::DoRun (void) { std::list m_buffer; @@ -110,7 +110,6 @@ PacketBufferingCaseA::DoRun (void) { NS_TEST_EXPECT_MSG_EQ (*i, *j, "error in buffer order"); } - return GetErrorStatus (); } /* ----- = old packets @@ -142,7 +141,7 @@ public: PacketBufferingCaseB (); virtual ~PacketBufferingCaseB (); private: - virtual bool DoRun (void); + virtual void DoRun (void); std::list m_expectedBuffer; }; @@ -160,7 +159,7 @@ PacketBufferingCaseB::PacketBufferingCaseB () PacketBufferingCaseB::~PacketBufferingCaseB () {} -bool +void PacketBufferingCaseB::DoRun (void) { std::list m_buffer; @@ -196,7 +195,6 @@ PacketBufferingCaseB::DoRun (void) { NS_TEST_EXPECT_MSG_EQ (*i, *j, "error in buffer order"); } - return GetErrorStatus (); } //Test for block ack header @@ -205,7 +203,7 @@ class CtrlBAckResponseHeaderTest : public TestCase public: CtrlBAckResponseHeaderTest (); private: - virtual bool DoRun (); + virtual void DoRun (); CtrlBAckResponseHeader m_blockAckHdr; }; @@ -213,7 +211,7 @@ CtrlBAckResponseHeaderTest::CtrlBAckResponseHeaderTest () : TestCase ("Check the correctness of block ack compressed bitmap") {} -bool +void CtrlBAckResponseHeaderTest::DoRun (void) { m_blockAckHdr.SetType (COMPRESSED_BLOCK_ACK); @@ -257,8 +255,6 @@ CtrlBAckResponseHeaderTest::DoRun (void) 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 diff --git a/src/devices/wifi/dcf-manager-test.cc b/src/devices/wifi/dcf-manager-test.cc index 1811d5135..f28dd1404 100644 --- a/src/devices/wifi/dcf-manager-test.cc +++ b/src/devices/wifi/dcf-manager-test.cc @@ -58,7 +58,7 @@ class DcfManagerTest : public TestCase { public: DcfManagerTest (); - virtual bool DoRun (void); + virtual void DoRun (void); void NotifyAccessGranted (uint32_t i); @@ -340,7 +340,7 @@ DcfManagerTest::AddRxStartEvt (uint64_t at, uint64_t duration) -bool +void DcfManagerTest::DoRun (void) { // 0 3 4 5 8 9 10 12 @@ -661,8 +661,6 @@ DcfManagerTest::DoRun (void) AddSwitchingEvt(80,20); AddAccessRequest (101, 2, 110, 0); EndTest (); - - return GetErrorStatus (); } //----------------------------------------------------------------------------- diff --git a/src/devices/wifi/interference-helper-tx-duration-test.cc b/src/devices/wifi/interference-helper-tx-duration-test.cc index 1e48065f5..4a0c24ee7 100644 --- a/src/devices/wifi/interference-helper-tx-duration-test.cc +++ b/src/devices/wifi/interference-helper-tx-duration-test.cc @@ -34,7 +34,7 @@ class InterferenceHelperTxDurationTest : public TestCase public: InterferenceHelperTxDurationTest (); virtual ~InterferenceHelperTxDurationTest (); - virtual bool DoRun (void); + virtual void DoRun (void); private: @@ -109,7 +109,7 @@ InterferenceHelperTxDurationTest::CheckTxDuration(uint32_t size, WifiMode payloa return true; } -bool +void InterferenceHelperTxDurationTest::DoRun (void) { bool retval = true; @@ -178,8 +178,6 @@ InterferenceHelperTxDurationTest::DoRun (void) && 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 diff --git a/src/devices/wifi/wifi-test.cc b/src/devices/wifi/wifi-test.cc index 5bbde095e..cb328fee8 100644 --- a/src/devices/wifi/wifi-test.cc +++ b/src/devices/wifi/wifi-test.cc @@ -45,7 +45,7 @@ class WifiTest : public TestCase public: WifiTest (); - virtual bool DoRun (void); + virtual void DoRun (void); private: void RunOne (void); void CreateOne (Vector pos, Ptr channel); @@ -116,7 +116,7 @@ WifiTest::RunOne (void) Simulator::Stop (Seconds (10.0)); } -bool +void WifiTest::DoRun (void) { m_mac.SetTypeId ("ns3::AdhocWifiMac"); @@ -147,7 +147,6 @@ WifiTest::DoRun (void) m_mac.SetTypeId ("ns3::AdhocWifiMac"); RunOne (); Simulator::Destroy (); - return false; } //----------------------------------------------------------------------------- @@ -155,7 +154,7 @@ class QosUtilsIsOldPacketTest : public TestCase { 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 @@ public: 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 @@ class InterferenceHelperSequenceTest : public TestCase public: InterferenceHelperSequenceTest (); - virtual bool DoRun (void); + virtual void DoRun (void); private: Ptr CreateOne (Vector pos, Ptr channel); void SendOnePacket (Ptr dev); @@ -244,7 +241,7 @@ InterferenceHelperSequenceTest::CreateOne (Vector pos, Ptr chan return node; } -bool +void InterferenceHelperSequenceTest::DoRun (void) { m_mac.SetTypeId ("ns3::AdhocWifiMac"); @@ -284,7 +281,6 @@ InterferenceHelperSequenceTest::DoRun (void) Simulator::Run (); Simulator::Destroy (); - return false; } //----------------------------------------------------------------------------- diff --git a/src/devices/wimax/mac-messages-test.cc b/src/devices/wimax/mac-messages-test.cc index 2e5b3cb94..08e47e9c6 100644 --- a/src/devices/wimax/mac-messages-test.cc +++ b/src/devices/wimax/mac-messages-test.cc @@ -50,7 +50,7 @@ public: virtual ~DsaRequestTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -63,7 +63,7 @@ DsaRequestTestCase::~DsaRequestTestCase () { } -bool +void DsaRequestTestCase::DoRun (void) { IpcsClassifierRecord classifier = IpcsClassifierRecord (); @@ -90,49 +90,16 @@ DsaRequestTestCase::DoRun (void) 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."); } // ============================================================================== diff --git a/src/devices/wimax/phy-test.cc b/src/devices/wimax/phy-test.cc index 29cac9b60..0bf07582f 100644 --- a/src/devices/wimax/phy-test.cc +++ b/src/devices/wimax/phy-test.cc @@ -53,7 +53,7 @@ public: virtual ~Ns3WimaxSimpleOFDMTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); bool DoRunOnce (double); }; @@ -101,7 +101,7 @@ Ns3WimaxSimpleOFDMTestCase::DoRunOnce (double FrameDuration) } -bool +void Ns3WimaxSimpleOFDMTestCase::DoRun (void) { @@ -112,10 +112,9 @@ Ns3WimaxSimpleOFDMTestCase::DoRun (void) std::cout << "Frame Duration = " << frameDuratioTab[i] << std::endl; if (DoRunOnce (frameDuratioTab[i]) != false) { - return true; + return; } } - return false; } /* @@ -129,7 +128,7 @@ public: virtual ~Ns3WimaxSNRtoBLERTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); bool DoRunOnce (uint8_t); }; @@ -159,15 +158,13 @@ bool Ns3WimaxSNRtoBLERTestCase::DoRunOnce (uint8_t modulationType) return false; } -bool +void Ns3WimaxSNRtoBLERTestCase::DoRun (void) { for (int i = 0; i < 7; i++) { DoRunOnce (i); } - - return false; } /* diff --git a/src/devices/wimax/qos-test.cc b/src/devices/wimax/qos-test.cc index 16c1c99eb..28a86ce40 100644 --- a/src/devices/wimax/qos-test.cc +++ b/src/devices/wimax/qos-test.cc @@ -46,7 +46,7 @@ public: virtual ~Ns3WimaxSchedulingTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); bool DoRunOnce (WimaxHelper::SchedulerType scheduler); }; @@ -143,18 +143,17 @@ Ns3WimaxSchedulingTestCase::DoRunOnce (WimaxHelper::SchedulerType scheduler) } -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 @@ public: virtual ~Ns3WimaxSFTypeTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); bool DoRunOnce (ServiceFlow::SchedulingType); }; @@ -262,22 +261,21 @@ Ns3WimaxSFTypeTestCase::DoRunOnce (ServiceFlow::SchedulingType schedulingType) } -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 diff --git a/src/devices/wimax/ss-mac-test.cc b/src/devices/wimax/ss-mac-test.cc index 445f8798d..fa307a224 100644 --- a/src/devices/wimax/ss-mac-test.cc +++ b/src/devices/wimax/ss-mac-test.cc @@ -53,7 +53,7 @@ public: virtual ~Ns3WimaxNetworkEntryTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -66,7 +66,7 @@ Ns3WimaxNetworkEntryTestCase::~Ns3WimaxNetworkEntryTestCase () { } -bool +void Ns3WimaxNetworkEntryTestCase::DoRun (void) { WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE; @@ -96,8 +96,6 @@ Ns3WimaxNetworkEntryTestCase::DoRun (void) "SS[" << i << "] IsNotRegistered"); } Simulator::Destroy (); - return (false); // Test was ok, all the SS are registered - } /* @@ -114,7 +112,7 @@ public: virtual ~Ns3WimaxManagementConnectionsTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -127,7 +125,7 @@ Ns3WimaxManagementConnectionsTestCase::~Ns3WimaxManagementConnectionsTestCase () { } -bool +void Ns3WimaxManagementConnectionsTestCase::DoRun (void) { WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE; @@ -157,8 +155,6 @@ Ns3WimaxManagementConnectionsTestCase::DoRun (void) true, "Management connections for SS[" << i << "] are not allocated"); } Simulator::Destroy (); - return (false); - } class Ns3WimaxSSMacTestSuite : public TestSuite { diff --git a/src/devices/wimax/wimax-fragmentation-test.cc b/src/devices/wimax/wimax-fragmentation-test.cc index 14696de53..52dd06cb0 100644 --- a/src/devices/wimax/wimax-fragmentation-test.cc +++ b/src/devices/wimax/wimax-fragmentation-test.cc @@ -52,7 +52,7 @@ public: virtual ~Ns3WimaxFragmentationTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -65,7 +65,7 @@ Ns3WimaxFragmentationTestCase::~Ns3WimaxFragmentationTestCase () { } -bool +void Ns3WimaxFragmentationTestCase::DoRun (void) { GenericMacHeader gnrcMacHdr; @@ -178,7 +178,6 @@ Ns3WimaxFragmentationTestCase::DoRun (void) delete connectionTx; delete connectionRx; Simulator::Destroy (); - return (testResult); } // ============================================================================== diff --git a/src/devices/wimax/wimax-service-flow-test.cc b/src/devices/wimax/wimax-service-flow-test.cc index f8dabe313..761fef6ac 100644 --- a/src/devices/wimax/wimax-service-flow-test.cc +++ b/src/devices/wimax/wimax-service-flow-test.cc @@ -52,7 +52,7 @@ public: virtual ~Ns3WimaxSfCreationTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -65,7 +65,7 @@ Ns3WimaxSfCreationTestCase::~Ns3WimaxSfCreationTestCase () { } -bool +void Ns3WimaxSfCreationTestCase::DoRun (void) { @@ -153,7 +153,6 @@ Ns3WimaxSfCreationTestCase::DoRun (void) Simulator::Stop (Seconds (duration)); Simulator::Run (); Simulator::Destroy (); - return false; // Test is passed } // ============================================================================== diff --git a/src/devices/wimax/wimax-tlv-test.cc b/src/devices/wimax/wimax-tlv-test.cc index 67de6acd7..a94918d38 100644 --- a/src/devices/wimax/wimax-tlv-test.cc +++ b/src/devices/wimax/wimax-tlv-test.cc @@ -52,7 +52,7 @@ public: virtual ~Ns3WimaxCsParamTlvTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -65,7 +65,7 @@ Ns3WimaxCsParamTlvTestCase::~Ns3WimaxCsParamTlvTestCase () { } -bool +void Ns3WimaxCsParamTlvTestCase::DoRun (void) { @@ -111,42 +111,29 @@ Ns3WimaxCsParamTlvTestCase::DoRun (void) 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 @@ public: virtual ~Ns3WimaxSfTlvTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); }; @@ -173,7 +160,7 @@ Ns3WimaxSfTlvTestCase::~Ns3WimaxSfTlvTestCase () { } -bool +void Ns3WimaxSfTlvTestCase::DoRun (void) { IpcsClassifierRecord classifier = IpcsClassifierRecord (); @@ -199,22 +186,16 @@ Ns3WimaxSfTlvTestCase::DoRun (void) 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."); } // ============================================================================== diff --git a/src/helper/ipv4-address-helper.cc b/src/helper/ipv4-address-helper.cc index d61891271..87e08be15 100644 --- a/src/helper/ipv4-address-helper.cc +++ b/src/helper/ipv4-address-helper.cc @@ -189,7 +189,7 @@ class NetworkAllocatorHelperTestCase : public TestCase public: NetworkAllocatorHelperTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -203,7 +203,7 @@ NetworkAllocatorHelperTestCase::DoTeardown (void) Ipv4AddressGenerator::Reset (); Simulator::Destroy (); } -bool +void NetworkAllocatorHelperTestCase::DoRun (void) { Ipv4Address address; @@ -227,8 +227,6 @@ NetworkAllocatorHelperTestCase::DoRun (void) 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 @@ class AddressAllocatorHelperTestCase : public TestCase public: AddressAllocatorHelperTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -251,7 +249,7 @@ AddressAllocatorHelperTestCase::DoTeardown (void) Simulator::Destroy (); } -bool +void AddressAllocatorHelperTestCase::DoRun (void) { Ipv4Address network; @@ -275,15 +273,13 @@ AddressAllocatorHelperTestCase::DoRun (void) 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 @@ ResetAllocatorHelperTestCase::ResetAllocatorHelperTestCase () : TestCase ("Make sure the reset to base behavior is working") {} -bool +void ResetAllocatorHelperTestCase::DoRun (void) { Ipv4Address network; @@ -332,8 +328,6 @@ ResetAllocatorHelperTestCase::DoRun (void) 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 diff --git a/src/helper/ns2-mobility-helper.cc b/src/helper/ns2-mobility-helper.cc index 556062deb..4a0e73438 100644 --- a/src/helper/ns2-mobility-helper.cc +++ b/src/helper/ns2-mobility-helper.cc @@ -754,7 +754,7 @@ private: { 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 @@ private: { ReferencePoint const & rp = m_reference[m_nextRefPoint]; Ptr node = Names::Find (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 mob = node->GetObject (); - 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 @@ private: 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 @@ private: Names::Clear (); std::remove (m_traceFile.c_str ()); Simulator::Destroy (); - return GetErrorStatus (); } }; diff --git a/src/internet-stack/ipv4-raw-test.cc b/src/internet-stack/ipv4-raw-test.cc index bf347e02c..82017d1fb 100644 --- a/src/internet-stack/ipv4-raw-test.cc +++ b/src/internet-stack/ipv4-raw-test.cc @@ -79,7 +79,7 @@ class Ipv4RawSocketImplTest: public TestCase void SendData_IpHdr (Ptr socket, std::string to); public: - virtual bool DoRun (void); + virtual void DoRun (void); Ipv4RawSocketImplTest (); void ReceivePacket (Ptr socket, Ptr packet, const Address &from); @@ -171,7 +171,7 @@ Ipv4RawSocketImplTest::SendData_IpHdr (Ptr socket, std::string to) Simulator::Run (); } -bool +void Ipv4RawSocketImplTest::DoRun (void) { // Create topology @@ -310,8 +310,6 @@ Ipv4RawSocketImplTest::DoRun (void) m_receivedPacket2 = 0; Simulator::Destroy (); - - return GetErrorStatus (); } //----------------------------------------------------------------------------- class Ipv4RawTestSuite : public TestSuite diff --git a/src/internet-stack/ipv4-test.cc b/src/internet-stack/ipv4-test.cc index d23ef9ac7..0b6a18994 100644 --- a/src/internet-stack/ipv4-test.cc +++ b/src/internet-stack/ipv4-test.cc @@ -48,7 +48,7 @@ public: * \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 () : Ipv4L3ProtocolTestCase::~Ipv4L3ProtocolTestCase () { } -bool +void Ipv4L3ProtocolTestCase::DoRun (void) { Ptr node = CreateObject (); @@ -95,7 +95,6 @@ Ipv4L3ProtocolTestCase::DoRun (void) NS_TEST_ASSERT_MSG_EQ (ifaceAddr4, output, "The addresses should be identical"); Simulator::Destroy (); - return false; } static class IPv4L3ProtocolTestSuite : public TestSuite diff --git a/src/internet-stack/ipv6-extension-header-test-suite.cc b/src/internet-stack/ipv6-extension-header-test-suite.cc index f95a2556e..eb9d5ee33 100644 --- a/src/internet-stack/ipv6-extension-header-test-suite.cc +++ b/src/internet-stack/ipv6-extension-header-test-suite.cc @@ -38,7 +38,7 @@ class TestEmptyOptionField : public TestCase 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 @@ public: 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 @@ class TestOptionWithoutAlignment : public TestCase public: TestOptionWithoutAlignment () : TestCase("TestOptionWithoutAlignment") {} - virtual bool DoRun() + virtual void DoRun() { Ipv6ExtensionDestinationHeader header; OptionWithoutAlignmentHeader optionHeader; @@ -102,8 +100,6 @@ public: 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 @@ class TestOptionWithAlignment : public TestCase public: TestOptionWithAlignment () : TestCase("TestOptionWithAlignment") {} - virtual bool DoRun() + virtual void DoRun() { Ipv6ExtensionDestinationHeader header; OptionWithAlignmentHeader optionHeader; @@ -169,8 +165,6 @@ public: 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 @@ class TestFulfilledAlignment : public TestCase public: TestFulfilledAlignment () : TestCase("TestCorrectAlignment") {} - virtual bool DoRun() + virtual void DoRun() { Ipv6ExtensionDestinationHeader header; Ipv6OptionJumbogramHeader jumboHeader; //has an alignment of 4n+2 @@ -212,8 +206,6 @@ public: 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(); } }; diff --git a/src/internet-stack/ipv6-test.cc b/src/internet-stack/ipv6-test.cc index d4924df33..1bcc55084 100644 --- a/src/internet-stack/ipv6-test.cc +++ b/src/internet-stack/ipv6-test.cc @@ -49,7 +49,7 @@ public: * \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 () : Ipv6L3ProtocolTestCase::~Ipv6L3ProtocolTestCase () { } -bool +void Ipv6L3ProtocolTestCase::DoRun () { Ptr node = CreateObject (); @@ -136,7 +136,6 @@ Ipv6L3ProtocolTestCase::DoRun () 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 { diff --git a/src/internet-stack/tcp-test.cc b/src/internet-stack/tcp-test.cc index 23dd86cc4..e84275e43 100644 --- a/src/internet-stack/tcp-test.cc +++ b/src/internet-stack/tcp-test.cc @@ -57,7 +57,7 @@ public: 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 @@ TcpTestCase::TcpTestCase (uint32_t totalStreamSize, m_serverReadSize (serverReadSize) {} -bool +void TcpTestCase::DoRun (void) { m_currentSourceTxBytes = 0; @@ -152,8 +152,6 @@ TcpTestCase::DoRun (void) "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) diff --git a/src/internet-stack/udp-test.cc b/src/internet-stack/udp-test.cc index 9c22cf78a..271d61fd5 100644 --- a/src/internet-stack/udp-test.cc +++ b/src/internet-stack/udp-test.cc @@ -77,7 +77,7 @@ class UdpSocketLoopbackTest: public TestCase { public: UdpSocketLoopbackTest (); - virtual bool DoRun (void); + virtual void DoRun (void); void ReceivePkt (Ptr socket); Ptr m_receivedPacket; @@ -96,7 +96,7 @@ void UdpSocketLoopbackTest::ReceivePkt (Ptr socket) NS_ASSERT (availableData == m_receivedPacket->GetSize ()); } -bool +void UdpSocketLoopbackTest::DoRun () { Ptr rxNode = CreateObject (); @@ -112,7 +112,6 @@ UdpSocketLoopbackTest::DoRun () 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 @@ class UdpSocketImplTest: public TestCase void SendData (Ptr socket, std::string to); public: - virtual bool DoRun (void); + virtual void DoRun (void); UdpSocketImplTest (); void ReceivePacket (Ptr socket, Ptr packet, const Address &from); @@ -181,7 +180,7 @@ UdpSocketImplTest::SendData (Ptr socket, std::string to) Simulator::Run (); } -bool +void UdpSocketImplTest::DoRun (void) { // Create topology @@ -310,7 +309,6 @@ UdpSocketImplTest::DoRun (void) Simulator::Destroy (); - return GetErrorStatus (); } //----------------------------------------------------------------------------- diff --git a/src/mobility/steady-state-random-waypoint-mobility-model.cc b/src/mobility/steady-state-random-waypoint-mobility-model.cc index 26aa78793..ad98fdb85 100644 --- a/src/mobility/steady-state-random-waypoint-mobility-model.cc +++ b/src/mobility/steady-state-random-waypoint-mobility-model.cc @@ -275,11 +275,11 @@ private: 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 @@ SteadyStateRandomWaypointTest::DoRun (void) Simulator::Stop (Seconds (totalTime)); Simulator::Run (); Simulator::Destroy (); - - return GetErrorStatus (); } void diff --git a/src/mobility/waypoint-mobility-model.cc b/src/mobility/waypoint-mobility-model.cc index d7b0d65c0..d6090feda 100644 --- a/src/mobility/waypoint-mobility-model.cc +++ b/src/mobility/waypoint-mobility-model.cc @@ -235,11 +235,11 @@ private: std::deque waypoints; bool lazyNotify; private: - virtual bool DoRun (void); + virtual void DoRun (void); void ForceUpdates (void); void CourseChangeCallback (std::string path, Ptr model); }; -bool +void WaypointMobilityModelNotifyTest::DoRun (void) { nodeCount = 1; @@ -282,8 +282,6 @@ WaypointMobilityModelNotifyTest::DoRun (void) Simulator::Stop (Seconds ((double)waypointCount + 2.0)); Simulator::Run (); Simulator::Destroy (); - - return GetErrorStatus (); } void WaypointMobilityModelNotifyTest::ForceUpdates (void) diff --git a/src/node/drop-tail-queue.cc b/src/node/drop-tail-queue.cc index 7e7522958..8a6610804 100644 --- a/src/node/drop-tail-queue.cc +++ b/src/node/drop-tail-queue.cc @@ -160,13 +160,13 @@ class DropTailQueueTestCase : public TestCase { 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 queue = CreateObject (); @@ -208,8 +208,6 @@ DropTailQueueTestCase::DoRun (void) 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 diff --git a/src/node/ipv4-address-generator.cc b/src/node/ipv4-address-generator.cc index 3d908309e..718f99380 100644 --- a/src/node/ipv4-address-generator.cc +++ b/src/node/ipv4-address-generator.cc @@ -467,7 +467,7 @@ class NetworkNumberAllocatorTestCase : public TestCase { public: NetworkNumberAllocatorTestCase (); - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -479,7 +479,7 @@ NetworkNumberAllocatorTestCase::DoTeardown (void) { Ipv4AddressGenerator::Reset (); } -bool +void NetworkNumberAllocatorTestCase::DoRun (void) { Ipv4Address network; @@ -510,8 +510,6 @@ NetworkNumberAllocatorTestCase::DoRun (void) 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 @@ class AddressAllocatorTestCase : public TestCase public: AddressAllocatorTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -527,7 +525,7 @@ AddressAllocatorTestCase::AddressAllocatorTestCase () : TestCase ("Sanity check on allocation of addresses") {} -bool +void AddressAllocatorTestCase::DoRun (void) { Ipv4Address address; @@ -552,8 +550,6 @@ AddressAllocatorTestCase::DoRun (void) 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 @@ class NetworkAndAddressTestCase : public TestCase { public: NetworkAndAddressTestCase (); - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -583,7 +579,7 @@ NetworkAndAddressTestCase::DoTeardown (void) Simulator::Destroy (); } -bool +void NetworkAndAddressTestCase::DoRun (void) { Ipv4Address address; @@ -624,7 +620,6 @@ NetworkAndAddressTestCase::DoRun (void) 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 @@ class ExampleAddressGeneratorTestCase : public TestCase public: ExampleAddressGeneratorTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); }; @@ -646,7 +641,7 @@ ExampleAddressGeneratorTestCase::DoTeardown (void) Ipv4AddressGenerator::Reset (); } -bool +void ExampleAddressGeneratorTestCase::DoRun (void) { Ipv4Address address; @@ -676,8 +671,6 @@ ExampleAddressGeneratorTestCase::DoRun (void) // 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 @@ class AddressCollisionTestCase : public TestCase public: AddressCollisionTestCase (); private: - bool DoRun (void); + void DoRun (void); void DoTeardown (void); }; @@ -699,7 +692,7 @@ AddressCollisionTestCase::DoTeardown (void) Ipv4AddressGenerator::Reset (); Simulator::Destroy (); } -bool +void AddressCollisionTestCase::DoRun (void) { Ipv4AddressGenerator::AddAllocated ("0.0.0.5"); @@ -742,8 +735,6 @@ AddressCollisionTestCase::DoRun (void) added = Ipv4AddressGenerator::AddAllocated ("0.0.0.21"); NS_TEST_EXPECT_MSG_EQ (added, false, "XXX"); - - return false; } diff --git a/src/node/ipv4-packet-info-tag.cc b/src/node/ipv4-packet-info-tag.cc index a2290b574..459a070b2 100644 --- a/src/node/ipv4-packet-info-tag.cc +++ b/src/node/ipv4-packet-info-tag.cc @@ -166,7 +166,7 @@ class Ipv4PacketInfoTagTest: public TestCase public: Ipv4PacketInfoTagTest (); private: - virtual bool DoRun (void); + virtual void DoRun (void); void RxCb (Ptr socket); void DoSendData (Ptr socket, std::string to); }; @@ -208,7 +208,7 @@ Ipv4PacketInfoTagTest::DoSendData (Ptr socket, std::string to) } } -bool +void Ipv4PacketInfoTagTest::DoRun (void) { NodeContainer n; @@ -264,8 +264,6 @@ Ipv4PacketInfoTagTest::DoRun (void) &Ipv4PacketInfoTagTest::DoSendData, this, socket, "10.1.1.1"); Simulator::Run (); Simulator::Destroy (); - - return 0; } static class Ipv4PacketInfoTagTestSuite : public TestSuite diff --git a/src/node/ipv6-packet-info-tag.cc b/src/node/ipv6-packet-info-tag.cc index 65edc017a..9d82fa555 100644 --- a/src/node/ipv6-packet-info-tag.cc +++ b/src/node/ipv6-packet-info-tag.cc @@ -165,7 +165,7 @@ class Ipv6PacketInfoTagTest: public TestCase public: Ipv6PacketInfoTagTest (); private: - virtual bool DoRun (void); + virtual void DoRun (void); void RxCb (Ptr socket); void DoSendData (Ptr socket, std::string to); }; @@ -208,7 +208,7 @@ Ipv6PacketInfoTagTest::DoSendData (Ptr socket, std::string to) } } -bool +void Ipv6PacketInfoTagTest::DoRun (void) { NodeContainer n; @@ -274,7 +274,6 @@ Ipv6PacketInfoTagTest::DoRun (void) Simulator::Destroy (); // IPv6 test - return 0; } static class Ipv6PacketInfoTagTestSuite : public TestSuite diff --git a/src/node/packetbb-test-suite.cc b/src/node/packetbb-test-suite.cc index 5a97edf9e..e76f1da0c 100644 --- a/src/node/packetbb-test-suite.cc +++ b/src/node/packetbb-test-suite.cc @@ -37,7 +37,7 @@ public: virtual ~PbbTestCase (void); protected: - virtual bool DoRun (void); + virtual void DoRun (void); private: bool TestSerialize (void); @@ -62,14 +62,13 @@ PbbTestCase::~PbbTestCase (void) 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 @@ PbbTestCase::TestSerialize (void) 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 @@ PbbTestCase::TestDeserialize (void) Ptr newPacket = Create (); 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 (); diff --git a/src/routing/aodv/aodv-id-cache.cc b/src/routing/aodv/aodv-id-cache.cc index 4106ad6c5..5d3c89efb 100644 --- a/src/routing/aodv/aodv-id-cache.cc +++ b/src/routing/aodv/aodv-id-cache.cc @@ -68,7 +68,7 @@ struct IdCacheTest : public TestCase { IdCacheTest () : TestCase ("Id Cache"), cache (Seconds(10)) {} - virtual bool DoRun(); + virtual void DoRun(); void CheckTimeout1 (); void CheckTimeout2 (); void CheckTimeout3 (); @@ -76,7 +76,7 @@ struct IdCacheTest : public TestCase IdCache cache; }; -bool +void IdCacheTest::DoRun () { NS_TEST_EXPECT_MSG_EQ (cache.GetLifeTime(), Seconds(10), "Lifetime"); @@ -97,8 +97,6 @@ IdCacheTest::DoRun () Simulator::Schedule (Seconds(30), &IdCacheTest::CheckTimeout3, this); Simulator::Run (); Simulator::Destroy (); - - return GetErrorStatus (); } void diff --git a/src/routing/aodv/aodv-test-suite.cc b/src/routing/aodv/aodv-test-suite.cc index ec35a4d23..22899f42f 100644 --- a/src/routing/aodv/aodv-test-suite.cc +++ b/src/routing/aodv/aodv-test-suite.cc @@ -33,7 +33,7 @@ namespace aodv 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 @@ NeighborTest::CheckTimeout3 () 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 @@ NeighborTest::DoRun () 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 @@ struct TypeHeaderTest : public TestCase 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 @@ struct RreqHeaderTest : public TestCase 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 @@ struct RreqHeaderTest : public TestCase 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 RreqHeaderTest : public TestCase 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 @@ struct RrepHeaderTest : public TestCase 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 @@ struct RrepAckHeaderTest : public TestCase RrepAckHeaderTest () : TestCase ("AODV RREP-ACK") { } - virtual bool DoRun() + virtual void DoRun() { RrepAckHeader h; Ptr p = Create (); @@ -228,7 +223,6 @@ struct RrepAckHeaderTest : public TestCase 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 @@ struct RerrHeaderTest : public TestCase RerrHeaderTest () : TestCase ("AODV RERR") { } - virtual bool DoRun() + virtual void DoRun() { RerrHeader h; h.SetNoDelete(true); @@ -257,7 +251,6 @@ struct RerrHeaderTest : public TestCase 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 @@ struct QueueEntryTest : public TestCase void Error (Ptr, const Ipv4Header &, Socket::SocketErrno) {} void Unicast2 (Ptr route, Ptr packet, const Ipv4Header & header) {} void Error2 (Ptr, const Ipv4Header &, Socket::SocketErrno) {} - virtual bool DoRun() + virtual void DoRun() { Ptr packet = Create (); Ipv4Header h; @@ -296,8 +289,6 @@ struct QueueEntryTest : public TestCase 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 QueueEntryTest : public TestCase struct AodvRqueueTest : public TestCase { AodvRqueueTest () : TestCase ("Rqueue"), q (64, Seconds (30)) {} - virtual bool DoRun (); + virtual void DoRun (); void Unicast (Ptr route, Ptr packet, const Ipv4Header & header) {} void Error (Ptr, const Ipv4Header &, Socket::SocketErrno) {} void CheckSizeLimit (); @@ -314,7 +305,7 @@ struct AodvRqueueTest : public TestCase RequestQueue q; }; -bool +void AodvRqueueTest::DoRun () { NS_TEST_EXPECT_MSG_EQ (q.GetMaxQueueLen (), 64, "trivial"); @@ -371,8 +362,6 @@ AodvRqueueTest::DoRun () Simulator::Run (); Simulator::Destroy (); - - return GetErrorStatus (); } void @@ -403,7 +392,7 @@ AodvRqueueTest::CheckTimeout () struct AodvRtableEntryTest : public TestCase { AodvRtableEntryTest () : TestCase ("RtableEntry") {} - virtual bool DoRun() + virtual void DoRun() { Ptr dev; Ipv4InterfaceAddress iface; @@ -475,7 +464,6 @@ struct AodvRtableEntryTest : public TestCase rt.GetPrecursors (prec); NS_TEST_EXPECT_MSG_EQ (prec.size (), 2, "trivial"); Simulator::Destroy (); - return GetErrorStatus (); } }; //----------------------------------------------------------------------------- @@ -483,7 +471,7 @@ struct AodvRtableEntryTest : public TestCase 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 @@ struct AodvRtableTest : public TestCase 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 (); } }; //----------------------------------------------------------------------------- diff --git a/src/routing/aodv/test/aodv-regression.cc b/src/routing/aodv/test/aodv-regression.cc index b6ad03e62..808df27fa 100644 --- a/src/routing/aodv/test/aodv-regression.cc +++ b/src/routing/aodv/test/aodv-regression.cc @@ -89,7 +89,7 @@ ChainRegressionTest::~ChainRegressionTest () delete m_nodes; } -bool +void ChainRegressionTest::DoRun () { SeedManager::SetSeed(12345); @@ -110,7 +110,6 @@ ChainRegressionTest::DoRun () if (!WRITE_VECTORS) CheckResults (); delete m_nodes, m_nodes = 0; - return GetErrorStatus (); } void diff --git a/src/routing/aodv/test/aodv-regression.h b/src/routing/aodv/test/aodv-regression.h index fe6499473..63dad5330 100644 --- a/src/routing/aodv/test/aodv-regression.h +++ b/src/routing/aodv/test/aodv-regression.h @@ -187,7 +187,7 @@ private: /// Compare traces with reference ones void CheckResults (); /// Go - bool DoRun (); + void DoRun (); }; } diff --git a/src/routing/aodv/test/bug-772.cc b/src/routing/aodv/test/bug-772.cc index c24ca11af..f63271162 100644 --- a/src/routing/aodv/test/bug-772.cc +++ b/src/routing/aodv/test/bug-772.cc @@ -70,7 +70,7 @@ Bug772ChainTest::~Bug772ChainTest () delete m_nodes; } -bool +void Bug772ChainTest::DoRun () { SeedManager::SetSeed(12345); @@ -85,7 +85,6 @@ Bug772ChainTest::DoRun () if (!WRITE_VECTORS) CheckResults (); delete m_nodes, m_nodes = 0; - return GetErrorStatus (); } void diff --git a/src/routing/aodv/test/bug-772.h b/src/routing/aodv/test/bug-772.h index 0e5dd1bfd..9fd8b0c2f 100644 --- a/src/routing/aodv/test/bug-772.h +++ b/src/routing/aodv/test/bug-772.h @@ -71,7 +71,7 @@ private: /// Compare traces with reference ones void CheckResults (); /// Go - bool DoRun (); + void DoRun (); }; } diff --git a/src/routing/aodv/test/loopback.cc b/src/routing/aodv/test/loopback.cc index 5c2764cb0..85176d42a 100644 --- a/src/routing/aodv/test/loopback.cc +++ b/src/routing/aodv/test/loopback.cc @@ -54,7 +54,7 @@ PingRtt (std::string context, Time rtt) g_count ++; } -bool +void LoopbackTestCase::DoRun () { NodeContainer nodes; @@ -97,7 +97,6 @@ LoopbackTestCase::DoRun () // Check that 4 packets delivered NS_TEST_ASSERT_MSG_EQ (g_count, 4, "Exactly 4 ping replies must be delivered."); - return GetErrorStatus (); } } diff --git a/src/routing/aodv/test/loopback.h b/src/routing/aodv/test/loopback.h index fb883d776..bf1377cd4 100644 --- a/src/routing/aodv/test/loopback.h +++ b/src/routing/aodv/test/loopback.h @@ -36,7 +36,7 @@ struct LoopbackTestCase : public TestCase { LoopbackTestCase () : TestCase ("Ping 127.0.0.1 test") {} /// Run test - bool DoRun (); + void DoRun (); }; } diff --git a/src/routing/dsdv/test/dsdv-testcase.cc b/src/routing/dsdv/test/dsdv-testcase.cc index cbe56e1ea..13f233a85 100644 --- a/src/routing/dsdv/test/dsdv-testcase.cc +++ b/src/routing/dsdv/test/dsdv-testcase.cc @@ -53,7 +53,7 @@ class DsdvHeaderTestCase : public TestCase public: DsdvHeaderTestCase (); ~DsdvHeaderTestCase (); - virtual bool + virtual void DoRun (void); }; DsdvHeaderTestCase::DsdvHeaderTestCase () @@ -63,7 +63,7 @@ DsdvHeaderTestCase::DsdvHeaderTestCase () DsdvHeaderTestCase::~DsdvHeaderTestCase () { } -bool +void DsdvHeaderTestCase::DoRun () { Ptr packet = Create (); @@ -96,8 +96,6 @@ DsdvHeaderTestCase::DoRun () 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 @@ class DsdvTableTestCase : public TestCase public: DsdvTableTestCase (); ~DsdvTableTestCase (); - virtual bool + virtual void DoRun (void); }; @@ -116,7 +114,7 @@ DsdvTableTestCase::DsdvTableTestCase () DsdvTableTestCase::~DsdvTableTestCase () { } -bool +void DsdvTableTestCase::DoRun () { dsdv::RoutingTable rtable; @@ -184,7 +182,6 @@ DsdvTableTestCase::DoRun () NS_TEST_ASSERT_MSG_EQ (rtable.RoutingTableSize (),4,"Rtable size incorrect"); } Simulator::Destroy (); - return GetErrorStatus (); } class DsdvTestSuite : public TestSuite diff --git a/src/routing/global-routing/model/global-route-manager-impl.cc b/src/routing/global-routing/model/global-route-manager-impl.cc index cf1542e50..a1d62178e 100644 --- a/src/routing/global-routing/model/global-route-manager-impl.cc +++ b/src/routing/global-routing/model/global-route-manager-impl.cc @@ -2201,13 +2201,13 @@ class GlobalRouteManagerImplTestCase : public TestCase { 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 @@ GlobalRouteManagerImplTestCase::DoRun(void) // XXX // No testing has actually been done other than making sure that this code // does not crash - return GetErrorStatus (); } diff --git a/src/routing/list-routing/model/ipv4-list-routing.cc b/src/routing/list-routing/model/ipv4-list-routing.cc index 4195b7083..a5d017a65 100644 --- a/src/routing/list-routing/model/ipv4-list-routing.cc +++ b/src/routing/list-routing/model/ipv4-list-routing.cc @@ -333,13 +333,13 @@ class Ipv4ListRoutingNegativeTestCase : public TestCase { public: Ipv4ListRoutingNegativeTestCase(); - virtual bool DoRun (void); + virtual void DoRun (void); }; Ipv4ListRoutingNegativeTestCase::Ipv4ListRoutingNegativeTestCase() : TestCase("Check negative priorities") {} -bool +void Ipv4ListRoutingNegativeTestCase::DoRun (void) { Ptr lr = CreateObject (); @@ -354,22 +354,19 @@ Ipv4ListRoutingNegativeTestCase::DoRun (void) Ptr 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 lr = CreateObject (); @@ -389,9 +386,6 @@ Ipv4ListRoutingPositiveTestCase::DoRun (void) Ptr 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 diff --git a/src/routing/list-routing/model/ipv6-list-routing.cc b/src/routing/list-routing/model/ipv6-list-routing.cc index a053038a1..f06b7489a 100644 --- a/src/routing/list-routing/model/ipv6-list-routing.cc +++ b/src/routing/list-routing/model/ipv6-list-routing.cc @@ -376,13 +376,13 @@ namespace ns3 { { public: Ipv6ListRoutingNegativeTestCase(); - virtual bool DoRun (void); + virtual void DoRun (void); }; Ipv6ListRoutingNegativeTestCase::Ipv6ListRoutingNegativeTestCase() : TestCase("Check negative priorities") {} - bool + void Ipv6ListRoutingNegativeTestCase::DoRun (void) { Ptr lr = CreateObject (); @@ -397,22 +397,19 @@ namespace ns3 { Ptr 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 lr = CreateObject (); @@ -432,9 +429,6 @@ namespace ns3 { Ptr 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 diff --git a/src/routing/olsr/model/olsr-header.cc b/src/routing/olsr/model/olsr-header.cc index 2c7faf4e2..55c6acccb 100644 --- a/src/routing/olsr/model/olsr-header.cc +++ b/src/routing/olsr/model/olsr-header.cc @@ -509,13 +509,13 @@ namespace ns3 { 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 @@ OlsrEmfTestCase::DoRun (void) 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 @@ OlsrMidTestCase::DoRun (void) 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 @@ OlsrHelloTestCase::DoRun (void) 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 @@ OlsrTcTestCase::DoRun (void) 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 @@ OlsrHnaTestCase::DoRun (void) NS_TEST_ASSERT_MSG_EQ (packet.GetSize (), 0, "All bytes in packet were not read"); - return false; } diff --git a/src/routing/olsr/model/olsr-routing-protocol.cc b/src/routing/olsr/model/olsr-routing-protocol.cc index b8c47f264..a739b424c 100644 --- a/src/routing/olsr/model/olsr-routing-protocol.cc +++ b/src/routing/olsr/model/olsr-routing-protocol.cc @@ -3204,7 +3204,7 @@ OlsrMprTestCase::OlsrMprTestCase () OlsrMprTestCase::~OlsrMprTestCase () { } -bool +void OlsrMprTestCase::DoRun () { Ptr protocol = CreateObject (); @@ -3311,8 +3311,6 @@ OlsrMprTestCase::DoRun () 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 diff --git a/src/routing/olsr/model/olsr-routing-protocol.h b/src/routing/olsr/model/olsr-routing-protocol.h index cbc087698..7239aa9e0 100644 --- a/src/routing/olsr/model/olsr-routing-protocol.h +++ b/src/routing/olsr/model/olsr-routing-protocol.h @@ -69,7 +69,7 @@ public: OlsrMprTestCase (); ~OlsrMprTestCase (); /// \brief Run test case - virtual bool DoRun (void); + virtual void DoRun (void); ; }; diff --git a/src/routing/olsr/test/bug780-test.cc b/src/routing/olsr/test/bug780-test.cc index f4a328c0e..54bf21c5d 100644 --- a/src/routing/olsr/test/bug780-test.cc +++ b/src/routing/olsr/test/bug780-test.cc @@ -74,7 +74,7 @@ Bug780Test::~Bug780Test() { } -bool +void Bug780Test::DoRun () { SeedManager::SetSeed(123); @@ -88,7 +88,6 @@ Bug780Test::DoRun () { CheckResults (); } - return GetErrorStatus (); } void diff --git a/src/routing/olsr/test/bug780-test.h b/src/routing/olsr/test/bug780-test.h index 6afef5d6b..1bbc8d7d8 100644 --- a/src/routing/olsr/test/bug780-test.h +++ b/src/routing/olsr/test/bug780-test.h @@ -41,7 +41,7 @@ private: /// Compare traces with reference ones void CheckResults (); /// Go - bool DoRun (); + void DoRun (); }; } diff --git a/src/routing/olsr/test/hello-regression-test.cc b/src/routing/olsr/test/hello-regression-test.cc index 5b50ff432..9f8fbca31 100644 --- a/src/routing/olsr/test/hello-regression-test.cc +++ b/src/routing/olsr/test/hello-regression-test.cc @@ -51,7 +51,7 @@ HelloRegressionTest::~HelloRegressionTest() { } -bool +void HelloRegressionTest::DoRun () { SeedManager::SetSeed(12345); @@ -62,7 +62,6 @@ HelloRegressionTest::DoRun () Simulator::Destroy (); if (!WRITE_VECTORS) CheckResults (); - return GetErrorStatus (); } void diff --git a/src/routing/olsr/test/hello-regression-test.h b/src/routing/olsr/test/hello-regression-test.h index e43f1890b..8db6ebadd 100644 --- a/src/routing/olsr/test/hello-regression-test.h +++ b/src/routing/olsr/test/hello-regression-test.h @@ -61,7 +61,7 @@ private: /// Compare traces with reference ones void CheckResults (); /// Go - bool DoRun (); + void DoRun (); }; } diff --git a/src/routing/olsr/test/tc-regression-test.cc b/src/routing/olsr/test/tc-regression-test.cc index bd518a707..442bdece3 100644 --- a/src/routing/olsr/test/tc-regression-test.cc +++ b/src/routing/olsr/test/tc-regression-test.cc @@ -56,7 +56,7 @@ TcRegressionTest::~TcRegressionTest() { } -bool +void TcRegressionTest::DoRun () { SeedManager::SetSeed(12345); @@ -67,7 +67,6 @@ TcRegressionTest::DoRun () Simulator::Destroy (); if (!WRITE_VECTORS) CheckResults (); - return GetErrorStatus (); } void diff --git a/src/routing/olsr/test/tc-regression-test.h b/src/routing/olsr/test/tc-regression-test.h index db6610a13..ccc5c15f4 100644 --- a/src/routing/olsr/test/tc-regression-test.h +++ b/src/routing/olsr/test/tc-regression-test.h @@ -88,7 +88,7 @@ private: /// Compare traces with reference ones void CheckResults (); /// Go - bool DoRun (); + void DoRun (); }; } diff --git a/src/simulator/high-precision-128.cc b/src/simulator/high-precision-128.cc index 9af6b040c..b494b84bd 100644 --- a/src/simulator/high-precision-128.cc +++ b/src/simulator/high-precision-128.cc @@ -290,7 +290,7 @@ class HpFracTestCase : public TestCase { public: HpFracTestCase (); - virtual bool DoRun (void); + virtual void DoRun (void); void CheckFrac (int64_t hi, uint64_t lo); }; @@ -308,14 +308,13 @@ HpFracTestCase::HpFracTestCase () : 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 @@ class HpInputTestCase : public TestCase { 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 @@ HpInputTestCase::CheckString (std::string str, int64_t hi, uint64_t lo) 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 @@ HpInputTestCase::DoRun (void) 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 @@ HpInputOutputTestCase::CheckString (std::string str) 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 @@ HpInputOutputTestCase::DoRun (void) CheckString ("-1.08446744073709551615"); CheckString ("+1.18446744073709551615"); CheckString ("-1.18446744073709551615"); - - return GetErrorStatus (); } diff --git a/src/simulator/high-precision.cc b/src/simulator/high-precision.cc index 07ef53579..dee930f2d 100644 --- a/src/simulator/high-precision.cc +++ b/src/simulator/high-precision.cc @@ -55,14 +55,14 @@ class HpArithmeticTestCase : public TestCase { 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 @@ HpArithmeticTestCase::DoRun (void) 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 @@ HpBug455TestCase::DoRun (void) 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 @@ class HpBug863TestCase : public TestCase { 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 @@ HpBug863TestCase::DoRun (void) 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 @@ HpCompareTestCase::DoRun (void) 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 @@ HpInvertTestCase::HpInvertTestCase () { } -bool +void HpInvertTestCase::DoRun (void) { #define TEST(factor) \ @@ -342,7 +334,6 @@ HpInvertTestCase::DoRun (void) TEST(100000000000000LL); TEST(1000000000000000LL); #undef TEST - return GetErrorStatus (); } diff --git a/src/simulator/simulator.cc b/src/simulator/simulator.cc index d91501b6b..08238596f 100644 --- a/src/simulator/simulator.cc +++ b/src/simulator/simulator.cc @@ -393,7 +393,7 @@ class SimulatorEventsTestCase : public TestCase { 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 @@ SimulatorEventsTestCase::destroy (void) m_destroy = true; } } -bool +void SimulatorEventsTestCase::DoRun (void) { m_a = true; @@ -528,8 +528,6 @@ SimulatorEventsTestCase::DoRun (void) 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 @@ public: 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 @@ static void cber5 (const int &, const int &, const int &, const int &, const int 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 @@ SimulatorTemplateTestCase::DoRun (void) Simulator::Run (); Simulator::Destroy (); - - return false; } class SimulatorTestSuite : public TestSuite diff --git a/src/simulator/time.cc b/src/simulator/time.cc index d8502c0f6..0cad1f4dd 100644 --- a/src/simulator/time.cc +++ b/src/simulator/time.cc @@ -198,7 +198,7 @@ class Bug863TestCase : public TestCase { public: Bug863TestCase (); - virtual bool DoRun (void); + virtual void DoRun (void); }; Bug863TestCase::Bug863TestCase () @@ -206,11 +206,10 @@ Bug863TestCase::Bug863TestCase () { } -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 @@ class TimeSimpleTestCase : public TestCase 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 @@ TimeSimpleTestCase::TimeSimpleTestCase (enum Time::Unit resolution) : TestCase ("Sanity check of common time operations"), m_resolution (resolution) {} -bool +void TimeSimpleTestCase::DoRun (void) { m_originalResolution = Time::GetResolution (); @@ -251,7 +250,6 @@ TimeSimpleTestCase::DoRun (void) NS_TEST_ASSERT_MSG_EQ (FemtoSeconds (1).GetFemtoSeconds (), 1, "is 1fs really 1fs ?"); #endif - return false; } void @@ -265,14 +263,14 @@ class ArithTestCase : public TestCase 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 @@ ArithTestCase::DoRun (void) x = a != b; //a = 1.0; //a = 1; - return false; } diff --git a/src/simulator/timer.cc b/src/simulator/timer.cc index 5b3dafc6f..dcf48fb54 100644 --- a/src/simulator/timer.cc +++ b/src/simulator/timer.cc @@ -213,14 +213,14 @@ class TimerStateTestCase : public TestCase { 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 @@ TimerStateTestCase::DoRun (void) 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 @@ TimerTemplateTestCase::TimerTemplateTestCase () { } -bool +void TimerTemplateTestCase::DoRun (void) { Timer timer = Timer (Timer::CANCEL_ON_DESTROY); @@ -361,8 +360,6 @@ TimerTemplateTestCase::DoRun (void) Simulator::Run (); Simulator::Destroy (); - - return false; } void diff --git a/src/simulator/watchdog.cc b/src/simulator/watchdog.cc index 0a6b2d346..42d0d7428 100644 --- a/src/simulator/watchdog.cc +++ b/src/simulator/watchdog.cc @@ -67,7 +67,7 @@ class WatchdogTestCase : public TestCase { public: WatchdogTestCase (); - virtual bool DoRun (void); + virtual void DoRun (void); void Expire (Time expected); bool m_expired; Time m_expiredTime; @@ -86,7 +86,7 @@ WatchdogTestCase::Expire (Time expected) m_expiredArgument = expected; } -bool +void WatchdogTestCase::DoRun (void) { m_expired = false; @@ -104,8 +104,6 @@ WatchdogTestCase::DoRun (void) 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; } diff --git a/src/test/csma-system-test-suite.cc b/src/test/csma-system-test-suite.cc index 4902ec5ba..a66d257f0 100644 --- a/src/test/csma-system-test-suite.cc +++ b/src/test/csma-system-test-suite.cc @@ -58,7 +58,7 @@ public: virtual ~CsmaBridgeTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); void SinkRx (Ptr p, const Address &ad); uint32_t m_count; }; @@ -91,7 +91,7 @@ CsmaBridgeTestCase::SinkRx (Ptr p, const Address &ad) // // - 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 @@ CsmaBridgeTestCase::DoRun (void) // 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 @@ public: virtual ~CsmaBroadcastTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); void SinkRxNode1 (Ptr p, const Address &ad); void SinkRxNode2 (Ptr p, const Address &ad); void DropEvent (Ptr p); @@ -216,7 +214,7 @@ CsmaBroadcastTestCase::DropEvent (Ptr p) // 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 @@ CsmaBroadcastTestCase::DoRun (void) // 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 @@ public: virtual ~CsmaMulticastTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); void SinkRx (Ptr p, const Address &ad); void DropEvent (Ptr p); uint32_t m_count; @@ -334,7 +330,7 @@ CsmaMulticastTestCase::DropEvent (Ptr p) // - 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 @@ CsmaMulticastTestCase::DoRun (void) // 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 @@ public: virtual ~CsmaOneSubnetTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); void SinkRxNode0 (Ptr p, const Address &ad); void SinkRxNode1 (Ptr p, const Address &ad); void DropEvent (Ptr p); @@ -501,7 +495,7 @@ CsmaOneSubnetTestCase::DropEvent (Ptr p) // - 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 @@ CsmaOneSubnetTestCase::DoRun (void) // 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 @@ public: virtual ~CsmaPacketSocketTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); void SinkRx (std::string path, Ptr p, const Address &address); void DropEvent (Ptr p); uint32_t m_count; @@ -626,7 +618,7 @@ CsmaPacketSocketTestCase::DropEvent (Ptr p) // -- 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 @@ CsmaPacketSocketTestCase::DoRun (void) // 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 @@ public: virtual ~CsmaPingTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); void SinkRx (Ptr p, const Address &ad); void PingRtt (std::string context, Time rtt); void DropEvent (Ptr p); @@ -743,7 +733,7 @@ CsmaPingTestCase::DropEvent (Ptr p) // 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 @@ CsmaPingTestCase::DoRun (void) // 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 @@ public: virtual ~CsmaRawIpSocketTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); void SinkRx (Ptr p, const Address &ad); void DropEvent (Ptr p); uint32_t m_count; @@ -861,7 +849,7 @@ CsmaRawIpSocketTestCase::DropEvent (Ptr p) // 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 @@ CsmaRawIpSocketTestCase::DoRun (void) // 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 @@ public: virtual ~CsmaStarTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); void SinkRx (Ptr p, const Address &ad); void DropEvent (Ptr p); uint32_t m_count; @@ -970,7 +956,7 @@ CsmaStarTestCase::DropEvent (Ptr p) // ======= ======= . // CSMA CSMA . // -bool +void CsmaStarTestCase::DoRun (void) { // @@ -1099,8 +1085,6 @@ CsmaStarTestCase::DoRun (void) // 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 diff --git a/src/test/error-model-test-suite.cc b/src/test/error-model-test-suite.cc index f3eca0225..47071979c 100644 --- a/src/test/error-model-test-suite.cc +++ b/src/test/error-model-test-suite.cc @@ -45,7 +45,7 @@ public: virtual ~ErrorModelSimple (); private: - virtual bool DoRun (void); + virtual void DoRun (void); bool Receive (Ptr nd, Ptr p, uint16_t protocol, const Address& addr); void DropEvent (Ptr p); uint32_t m_count; @@ -75,10 +75,9 @@ ErrorModelSimple::DropEvent (Ptr p) 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 @@ ErrorModelSimple::DoRun (void) // 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 diff --git a/src/test/global-routing-test-suite.cc b/src/test/global-routing-test-suite.cc index 9482577c4..326760bec 100644 --- a/src/test/global-routing-test-suite.cc +++ b/src/test/global-routing-test-suite.cc @@ -55,7 +55,7 @@ public: private: void SinkRx (std::string path, Ptr p, const Address &address); void HandleRead (Ptr); - virtual bool DoRun (void); + virtual void DoRun (void); int m_count; std::vector m_firstInterface; std::vector m_secondInterface; @@ -137,7 +137,7 @@ DynamicGlobalRoutingTestCase::HandleRead (Ptr socket) // 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 @@ DynamicGlobalRoutingTestCase::DoRun (void) 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 @@ public: 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 @@ GlobalRoutingSlash32TestCase::~GlobalRoutingSlash32TestCase () // // (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 nA = CreateObject (); @@ -390,8 +388,6 @@ GlobalRoutingSlash32TestCase::DoRun (void) Ptr sinkPtr = DynamicCast (apps.Get (0)); NS_TEST_ASSERT_MSG_EQ (sinkPtr->GetTotalRx (), 6656, "Static routing with /32 did not deliver all packets"); Simulator::Destroy (); - - return GetErrorStatus (); } diff --git a/src/test/mobility-test-suite.cc b/src/test/mobility-test-suite.cc index ec1d86214..abf771b73 100644 --- a/src/test/mobility-test-suite.cc +++ b/src/test/mobility-test-suite.cc @@ -45,7 +45,7 @@ public: private: void TestXPosition (double expectedXPos); void CourseChangeCallback (std::string path, Ptr model); - virtual bool DoRun (void); + virtual void DoRun (void); Ptr m_node; Ptr m_mob; int m_courseChanges; @@ -76,7 +76,7 @@ WaypointLazyNotifyFalse::CourseChangeCallback (std::string path, Ptr (); @@ -93,7 +93,6 @@ WaypointLazyNotifyFalse::DoRun (void) Simulator::Schedule (Seconds (5.0), &WaypointLazyNotifyFalse::TestXPosition, this, 5); Simulator::Run (); Simulator::Destroy (); - return GetErrorStatus (); } class WaypointLazyNotifyTrue : public TestCase @@ -105,7 +104,7 @@ public: private: void TestXPosition (double expectedXPos); void CourseChangeCallback (std::string path, Ptr model); - virtual bool DoRun (void); + virtual void DoRun (void); Ptr m_node; Ptr m_mob; }; @@ -134,7 +133,7 @@ WaypointLazyNotifyTrue::CourseChangeCallback (std::string path, Ptr (); @@ -151,7 +150,6 @@ WaypointLazyNotifyTrue::DoRun (void) Simulator::Schedule (Seconds (15.0), &WaypointLazyNotifyTrue::TestXPosition, this, 15); Simulator::Run (); Simulator::Destroy (); - return GetErrorStatus (); } class WaypointInitialPositionIsWaypoint : public TestCase @@ -163,7 +161,7 @@ public: private: void TestXPosition (Ptr model, double expectedXPos); void TestNumWaypoints (Ptr model, uint32_t num); - virtual bool DoRun (void); + virtual void DoRun (void); Ptr m_mob1; Ptr m_mob2; Ptr m_mob3; @@ -193,7 +191,7 @@ WaypointInitialPositionIsWaypoint::TestNumWaypoints (PtrWaypointsLeft (), num, "Unexpected number of waypoints left"); } -bool +void WaypointInitialPositionIsWaypoint::DoRun (void) { // Case 1: InitialPositionIsWaypoint == false, and we call SetPosition @@ -276,7 +274,6 @@ WaypointInitialPositionIsWaypoint::DoRun (void) Simulator::Run (); Simulator::Destroy (); - return GetErrorStatus (); } class WaypointMobilityModelViaHelper : public TestCase @@ -287,7 +284,7 @@ public: private: void TestXPosition (Ptr mob, double expectedXPos); - virtual bool DoRun (void); + virtual void DoRun (void); }; WaypointMobilityModelViaHelper::WaypointMobilityModelViaHelper () @@ -307,7 +304,7 @@ WaypointMobilityModelViaHelper::TestXPosition (Ptr } // WaypointMobilityModel tests using the helper -bool +void WaypointMobilityModelViaHelper::DoRun (void) { NodeContainer c; @@ -355,7 +352,6 @@ WaypointMobilityModelViaHelper::DoRun (void) Simulator::Run (); Simulator::Destroy (); - return GetErrorStatus (); } class MobilityTestSuite : public TestSuite diff --git a/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc b/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc index f249bdb8e..75a40a8c9 100644 --- a/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc +++ b/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc @@ -180,7 +180,7 @@ public: virtual ~Ns3TcpCwndTestCase1 (); private: - virtual bool DoRun (void); + virtual void DoRun (void); bool m_writeResults; class CwndEvent { @@ -215,7 +215,7 @@ Ns3TcpCwndTestCase1::CwndChange (uint32_t oldCwnd, uint32_t newCwnd) m_responses.Add (event); } -bool +void Ns3TcpCwndTestCase1::DoRun (void) { // @@ -359,8 +359,6 @@ Ns3TcpCwndTestCase1::DoRun (void) 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 @@ public: virtual ~Ns3TcpCwndTestCase2 (); private: - virtual bool DoRun (void); + virtual void DoRun (void); bool m_writeResults; class CwndEvent { @@ -420,7 +418,7 @@ Ns3TcpCwndTestCase2::CwndChange (uint32_t oldCwnd, uint32_t newCwnd) m_responses.Add (event); } -bool +void Ns3TcpCwndTestCase2::DoRun (void) { // Set up some default values for the simulation. @@ -558,8 +556,6 @@ Ns3TcpCwndTestCase2::DoRun (void) // 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 @@ Ns3TcpCwndTestSuite::Ns3TcpCwndTestSuite () AddTestCase (new Ns3TcpCwndTestCase2); } -static Ns3TcpCwndTestSuite ns3TcpCwndTestSuite; +Ns3TcpCwndTestSuite ns3TcpCwndTestSuite; diff --git a/src/test/ns3tcp/ns3tcp-interop-test-suite.cc b/src/test/ns3tcp/ns3tcp-interop-test-suite.cc index ab2e4dd06..1fba99f94 100644 --- a/src/test/ns3tcp/ns3tcp-interop-test-suite.cc +++ b/src/test/ns3tcp/ns3tcp-interop-test-suite.cc @@ -84,7 +84,7 @@ public: private: virtual void DoSetup (void); - virtual bool DoRun (void); + virtual void DoRun (void); virtual void DoTeardown (void); void Ipv4L3Tx (std::string context, Ptr packet, Ptr ipv4, uint32_t interface); @@ -191,7 +191,7 @@ Ns3TcpInteroperabilityTestCase::Ipv4L3Tx (std::string context, Ptr } } -bool +void Ns3TcpInteroperabilityTestCase::DoRun (void) { // @@ -297,8 +297,6 @@ Ns3TcpInteroperabilityTestCase::DoRun (void) Simulator::Stop (Seconds(20)); Simulator::Run (); Simulator::Destroy (); - - return GetErrorStatus (); } class Ns3TcpInteroperabilityTestSuite : public TestSuite diff --git a/src/test/ns3tcp/ns3tcp-loss-test-suite.cc b/src/test/ns3tcp/ns3tcp-loss-test-suite.cc index 756e920b1..3afaf6ea5 100644 --- a/src/test/ns3tcp/ns3tcp-loss-test-suite.cc +++ b/src/test/ns3tcp/ns3tcp-loss-test-suite.cc @@ -58,7 +58,7 @@ public: 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 @@ Ns3TcpLossTestCase1::Ipv4L3Tx (std::string context, Ptr packet, Pt } } -bool +void Ns3TcpLossTestCase1::DoRun (void) { uint16_t sinkPort = 50000; @@ -232,8 +232,6 @@ Ns3TcpLossTestCase1::DoRun (void) Simulator::Stop (simStopTimeObj); Simulator::Run (); Simulator::Destroy (); - - return GetErrorStatus (); } class Ns3TcpLossTestCase2 : public TestCase @@ -244,7 +242,7 @@ public: 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 @@ Ns3TcpLossTestCase2::Ipv4L3Tx (std::string context, Ptr packet, Pt } } -bool +void Ns3TcpLossTestCase2::DoRun (void) { uint16_t sinkPort = 50000; @@ -414,8 +412,6 @@ Ns3TcpLossTestCase2::DoRun (void) Simulator::Stop (simStopTimeObj); Simulator::Run (); Simulator::Destroy (); - - return GetErrorStatus (); } class Ns3TcpLossTestSuite : public TestSuite diff --git a/src/test/ns3tcp/ns3tcp-socket-test-suite.cc b/src/test/ns3tcp/ns3tcp-socket-test-suite.cc index b417358e0..d983cb8e6 100644 --- a/src/test/ns3tcp/ns3tcp-socket-test-suite.cc +++ b/src/test/ns3tcp/ns3tcp-socket-test-suite.cc @@ -52,7 +52,7 @@ public: virtual ~Ns3TcpSocketTestCase1 () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); bool m_writeResults; void SinkRx (std::string path, Ptr p, const Address &address); @@ -73,7 +73,7 @@ Ns3TcpSocketTestCase1::SinkRx (std::string path, Ptr p, const Addr m_responses.Add (p->GetSize ()); } -bool +void Ns3TcpSocketTestCase1::DoRun (void) { uint16_t sinkPort = 50000; @@ -148,8 +148,6 @@ Ns3TcpSocketTestCase1::DoRun (void) 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 @@ public: virtual ~Ns3TcpSocketTestCase2 () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); bool m_writeResults; void SinkRx (std::string path, Ptr p, const Address &address); @@ -180,7 +178,7 @@ Ns3TcpSocketTestCase2::SinkRx (std::string path, Ptr p, const Addr m_responses.Add (p->GetSize ()); } -bool +void Ns3TcpSocketTestCase2::DoRun (void) { uint16_t sinkPort = 50000; @@ -262,8 +260,6 @@ Ns3TcpSocketTestCase2::DoRun (void) 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 diff --git a/src/test/ns3wifi/wifi-interference-test-suite.cc b/src/test/ns3wifi/wifi-interference-test-suite.cc index cf8245398..effea94ed 100644 --- a/src/test/ns3wifi/wifi-interference-test-suite.cc +++ b/src/test/ns3wifi/wifi-interference-test-suite.cc @@ -56,7 +56,7 @@ public: virtual ~WifiInterferenceTestCase (); private: - virtual bool DoRun (void); + virtual void DoRun (void); void ReceivePacket (Ptr socket); static void GenerateTraffic (Ptr 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 @@ WifiInterferenceTestCase::WifiSimpleInterference (std::string phyMode,double Prs return m_PER; } -bool +void WifiInterferenceTestCase::DoRun (void) { @@ -261,8 +261,6 @@ WifiInterferenceTestCase::DoRun (void) 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 diff --git a/src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc b/src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc index e02f4db25..705bda6c5 100644 --- a/src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc +++ b/src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc @@ -47,7 +47,7 @@ class WifiMsduAggregatorThroughputTest : public TestCase { public: WifiMsduAggregatorThroughputTest (); - virtual bool DoRun (void); + virtual void DoRun (void); private: bool m_writeResults; @@ -59,7 +59,7 @@ WifiMsduAggregatorThroughputTest::WifiMsduAggregatorThroughputTest () { } -bool +void WifiMsduAggregatorThroughputTest::DoRun (void) { WifiHelper wifi = WifiHelper::Default (); @@ -188,8 +188,6 @@ WifiMsduAggregatorThroughputTest::DoRun (void) NS_TEST_ASSERT_MSG_GT(totalOctetsThrough, 600000, "A-MSDU test fails for low throughput of " << totalOctetsThrough << " octets"); - - return false; } diff --git a/src/test/nsctcp/nsctcp-loss-test-suite.cc b/src/test/nsctcp/nsctcp-loss-test-suite.cc index ea5cfdc47..ed126e4f1 100644 --- a/src/test/nsctcp/nsctcp-loss-test-suite.cc +++ b/src/test/nsctcp/nsctcp-loss-test-suite.cc @@ -54,7 +54,7 @@ public: virtual ~NscTcpLossTestCase1 () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); bool m_writeResults; void SinkRx (std::string path, Ptr p, const Address &address); @@ -75,7 +75,7 @@ NscTcpLossTestCase1::SinkRx (std::string path, Ptr p, const Addres m_responses.Add (p->GetSize ()); } -bool +void NscTcpLossTestCase1::DoRun (void) { uint16_t sinkPort = 50000; @@ -153,8 +153,6 @@ NscTcpLossTestCase1::DoRun (void) 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 @@ public: virtual ~NscTcpLossTestCase2 () {} private: - virtual bool DoRun (void); + virtual void DoRun (void); bool m_writeResults; void SinkRx (std::string path, Ptr p, const Address &address); @@ -185,7 +183,7 @@ NscTcpLossTestCase2::SinkRx (std::string path, Ptr p, const Addres m_responses.Add (p->GetSize ()); } -bool +void NscTcpLossTestCase2::DoRun (void) { uint16_t sinkPort = 50000; @@ -262,8 +260,6 @@ NscTcpLossTestCase2::DoRun (void) 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 diff --git a/src/test/sample-test-suite.cc b/src/test/sample-test-suite.cc index 7b6e2f4b6..3a667540a 100644 --- a/src/test/sample-test-suite.cc +++ b/src/test/sample-test-suite.cc @@ -15,7 +15,7 @@ public: 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 @@ SampleTestCase1::~SampleTestCase1 () // 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, diff --git a/src/test/static-routing-test-suite.cc b/src/test/static-routing-test-suite.cc index 4be8e7cc8..b9f3c006e 100644 --- a/src/test/static-routing-test-suite.cc +++ b/src/test/static-routing-test-suite.cc @@ -49,7 +49,7 @@ public: 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 @@ StaticRoutingSlash32TestCase::~StaticRoutingSlash32TestCase () // // (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 nA = CreateObject (); @@ -155,8 +155,6 @@ StaticRoutingSlash32TestCase::DoRun (void) Ptr sinkPtr = DynamicCast (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