improve test output upon failure
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 03 May 2011 11:18:41 +0200
changeset 7114 0e7da904832a
parent 7113 148950a6deaa
child 7115 fbd9480a0b7f
improve test output upon failure
src/network/test/buffer-test.cc
--- a/src/network/test/buffer-test.cc	Tue May 03 11:18:09 2011 +0200
+++ b/src/network/test/buffer-test.cc	Tue May 03 11:18:41 2011 +0200
@@ -9,7 +9,7 @@
 //-----------------------------------------------------------------------------
 class BufferTest : public TestCase {
 private:
-  void EnsureWrittenBytes (Buffer b, uint32_t n, uint8_t array[]);
+  void EnsureWrittenBytes (Buffer b, uint32_t n, uint8_t array[], const char *file, int line);
 public:
   virtual void DoRun (void);
   BufferTest ();
@@ -21,7 +21,7 @@
 }
 
 void
-BufferTest::EnsureWrittenBytes (Buffer b, uint32_t n, uint8_t array[])
+BufferTest::EnsureWrittenBytes (Buffer b, uint32_t n, uint8_t array[], const char *file, int line)
 {
   bool success = true;
   uint8_t *expected = array;
@@ -53,7 +53,7 @@
           failure << (uint16_t)got[j] << " ";
         }
       failure << std::endl;
-      NS_TEST_ASSERT_MSG_EQ(true, false, failure.str());
+      NS_TEST_ASSERT_MSG_EQ_INTERNAL(true, false, failure.str(), file, line);
     }
 }
 
@@ -64,7 +64,7 @@
 #define ENSURE_WRITTEN_BYTES(buffer, n, ...)			\
   {								\
     uint8_t bytes[] = {__VA_ARGS__};				\
-    EnsureWrittenBytes (buffer,	n, bytes);			\
+    EnsureWrittenBytes (buffer,	n, bytes, __FILE__, __LINE__);	\
   }
 
 void