8#include "ns3/callback.h"
10#include "ns3/integer.h"
13#include "ns3/object-vector.h"
14#include "ns3/object.h"
15#include "ns3/pointer.h"
16#include "ns3/singleton.h"
18#include "ns3/trace-source-accessor.h"
19#include "ns3/traced-value.h"
103 .AddAttribute(
"NodesA",
108 .AddAttribute(
"NodesB",
113 .AddAttribute(
"NodeA",
118 .AddAttribute(
"NodeB",
133 .AddAttribute(
"Source",
138 .AddTraceSource(
"Source",
141 "ns3::TracedValueCallback::Int16");
300 void DoRun()
override;
304 :
TestCase(
"Check ability to register a root namespace and use it")
322 root->GetAttribute(
"A", iv);
330 root->GetAttribute(
"A", iv);
336 root->GetAttribute(
"B", iv);
344 root->GetAttribute(
"B", iv);
364 void DoRun()
override;
368 :
TestCase(
"Check ability to register an object under the root namespace and use it")
389 a->GetAttribute(
"A", iv);
397 a->GetAttribute(
"A", iv);
403 a->GetAttribute(
"B", iv);
411 a->GetAttribute(
"B", iv);
418 a->GetAttribute(
"A", iv);
422 a->GetAttribute(
"B", iv);
433 b->GetAttribute(
"A", iv);
435 b->GetAttribute(
"B", iv);
446 b->GetAttribute(
"A", iv);
448 b->GetAttribute(
"B", iv);
455 a->GetAttribute(
"A", iv);
457 b->GetAttribute(
"A", iv);
477 void DoRun()
override;
481 :
TestCase(
"Check ability to configure vectors of Object using regular expressions")
527 obj0->GetAttribute(
"A", iv);
530 obj1->GetAttribute(
"A", iv);
533 obj2->GetAttribute(
"A", iv);
536 obj3->GetAttribute(
"A", iv);
544 obj0->GetAttribute(
"A", iv);
547 obj1->GetAttribute(
"A", iv);
550 obj2->GetAttribute(
"A", iv);
553 obj3->GetAttribute(
"A", iv);
560 obj0->GetAttribute(
"A", iv);
563 obj1->GetAttribute(
"A", iv);
566 obj2->GetAttribute(
"A", iv);
569 obj3->GetAttribute(
"A", iv);
576 obj0->GetAttribute(
"A", iv);
579 obj1->GetAttribute(
"A", iv);
582 obj2->GetAttribute(
"A", iv);
585 obj3->GetAttribute(
"A", iv);
592 obj0->GetAttribute(
"A", iv);
595 obj1->GetAttribute(
"A", iv);
598 obj2->GetAttribute(
"A", iv);
601 obj3->GetAttribute(
"A", iv);
608 obj0->GetAttribute(
"A", iv);
611 obj1->GetAttribute(
"A", iv);
614 obj2->GetAttribute(
"A", iv);
617 obj3->GetAttribute(
"A", iv);
641 void Trace(int16_t oldValue [[maybe_unused]], int16_t newValue)
652 void TraceWithPath(std::string path, int16_t old [[maybe_unused]], int16_t newValue)
659 void DoRun()
override;
666 :
TestCase(
"Check ability to trace connect through vectors of Object using regular expressions")
762 "/NodeA/NodeB/NodesB/0/Source",
763 "Trace 0 did not provide expected context");
774 "/NodeA/NodeB/NodesB/1/Source",
775 "Trace 1 did not provide expected context");
795 "/NodeA/NodeB/NodesB/1/Source",
796 "Trace 1 did not provide expected context");
819 void DoRun()
override;
823 :
TestCase(
"Check that attributes of base class are searchable from paths including objects of "
850 a->AggregateObject(derived);
852 derived->GetAttribute(
"X", iv);
Hold a signed integer type.
A base class which provides memory management and object aggregation.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Trace classes with value semantics.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
~BaseConfigObject() override
Destructor.
int8_t m_x
X attribute target.
static TypeId GetTypeId()
Get the type ID.
BaseConfigObject()
Constructor.
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.
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.
int8_t GetB() const
Get node b function.
int8_t m_b
B attribute target.
std::vector< Ptr< ConfigTestObject > > m_nodesB
NodesB attribute target.
int8_t m_a
A attribute target.
int8_t GetA() const
Get node A function.
static TypeId GetTypeId()
Get the type ID.
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()
Get the type ID.
~DerivedConfigObject() override
Destructor.
DerivedConfigObject()
Constructor.
~DerivedConfigTestObject() override
Destructor.
static TypeId GetTypeId()
Get the type ID.
DerivedConfigTestObject()
Constructor.
Test for the ability to deal configure with vectors of objects.
void DoRun() override
Implementation to actually run this TestCase.
~ObjectVectorConfigTestCase() override
Destructor.
ObjectVectorConfigTestCase()
Constructor.
Test for the ability to trace configure with vectors of objects.
void Trace(int16_t oldValue, int16_t newValue)
Trace callback without context.
int16_t m_newValue
Flag to detect tracing result.
std::string m_path
The context path.
~ObjectVectorTraceConfigTestCase() override
Destructor.
ObjectVectorTraceConfigTestCase()
Constructor.
void TraceWithPath(std::string path, int16_t old, int16_t newValue)
Trace callback with context path.
void DoRun() override
Implementation to actually run this TestCase.
Test for the ability to register and use a root namespace.
RootNamespaceConfigTestCase()
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
~RootNamespaceConfigTestCase() override
Destructor.
Test for the ability to search attributes of parent classes when Resolver searches for attributes in ...
~SearchAttributesOfParentObjectsTestCase() override
Destructor.
SearchAttributesOfParentObjectsTestCase()
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
Test for the ability to add an object under the root namespace.
void DoRun() override
Implementation to actually run this TestCase.
UnderRootNamespaceConfigTestCase()
Constructor.
~UnderRootNamespaceConfigTestCase() override
Destructor.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
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)
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#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.
Ptr< const AttributeChecker > MakeIntegerChecker()
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Ptr< const AttributeChecker > MakeObjectVectorChecker()
ObjectPtrContainerValue ObjectVectorValue
ObjectVectorValue is an alias for ObjectPtrContainerValue.
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.