Bug 1476 - TestCase::GetName () should not be private
TestCase::GetName () should not be private
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: test framework
ns-3-dev
All All
: P5 normal
Assigned To: Mitch Watrous
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-24 14:22 UTC by Peter Barnes
Modified: 2012-07-24 20:16 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Barnes 2012-07-24 14:22:17 UTC
TestCase::GetName () is currently private, which prevents derived classes (actual test cases) from using the name in output messages.  For example, 

  std::cout << GetName () << << "checking ..." << std::endl;

to obtain output like

  ---------- begin standard out ----------
  DefaultHash: checking ...

Here's a patch to make GetName protected, not private:

diff -r c1b33a377c2b src/core/model/test.h
--- a/src/core/model/test.h     Thu Jul 12 13:17:22 2012 -0700
+++ b/src/core/model/test.h     Tue Jul 24 11:14:46 2012 -0700
@@ -876,6 +876,11 @@
    */
   bool IsStatusSuccess (void) const;
 
+  /**
+   * \return name of this test
+   */
+  std::string GetName (void) const;
+  
   // The methods below are used only by test macros and should not
   // be used by normal users.
   void ReportTestFailure (std::string cond, std::string actual, 
@@ -916,7 +921,6 @@
 
   // methods called by TestRunnerImpl
   void Run (TestRunnerImpl *runner);
-  std::string GetName (void) const;
   bool IsFailed (void) const;
Comment 1 Mitch Watrous 2012-07-24 20:16:00 UTC
Thanks for the patch.

Bug closed.

ns-3-dev changeset:  518fce9abcf9