|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
18 #include "ns3/names.h"
54 .SetGroupName (
"Core")
55 .HideFromDocumentation ()
79 .SetGroupName (
"Core")
80 .HideFromDocumentation ()
110 virtual void DoRun (
void);
115 :
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")
205 Names::Add (
"/Names/Name One",
"Child", childOfObjectOne);
208 Names::Add (
"/Names/Name Two",
"Child", childOfObjectTwo);
214 NS_TEST_ASSERT_MSG_EQ (found,
"Name Two",
"Could not Names::Add and Names::FindName a second Object");
240 virtual void DoRun (
void);
245 :
TestCase (
"Check fully qualified path Names::Add and Names::FindName functionality")
270 Names::Add (
"/Names/Name One/Child", childOfObjectOne);
273 Names::Add (
"/Names/Name Two/Child", childOfObjectTwo);
279 NS_TEST_ASSERT_MSG_EQ (found,
"Name Two",
"Could not Names::Add and Names::FindName a second Object");
309 virtual void DoRun (
void);
314 :
TestCase (
"Check relative path Names::Add and Names::FindName functionality")
339 Names::Add (
"Name One/Child", childOfObjectOne);
342 Names::Add (
"Name Two/Child", childOfObjectTwo);
348 NS_TEST_ASSERT_MSG_EQ (found,
"Name Two",
"Could not Names::Add and Names::FindName a second Object");
375 virtual void DoRun (
void);
380 :
TestCase (
"Check low level Names::Rename functionality")
401 Names::Add (objectOne,
"Child", childOfObjectOne);
437 virtual void DoRun (
void);
442 :
TestCase (
"Check string context-based Names::Rename functionality")
463 Names::Add (
"/Names/Name",
"Child", childOfObjectOne);
499 virtual void DoRun (
void);
504 :
TestCase (
"Check fully qualified path Names::Rename functionality")
525 Names::Add (
"/Names/Name/Child", childOfObjectOne);
561 virtual void DoRun (
void);
566 :
TestCase (
"Check relative path Names::Rename functionality")
623 virtual void DoRun (
void);
628 :
TestCase (
"Check Names::FindPath functionality")
649 Names::Add (
"/Names/Name/Child", childOfObjectOne);
655 NS_TEST_ASSERT_MSG_EQ (found,
"/Names/Name/Child",
"Could not Names::Add and Names::FindPath a child Object");
678 virtual void DoRun (
void);
683 :
TestCase (
"Check low level Names::Find functionality")
707 Names::Add (
"Name One/Child", childOfObjectOne);
710 Names::Add (
"Name Two/Child", childOfObjectTwo);
712 found = Names::Find<TestObject> (
Ptr<Object> (0,
false),
"Name One");
713 NS_TEST_ASSERT_MSG_EQ (found, objectOne,
"Could not find a previously named Object via object context");
715 found = Names::Find<TestObject> (
Ptr<Object> (0,
false),
"Name Two");
716 NS_TEST_ASSERT_MSG_EQ (found, objectTwo,
"Could not find a previously named Object via object context");
718 found = Names::Find<TestObject> (objectOne,
"Child");
719 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectOne,
"Could not find a previously named child Object via object context");
721 found = Names::Find<TestObject> (objectTwo,
"Child");
722 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo,
"Could not find a previously named child Object via object context");
742 virtual void DoRun (
void);
747 :
TestCase (
"Check string context-based Names::Find functionality")
771 Names::Add (
"Name One/Child", childOfObjectOne);
774 Names::Add (
"Name Two/Child", childOfObjectTwo);
776 found = Names::Find<TestObject> (
"/Names",
"Name One");
777 NS_TEST_ASSERT_MSG_EQ (found, objectOne,
"Could not find a previously named Object via string context");
779 found = Names::Find<TestObject> (
"/Names",
"Name Two");
780 NS_TEST_ASSERT_MSG_EQ (found, objectTwo,
"Could not find a previously named Object via stribng context");
782 found = Names::Find<TestObject> (
"/Names/Name One",
"Child");
783 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectOne,
"Could not find a previously named child Object via string context");
785 found = Names::Find<TestObject> (
"/Names/Name Two",
"Child");
786 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo,
"Could not find a previously named child Object via string context");
806 virtual void DoRun (
void);
811 :
TestCase (
"Check fully qualified path Names::Find functionality")
835 Names::Add (
"/Names/Name One/Child", childOfObjectOne);
838 Names::Add (
"/Names/Name Two/Child", childOfObjectTwo);
840 found = Names::Find<TestObject> (
"/Names/Name One");
841 NS_TEST_ASSERT_MSG_EQ (found, objectOne,
"Could not find a previously named Object via string context");
843 found = Names::Find<TestObject> (
"/Names/Name Two");
844 NS_TEST_ASSERT_MSG_EQ (found, objectTwo,
"Could not find a previously named Object via stribng context");
846 found = Names::Find<TestObject> (
"/Names/Name One/Child");
847 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectOne,
"Could not find a previously named child Object via string context");
849 found = Names::Find<TestObject> (
"/Names/Name Two/Child");
850 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo,
"Could not find a previously named child Object via string context");
870 virtual void DoRun (
void);
875 :
TestCase (
"Check relative path Names::Find functionality")
899 Names::Add (
"Name One/Child", childOfObjectOne);
902 Names::Add (
"Name Two/Child", childOfObjectTwo);
904 found = Names::Find<TestObject> (
"Name One");
905 NS_TEST_ASSERT_MSG_EQ (found, objectOne,
"Could not find a previously named Object via string context");
907 found = Names::Find<TestObject> (
"Name Two");
908 NS_TEST_ASSERT_MSG_EQ (found, objectTwo,
"Could not find a previously named Object via stribng context");
910 found = Names::Find<TestObject> (
"Name One/Child");
911 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectOne,
"Could not find a previously named child Object via string context");
913 found = Names::Find<TestObject> (
"Name Two/Child");
914 NS_TEST_ASSERT_MSG_EQ (found, childOfObjectTwo,
"Could not find a previously named child Object via string context");
931 virtual void DoRun (
void);
936 :
TestCase (
"Check GetObject operation in Names::Find")
955 Names::Add (
"Alternate Test Object", alternateTestObject);
960 foundTestObject = Names::Find<TestObject> (
"Test Object");
962 "Could not find a previously named TestObject via GetObject");
964 foundAlternateTestObject = Names::Find<AlternateTestObject> (
"Alternate Test Object");
966 "Could not find a previously named AlternateTestObject via GetObject");
969 foundAlternateTestObject = Names::Find<AlternateTestObject> (
"Test Object");
971 "Unexpectedly able to GetObject<AlternateTestObject> on a TestObject");
973 foundTestObject = Names::Find<TestObject> (
"Alternate Test Object");
975 "Unexpectedly able to GetObject<TestObject> on an AlternateTestObject");
RelativeFindTestCase()
Constructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
a unique identifier for an interface.
Test the Object Name Service can find Objects.
Test the Object Name Service can correctly use a relative path to add associations.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
FindPathTestCase()
Constructor.
Test the Object Name Service can rename objects using a relative path name.
Test the Object Name Service can correctly use a fully qualified path to add associations.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
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.
virtual ~RelativeRenameTestCase()
Destructor.
BasicRenameTestCase()
Constructor.
virtual ~StringContextFindTestCase()
Destructor.
Test the Object Name Service can do its most basic job.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
StringContextAddTestCase()
Constructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test the Object Name Service can find Objects using a second type.
virtual ~AlternateFindTestCase()
Destructor.
static void Rename(std::string oldpath, std::string newname)
Rename a previously associated name.
AlternateFindTestCase()
Constructor.
virtual ~StringContextRenameTestCase()
Destructor.
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 DoTeardown(void)
Implementation to do any local setup required for this TestCase.
virtual ~FullyQualifiedRenameTestCase()
Destructor.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
virtual ~FullyQualifiedAddTestCase()
Destructor.
virtual ~RelativeFindTestCase()
Destructor.
Test the Object Name Service can correctly use a string context.
static TypeId GetTypeId(void)
Register this type.
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.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Smart pointer class similar to boost::intrusive_ptr.
BasicAddTestCase()
Constructor.
Test the Object Name Service can rename objects using a fully qualified path name.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test the Object Name Service can find Objects using a fully qualified path name.
virtual ~RelativeAddTestCase()
Destructor.
RelativeAddTestCase()
Constructor.
A base class which provides memory management and object aggregation.
static void Clear(void)
Clear the list of objects associated with names.
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,...
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 DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~StringContextAddTestCase()
Destructor.
Simple test object to exercise the Name service.
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.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test the Object Name Service can look up an object and return its fully qualified path name.
static NamesTestSuite g_namesTestSuite
NamesTestSuite instance variable.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test the Object Name Service can find Objects using a relative path name.
#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 void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
StringContextFindTestCase()
Constructor.
Test the Object Name Service can rename objects using a string context.
FullyQualifiedFindTestCase()
Constructor.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
FullyQualifiedAddTestCase()
Constructor.
virtual ~FindPathTestCase()
Destructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~BasicRenameTestCase()
Destructor.
Alternate test object for the Name service.
virtual ~FullyQualifiedFindTestCase()
Destructor.
virtual ~BasicFindTestCase()
Destructor.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
Test the Object Name Service can rename objects.
StringContextRenameTestCase()
Constructor.
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.
NamesTestSuite()
Constructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr<Object> obj.
static TypeId GetTypeId(void)
Register this type.
BasicFindTestCase()
Constructor.
AlternateTestObject()
Constructor.
RelativeRenameTestCase()
Constructor.
FullyQualifiedRenameTestCase()
Constructor.
virtual ~BasicAddTestCase()
Destructor.