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"
94 int8_t
GetA (
void)
const;
99 int8_t
GetB (
void)
const;
116 .AddAttribute (
"NodesA",
"",
119 MakeObjectVectorChecker<ConfigTestObject> ())
120 .AddAttribute (
"NodesB",
"",
123 MakeObjectVectorChecker<ConfigTestObject> ())
124 .AddAttribute (
"NodeA",
"",
127 MakePointerChecker<ConfigTestObject> ())
128 .AddAttribute (
"NodeB",
"",
131 MakePointerChecker<ConfigTestObject> ())
132 .AddAttribute (
"A",
"",
135 MakeIntegerChecker<int8_t> ())
136 .AddAttribute (
"B",
"",
139 MakeIntegerChecker<int8_t> ())
140 .AddAttribute (
"Source",
"XX",
143 MakeIntegerChecker<int16_t> ())
144 .AddTraceSource (
"Source",
"XX",
146 "ns3::TracedValueCallback::Int16")
241 .AddAttribute (
"X",
"",
244 MakeIntegerChecker<int8_t> ())
290 virtual void DoRun (
void);
294 :
TestCase (
"Check ability to register a root namespace and use it")
312 root->GetAttribute (
"A", iv);
320 root->GetAttribute (
"A", iv);
326 root->GetAttribute (
"B", iv);
334 root->GetAttribute (
"B", iv);
351 virtual void DoRun (
void);
355 :
TestCase (
"Check ability to register an object under the root namespace and use it")
376 a->GetAttribute (
"A", iv);
384 a->GetAttribute (
"A", iv);
391 a->GetAttribute (
"B", iv);
399 a->GetAttribute (
"B", iv);
406 a->GetAttribute (
"A", iv);
410 a->GetAttribute (
"B", iv);
421 b->GetAttribute (
"A", iv);
423 b->GetAttribute (
"B", iv);
434 b->GetAttribute (
"A", iv);
436 b->GetAttribute (
"B", iv);
444 a->GetAttribute (
"A", iv);
446 b->GetAttribute (
"A", iv);
463 virtual void DoRun (
void);
467 :
TestCase (
"Check ability to configure vectors of Object using regular expressions")
513 obj0->GetAttribute (
"A", iv);
516 obj1->GetAttribute (
"A", iv);
519 obj2->GetAttribute (
"A", iv);
522 obj3->GetAttribute (
"A", iv);
530 obj0->GetAttribute (
"A", iv);
533 obj1->GetAttribute (
"A", iv);
536 obj2->GetAttribute (
"A", iv);
539 obj3->GetAttribute (
"A", iv);
546 obj0->GetAttribute (
"A", iv);
549 obj1->GetAttribute (
"A", iv);
552 obj2->GetAttribute (
"A", iv);
555 obj3->GetAttribute (
"A", iv);
562 obj0->GetAttribute (
"A", iv);
565 obj1->GetAttribute (
"A", iv);
568 obj2->GetAttribute (
"A", iv);
571 obj3->GetAttribute (
"A", iv);
578 obj0->GetAttribute (
"A", iv);
581 obj1->GetAttribute (
"A", iv);
584 obj2->GetAttribute (
"A", iv);
587 obj3->GetAttribute (
"A", iv);
594 obj0->GetAttribute (
"A", iv);
597 obj1->GetAttribute (
"A", iv);
600 obj2->GetAttribute (
"A", iv);
603 obj3->GetAttribute (
"A", iv);
635 virtual void DoRun (
void);
642 :
TestCase (
"Check ability to trace connect through vectors of Object using regular expressions")
786 virtual void DoRun (
void);
791 :
TestCase (
"Check that attributes of base class are searchable from paths including objects of derived class")
817 a->AggregateObject (derived);
819 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.
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.
int8_t GetA(void) const
Get node A function.
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.
std::vector< Ptr< ConfigTestObject > > m_nodesB
NodesB attribute target.
ObjectVectorTraceConfigTestCase()
Constructor.
int8_t GetB(void) const
Get node b function.
int8_t m_x
X attribute target.
int16_t m_newValue
Flag to detect tracing result.
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.