20 #include "ns3/config.h" 22 #include "ns3/integer.h" 23 #include "ns3/traced-value.h" 24 #include "ns3/trace-source-accessor.h" 25 #include "ns3/callback.h" 27 #include "ns3/singleton.h" 28 #include "ns3/object.h" 29 #include "ns3/object-vector.h" 30 #include "ns3/names.h" 31 #include "ns3/pointer.h" 33 #include "ns3/unused.h" 95 int8_t
GetA (
void)
const;
100 int8_t
GetB (
void)
const;
117 .AddAttribute (
"NodesA",
"",
120 MakeObjectVectorChecker<ConfigTestObject> ())
121 .AddAttribute (
"NodesB",
"",
124 MakeObjectVectorChecker<ConfigTestObject> ())
125 .AddAttribute (
"NodeA",
"",
128 MakePointerChecker<ConfigTestObject> ())
129 .AddAttribute (
"NodeB",
"",
132 MakePointerChecker<ConfigTestObject> ())
133 .AddAttribute (
"A",
"",
136 MakeIntegerChecker<int8_t> ())
137 .AddAttribute (
"B",
"",
140 MakeIntegerChecker<int8_t> ())
141 .AddAttribute (
"Source",
"XX",
144 MakeIntegerChecker<int16_t> ())
145 .AddTraceSource (
"Source",
"XX",
147 "ns3::TracedValueCallback::Int16")
242 .AddAttribute (
"X",
"",
245 MakeIntegerChecker<int8_t> ())
291 virtual void DoRun (
void);
295 :
TestCase (
"Check ability to register a root namespace and use it")
313 root->GetAttribute (
"A", iv);
321 root->GetAttribute (
"A", iv);
327 root->GetAttribute (
"B", iv);
335 root->GetAttribute (
"B", iv);
352 virtual void DoRun (
void);
356 :
TestCase (
"Check ability to register an object under the root namespace and use it")
377 a->GetAttribute (
"A", iv);
385 a->GetAttribute (
"A", iv);
392 a->GetAttribute (
"B", iv);
400 a->GetAttribute (
"B", iv);
407 a->GetAttribute (
"A", iv);
411 a->GetAttribute (
"B", iv);
422 b->GetAttribute (
"A", iv);
424 b->GetAttribute (
"B", iv);
435 b->GetAttribute (
"A", iv);
437 b->GetAttribute (
"B", iv);
445 a->GetAttribute (
"A", iv);
447 b->GetAttribute (
"A", iv);
464 virtual void DoRun (
void);
468 :
TestCase (
"Check ability to configure vectors of Object using regular expressions")
514 obj0->GetAttribute (
"A", iv);
517 obj1->GetAttribute (
"A", iv);
520 obj2->GetAttribute (
"A", iv);
523 obj3->GetAttribute (
"A", iv);
531 obj0->GetAttribute (
"A", iv);
534 obj1->GetAttribute (
"A", iv);
537 obj2->GetAttribute (
"A", iv);
540 obj3->GetAttribute (
"A", iv);
547 obj0->GetAttribute (
"A", iv);
550 obj1->GetAttribute (
"A", iv);
553 obj2->GetAttribute (
"A", iv);
556 obj3->GetAttribute (
"A", iv);
563 obj0->GetAttribute (
"A", iv);
566 obj1->GetAttribute (
"A", iv);
569 obj2->GetAttribute (
"A", iv);
572 obj3->GetAttribute (
"A", iv);
579 obj0->GetAttribute (
"A", iv);
582 obj1->GetAttribute (
"A", iv);
585 obj2->GetAttribute (
"A", iv);
588 obj3->GetAttribute (
"A", iv);
595 obj0->GetAttribute (
"A", iv);
598 obj1->GetAttribute (
"A", iv);
601 obj2->GetAttribute (
"A", iv);
604 obj3->GetAttribute (
"A", iv);
625 void Trace (int16_t oldValue, int16_t newValue)
644 virtual void DoRun (
void);
651 :
TestCase (
"Check ability to trace connect through vectors of Object using regular expressions")
795 virtual void DoRun (
void);
800 :
TestCase (
"Check that attributes of base class are searchable from paths including objects of derived class")
826 a->AggregateObject (derived);
828 derived->GetAttribute (
"X", iv);
static TypeId GetTypeId(void)
Get the type ID.
static TypeId GetTypeId(void)
Get the type ID.
void TraceWithPath(std::string path, int16_t old, int16_t newValue)
Trace callback with context path.
std::string m_path
The context path.
Test for the ability to register and use a root namespace.
void AddNodeA(Ptr< ConfigTestObject > a)
Add node A function.
virtual ~ObjectVectorTraceConfigTestCase()
Destructor.
virtual ~SearchAttributesOfParentObjectsTestCase()
Destructor.
Smart pointer class similar to boost::intrusive_ptr.
BaseConfigObject(void)
Constructor.
virtual ~BaseConfigObject(void)
Destructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~RootNamespaceConfigTestCase()
Destructor.
static TypeId GetTypeId(void)
Get the type ID.
void Set(std::string path, const AttributeValue &value)
DerivedConfigTestObject(void)
Constructor.
static TypeId GetTypeId(void)
Get the type ID.
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
static ConfigTestSuite g_configTestSuite
ConfigTestSuite instance variable.
Hold a signed integer type.
ConfigTestSuite()
Constructor.
#define NS_UNUSED(x)
Mark a local variable as unused.
void SetNodeA(Ptr< ConfigTestObject > a)
Set node A function.
Test for the ability to search attributes of parent classes when Resolver searches for attributes in ...
Test for the ability to trace configure with vectors of objects.
virtual ~ObjectVectorConfigTestCase()
Destructor.
void RegisterRootNamespaceObject(Ptr< Object > obj)
RootNamespaceConfigTestCase()
Constructor.
Ptr< ConfigTestObject > m_nodeB
NodeB attribute target.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
int8_t m_a
A attribute target.
The Test Suite that glues all of the Test Cases together.
Test for the ability to add an object under the root namespace.
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
SearchAttributesOfParentObjectsTestCase()
Constructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
UnderRootNamespaceConfigTestCase()
Constructor.
std::vector< Ptr< ConfigTestObject > > m_nodesA
NodesA attribute target.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Ptr< ConfigTestObject > m_nodeA
NodeA attribute target.
TracedValue< int16_t > m_trace
Source TraceSource target.
#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.
void SetNodeB(Ptr< ConfigTestObject > b)
Set node b function.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
virtual ~DerivedConfigObject(void)
Destructor.
void AddNodeB(Ptr< ConfigTestObject > b)
Add node B function.
void Connect(std::string path, const CallbackBase &cb)
An object with some attributes that we can play with using config.
void Increment(void)
Silence unused variable warning.
DerivedConfigObject(void)
Constructor.
int8_t m_b
B attribute target.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr<T>.
std::vector< Ptr< ConfigTestObject > > m_nodesB
NodesB attribute target.
ObjectVectorTraceConfigTestCase()
Constructor.
int8_t m_x
X attribute target.
int8_t GetB(void) const
Get node b function.
int16_t m_newValue
Flag to detect tracing result.
int8_t GetA(void) const
Get node A function.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~DerivedConfigTestObject(void)
Destructor.
virtual ~UnderRootNamespaceConfigTestCase()
Destructor.
A base class which provides memory management and object aggregation.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Container for a set of ns3::Object pointers.
Test for the ability to deal configure with vectors of objects.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void Trace(int16_t oldValue, int16_t newValue)
Trace callback without context.
ObjectVectorConfigTestCase()
Constructor.