diff --git a/src/network/test/packet-metadata-test.cc b/src/network/test/packet-metadata-test.cc index 254918502..67ea66e02 100644 --- a/src/network/test/packet-metadata-test.cc +++ b/src/network/test/packet-metadata-test.cc @@ -252,7 +252,7 @@ class PacketMetadataTest : public TestCase { public: PacketMetadataTest (); virtual ~PacketMetadataTest (); - bool CheckHistory (Ptr p, const char *file, int line, uint32_t n, ...); + void CheckHistory (Ptr p, const char *file, int line, uint32_t n, ...); virtual void DoRun (void); private: Ptr DoAddHeader (Ptr p); @@ -265,7 +265,7 @@ PacketMetadataTest::PacketMetadataTest () PacketMetadataTest::~PacketMetadataTest () {} -bool +void PacketMetadataTest::CheckHistory (Ptr p, const char *file, int line, uint32_t n, ...) { std::list expected; @@ -333,7 +333,7 @@ PacketMetadataTest::CheckHistory (Ptr p, const char *file, int line, uin goto error; } } - return true; + return; error: std::ostringstream failure; failure << "PacketMetadata error. Got:\""; @@ -349,8 +349,7 @@ PacketMetadataTest::CheckHistory (Ptr p, const char *file, int line, uin failure << *j << ", "; } failure << "\"" << std::endl; - ReportTestFailure ("", "", "", failure.str(), file, line); - return false; + NS_TEST_ASSERT_MSG_EQ_INTERNAL (false, true, failure.str(), file, line); } #define ADD_HEADER(p, n) \ @@ -375,21 +374,13 @@ PacketMetadataTest::CheckHistory (Ptr p, const char *file, int line, uin } #define CHECK_HISTORY(p, ...) \ { \ - if (!CheckHistory (p, __FILE__, \ - __LINE__, __VA_ARGS__)) \ - { \ - result = false; \ - } \ + CheckHistory (p, __FILE__, __LINE__, __VA_ARGS__); \ uint32_t size = p->GetSerializedSize (); \ uint8_t* buffer = new uint8_t[size]; \ p->Serialize (buffer, size); \ Ptr otherPacket = Create (buffer, size, true); \ delete [] buffer; \ - if (!CheckHistory (otherPacket, __FILE__, \ - __LINE__, __VA_ARGS__)) \ - { \ - result = false; \ - } \ + CheckHistory (otherPacket, __FILE__, __LINE__, __VA_ARGS__); \ } @@ -403,8 +394,6 @@ PacketMetadataTest::DoAddHeader (Ptr p) void PacketMetadataTest::DoRun (void) { - bool result = true; - PacketMetadata::Enable (); Ptr p = Create (0); @@ -825,9 +814,6 @@ PacketMetadataTest::DoRun (void) p3->GetSize ()); delete [] buf; NS_TEST_EXPECT_MSG_EQ(msg, std::string("hello world"), "Could not find original data in received packet"); - - - NS_TEST_EXPECT_MSG_EQ(result, true, "PacketMetadataTest failed"); } //----------------------------------------------------------------------------- class PacketMetadataTestSuite : public TestSuite