18 #include "ns3/names.h" 54 .SetGroupName (
"Core")
55 .HideFromDocumentation ()
78 .SetGroupName (
"Core")
79 .HideFromDocumentation ()
108 virtual void DoRun (
void);
113 :
TestCase (
"Check low level Names::Add and Names::FindName functionality")
139 Names::Add (objectOne,
"Child", childOfObjectOne);
142 Names::Add (objectTwo,
"Child", childOfObjectTwo);
148 NS_TEST_ASSERT_MSG_EQ (found,
"Name Two",
"Could not Names::Add and Names::FindName a second Object");
175 virtual void DoRun (
void);
180 :
TestCase (
"Check string context Names::Add and Names::FindName functionality")
207 Names::Add (
"/Names/Name One",
"Child", childOfObjectOne);
210 Names::Add (
"/Names/Name Two",
"Child", childOfObjectTwo);
216 NS_TEST_ASSERT_MSG_EQ (found,
"Name Two",
"Could not Names::Add and Names::FindName a second Object");
242 virtual void DoRun (
void);
247 :
TestCase (
"Check fully qualified path Names::Add and Names::FindName functionality")
274 Names::Add (
"/Names/Name One/Child", childOfObjectOne);
277 Names::Add (
"/Names/Name Two/Child", childOfObjectTwo);
283 NS_TEST_ASSERT_MSG_EQ (found,
"Name Two",
"Could not Names::Add and Names::FindName a second Object");
313 virtual void DoRun (
void);
318 :
TestCase (
"Check relative path Names::Add and Names::FindName functionality")
345 Names::Add (
"Name One/Child", childOfObjectOne);
348 Names::Add (
"Name Two/Child", childOfObjectTwo);
354 NS_TEST_ASSERT_MSG_EQ (found,
"Name Two",
"Could not Names::Add and Names::FindName a second Object");
381 virtual void DoRun (
void);
386 :
TestCase (
"Check low level Names::Rename functionality")
409 Names::Add (objectOne,
"Child", childOfObjectOne);
445 virtual void DoRun (
void);
450 :
TestCase (
"Check string context-based Names::Rename functionality")
473 Names::Add (
"/Names/Name",
"Child", childOfObjectOne);
509 virtual void DoRun (
void);
514 :
TestCase (
"Check fully qualified path Names::Rename functionality")
537 Names::Add (
"/Names/Name/Child", childOfObjectOne);
573 virtual void DoRun (
void);
578 :
TestCase (
"Check relative path Names::Rename functionality")
637 virtual void DoRun (
void);
642 :
TestCase (
"Check Names::FindPath functionality")
665 Names::Add (
"/Names/Name/Child", childOfObjectOne);
671 NS_TEST_ASSERT_MSG_EQ (found,
"/Names/Name/Child",
"Could not Names::Add and Names::FindPath a child Object");
694 virtual void DoRun (
void);
699 :
TestCase (
"Check low level Names::Find functionality")
725 Names::Add (
"Name One/Child", childOfObjectOne);
728 Names::Add (
"Name Two/Child", childOfObjectTwo);
730 found = Names::Find<TestObject> (
Ptr<Object> (0,
false),
"Name One");
731 NS_TEST_ASSERT_MSG_EQ (found, objectOne,
"Could not find a previously named Object via object context");
733 found = Names::Find<TestObject> (
Ptr<Object> (0,
false),
"Name Two");
734 NS_TEST_ASSERT_MSG_EQ (found, objectTwo,
"Could not find a previously named Object via object context");
736 found = Names::Find<TestObject> (objectOne,
"Child");
737 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectOne,
"Could not find a previously named child Object via object context");
739 found = Names::Find<TestObject> (objectTwo,
"Child");
740 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo,
"Could not find a previously named child Object via object context");
760 virtual void DoRun (
void);
765 :
TestCase (
"Check string context-based Names::Find functionality")
791 Names::Add (
"Name One/Child", childOfObjectOne);
794 Names::Add (
"Name Two/Child", childOfObjectTwo);
796 found = Names::Find<TestObject> (
"/Names",
"Name One");
797 NS_TEST_ASSERT_MSG_EQ (found, objectOne,
"Could not find a previously named Object via string context");
799 found = Names::Find<TestObject> (
"/Names",
"Name Two");
800 NS_TEST_ASSERT_MSG_EQ (found, objectTwo,
"Could not find a previously named Object via stribng context");
802 found = Names::Find<TestObject> (
"/Names/Name One",
"Child");
803 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectOne,
"Could not find a previously named child Object via string context");
805 found = Names::Find<TestObject> (
"/Names/Name Two",
"Child");
806 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo,
"Could not find a previously named child Object via string context");
826 virtual void DoRun (
void);
831 :
TestCase (
"Check fully qualified path Names::Find functionality")
857 Names::Add (
"/Names/Name One/Child", childOfObjectOne);
860 Names::Add (
"/Names/Name Two/Child", childOfObjectTwo);
862 found = Names::Find<TestObject> (
"/Names/Name One");
863 NS_TEST_ASSERT_MSG_EQ (found, objectOne,
"Could not find a previously named Object via string context");
865 found = Names::Find<TestObject> (
"/Names/Name Two");
866 NS_TEST_ASSERT_MSG_EQ (found, objectTwo,
"Could not find a previously named Object via stribng context");
868 found = Names::Find<TestObject> (
"/Names/Name One/Child");
869 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectOne,
"Could not find a previously named child Object via string context");
871 found = Names::Find<TestObject> (
"/Names/Name Two/Child");
872 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo,
"Could not find a previously named child Object via string context");
892 virtual void DoRun (
void);
897 :
TestCase (
"Check relative path Names::Find functionality")
923 Names::Add (
"Name One/Child", childOfObjectOne);
926 Names::Add (
"Name Two/Child", childOfObjectTwo);
928 found = Names::Find<TestObject> (
"Name One");
929 NS_TEST_ASSERT_MSG_EQ (found, objectOne,
"Could not find a previously named Object via string context");
931 found = Names::Find<TestObject> (
"Name Two");
932 NS_TEST_ASSERT_MSG_EQ (found, objectTwo,
"Could not find a previously named Object via stribng context");
934 found = Names::Find<TestObject> (
"Name One/Child");
935 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectOne,
"Could not find a previously named child Object via string context");
937 found = Names::Find<TestObject> (
"Name Two/Child");
938 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo,
"Could not find a previously named child Object via string context");
955 virtual void DoRun (
void);
960 :
TestCase (
"Check GetObject operation in Names::Find")
981 Names::Add (
"Alternate Test Object", alternateTestObject);
986 foundTestObject = Names::Find<TestObject> (
"Test Object");
988 "Could not find a previously named TestObject via GetObject");
990 foundAlternateTestObject = Names::Find<AlternateTestObject> (
"Alternate Test Object");
992 "Could not find a previously named AlternateTestObject via GetObject");
995 foundAlternateTestObject = Names::Find<AlternateTestObject> (
"Test Object");
997 "Unexpectedly able to GetObject<AlternateTestObject> on a TestObject");
999 foundTestObject = Names::Find<TestObject> (
"Alternate Test Object");
1001 "Unexpectedly able to GetObject<TestObject> on an AlternateTestObject");
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
Test the Object Name Service can correctly use a string context.
Test the Object Name Service can find Objects.
Smart pointer class similar to boost::intrusive_ptr.
Test the Object Name Service can rename objects using a string context.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
StringContextRenameTestCase()
Constructor.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~StringContextFindTestCase()
Destructor.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~RelativeAddTestCase()
Destructor.
virtual ~BasicAddTestCase()
Destructor.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
Test the Object Name Service can correctly use a fully qualified path to add associations.
Alternate test object for the Name service.
BasicFindTestCase()
Constructor.
static TypeId GetTypeId(void)
Register this type.
Test the Object Name Service can look up an object and return its fully qualified path name...
Test the Object Name Service can rename objects.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
static TypeId GetTypeId(void)
Register this type.
NamesTestSuite()
Constructor.
RelativeRenameTestCase()
Constructor.
virtual ~FullyQualifiedAddTestCase()
Destructor.
virtual ~BasicRenameTestCase()
Destructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~StringContextRenameTestCase()
Destructor.
Test the Object Name Service can find Objects using a second type.
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr<Object> obj.
virtual ~AlternateFindTestCase()
Destructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
AlternateTestObject()
Constructor.
Test the Object Name Service can correctly use a relative path to add associations.
static void Clear(void)
Clear the list of objects associated with names.
AlternateFindTestCase()
Constructor.
Test the Object Name Service can do its most basic job.
Test the Object Name Service can rename objects using a relative path name.
Simple test object to exercise the Name service.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
virtual void DoRun(void)
Implementation to actually run this TestCase.
FullyQualifiedFindTestCase()
Constructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
virtual ~FullyQualifiedRenameTestCase()
Destructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~RelativeFindTestCase()
Destructor.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
static NamesTestSuite g_namesTestSuite
NamesTestSuite instance variable.
virtual void DoRun(void)
Implementation to actually run this TestCase.
FindPathTestCase()
Constructor.
FullyQualifiedRenameTestCase()
Constructor.
BasicAddTestCase()
Constructor.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
static std::string FindPath(Ptr< Object > object)
Given a pointer to an object, look to see if that object has a name associated with it and return the...
virtual void DoRun(void)
Implementation to actually run this TestCase.
RelativeAddTestCase()
Constructor.
virtual ~RelativeRenameTestCase()
Destructor.
virtual ~BasicFindTestCase()
Destructor.
Test the Object Name Service can rename objects using a fully qualified path name.
Test the Object Name Service can find Objects using a fully qualified path name.
virtual ~FindPathTestCase()
Destructor.
static void Rename(std::string oldpath, std::string newname)
Rename a previously associated name.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~FullyQualifiedFindTestCase()
Destructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static std::string FindName(Ptr< Object > object)
Given a pointer to an object, look to see if that object has a name associated with it and...
Test the Object Name Service can find Objects using a string context.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
A base class which provides memory management and object aggregation.
Test the Object Name Service can find Objects using a relative path name.
BasicRenameTestCase()
Constructor.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
virtual ~StringContextAddTestCase()
Destructor.
a unique identifier for an interface.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
FullyQualifiedAddTestCase()
Constructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
StringContextFindTestCase()
Constructor.
RelativeFindTestCase()
Constructor.
StringContextAddTestCase()
Constructor.