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")
244 .AddAttribute (
"X",
"",
247 MakeIntegerChecker<int8_t> ())
296 virtual void DoRun (
void);
300 :
TestCase (
"Check ability to register a root namespace and use it")
317 root->GetAttribute (
"A", iv);
325 root->GetAttribute (
"A", iv);
331 root->GetAttribute (
"B", iv);
339 root->GetAttribute (
"B", iv);
357 virtual void DoRun (
void);
361 :
TestCase (
"Check ability to register an object under the root namespace and use it")
381 a->GetAttribute (
"A", iv);
389 a->GetAttribute (
"A", iv);
396 a->GetAttribute (
"B", iv);
404 a->GetAttribute (
"B", iv);
411 a->GetAttribute (
"A", iv);
415 a->GetAttribute (
"B", iv);
426 b->GetAttribute (
"A", iv);
428 b->GetAttribute (
"B", iv);
439 b->GetAttribute (
"A", iv);
441 b->GetAttribute (
"B", iv);
449 a->GetAttribute (
"A", iv);
451 b->GetAttribute (
"A", iv);
469 virtual void DoRun (
void);
473 :
TestCase (
"Check ability to configure vectors of Object using regular expressions")
518 obj0->GetAttribute (
"A", iv);
521 obj1->GetAttribute (
"A", iv);
524 obj2->GetAttribute (
"A", iv);
527 obj3->GetAttribute (
"A", iv);
535 obj0->GetAttribute (
"A", iv);
538 obj1->GetAttribute (
"A", iv);
541 obj2->GetAttribute (
"A", iv);
544 obj3->GetAttribute (
"A", iv);
551 obj0->GetAttribute (
"A", iv);
554 obj1->GetAttribute (
"A", iv);
557 obj2->GetAttribute (
"A", iv);
560 obj3->GetAttribute (
"A", iv);
567 obj0->GetAttribute (
"A", iv);
570 obj1->GetAttribute (
"A", iv);
573 obj2->GetAttribute (
"A", iv);
576 obj3->GetAttribute (
"A", iv);
583 obj0->GetAttribute (
"A", iv);
586 obj1->GetAttribute (
"A", iv);
589 obj2->GetAttribute (
"A", iv);
592 obj3->GetAttribute (
"A", iv);
599 obj0->GetAttribute (
"A", iv);
602 obj1->GetAttribute (
"A", iv);
605 obj2->GetAttribute (
"A", iv);
608 obj3->GetAttribute (
"A", iv);
630 void Trace ([[maybe_unused]] int16_t oldValue, int16_t newValue)
640 void TraceWithPath (std::string path, [[maybe_unused]] int16_t old, int16_t newValue)
647 virtual void DoRun (
void);
654 :
TestCase (
"Check ability to trace connect through vectors of Object using regular expressions")
798 virtual void DoRun (
void);
803 :
TestCase (
"Check that attributes of base class are searchable from paths including objects of derived class")
828 a->AggregateObject (derived);
830 derived->GetAttribute (
"X", iv);
Hold a signed integer type.
A base class which provides memory management and object aggregation.
Container for a set of ns3::Object pointers.
Hold objects of type Ptr<T>.
Smart pointer class similar to boost::intrusive_ptr.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
BaseConfigObject(void)
Constructor.
int8_t m_x
X attribute target.
virtual ~BaseConfigObject(void)
Destructor.
static TypeId GetTypeId(void)
Get the type ID.
An object with some attributes that we can play with using config.
void AddNodeB(Ptr< ConfigTestObject > b)
Add node B function.
void AddNodeA(Ptr< ConfigTestObject > a)
Add node A function.
int8_t GetB(void) const
Get node b function.
Ptr< ConfigTestObject > m_nodeA
NodeA attribute target.
std::vector< Ptr< ConfigTestObject > > m_nodesA
NodesA attribute target.
TracedValue< int16_t > m_trace
Source TraceSource target.
void SetNodeB(Ptr< ConfigTestObject > b)
Set node b function.
static TypeId GetTypeId(void)
Get the type ID.
int8_t GetA(void) const
Get node A function.
int8_t m_b
B attribute target.
std::vector< Ptr< ConfigTestObject > > m_nodesB
NodesB attribute target.
int8_t m_a
A attribute target.
void SetNodeA(Ptr< ConfigTestObject > a)
Set node A function.
Ptr< ConfigTestObject > m_nodeB
NodeB attribute target.
The Test Suite that glues all of the Test Cases together.
ConfigTestSuite()
Constructor.
static TypeId GetTypeId(void)
Get the type ID.
DerivedConfigObject(void)
Constructor.
virtual ~DerivedConfigObject(void)
Destructor.
DerivedConfigTestObject(void)
Constructor.
virtual ~DerivedConfigTestObject(void)
Destructor.
static TypeId GetTypeId(void)
Get the type ID.
Test for the ability to deal configure with vectors of objects.
virtual ~ObjectVectorConfigTestCase()
Destructor.
ObjectVectorConfigTestCase()
Constructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test for the ability to trace configure with vectors of objects.
int16_t m_newValue
Flag to detect tracing result.
std::string m_path
The context path.
void TraceWithPath(std::string path, [[maybe_unused]] int16_t old, int16_t newValue)
Trace callback with context path.
void Trace([[maybe_unused]] int16_t oldValue, int16_t newValue)
Trace callback without context.
virtual void DoRun(void)
Implementation to actually run this TestCase.
ObjectVectorTraceConfigTestCase()
Constructor.
virtual ~ObjectVectorTraceConfigTestCase()
Destructor.
Test for the ability to register and use a root namespace.
RootNamespaceConfigTestCase()
Constructor.
virtual ~RootNamespaceConfigTestCase()
Destructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test for the ability to search attributes of parent classes when Resolver searches for attributes in ...
virtual void DoRun(void)
Implementation to actually run this TestCase.
SearchAttributesOfParentObjectsTestCase()
Constructor.
virtual ~SearchAttributesOfParentObjectsTestCase()
Destructor.
Test for the ability to add an object under the root namespace.
virtual ~UnderRootNamespaceConfigTestCase()
Destructor.
UnderRootNamespaceConfigTestCase()
Constructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
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 > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
static ConfigTestSuite g_configTestSuite
ConfigTestSuite instance variable.
void Connect(std::string path, const CallbackBase &cb)
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
void Set(std::string path, const AttributeValue &value)
void RegisterRootNamespaceObject(Ptr< Object > obj)
#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.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...