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"
101 .AddAttribute(
"NodesA",
106 .AddAttribute(
"NodesB",
111 .AddAttribute(
"NodeA",
116 .AddAttribute(
"NodeB",
131 .AddAttribute(
"Source",
136 .AddTraceSource(
"Source",
139 "ns3::TracedValueCallback::Int16");
298 void DoRun()
override;
302 :
TestCase(
"Check ability to register a root namespace and use it")
320 root->GetAttribute(
"A", iv);
328 root->GetAttribute(
"A", iv);
334 root->GetAttribute(
"B", iv);
342 root->GetAttribute(
"B", iv);
362 void DoRun()
override;
366 :
TestCase(
"Check ability to register an object under the root namespace and use it")
387 a->GetAttribute(
"A", iv);
395 a->GetAttribute(
"A", iv);
401 a->GetAttribute(
"B", iv);
409 a->GetAttribute(
"B", iv);
416 a->GetAttribute(
"A", iv);
420 a->GetAttribute(
"B", iv);
431 b->GetAttribute(
"A", iv);
433 b->GetAttribute(
"B", iv);
444 b->GetAttribute(
"A", iv);
446 b->GetAttribute(
"B", iv);
453 a->GetAttribute(
"A", iv);
455 b->GetAttribute(
"A", iv);
475 void DoRun()
override;
479 :
TestCase(
"Check ability to configure vectors of Object using regular expressions")
525 obj0->GetAttribute(
"A", iv);
528 obj1->GetAttribute(
"A", iv);
531 obj2->GetAttribute(
"A", iv);
534 obj3->GetAttribute(
"A", iv);
542 obj0->GetAttribute(
"A", iv);
545 obj1->GetAttribute(
"A", iv);
548 obj2->GetAttribute(
"A", iv);
551 obj3->GetAttribute(
"A", iv);
558 obj0->GetAttribute(
"A", iv);
561 obj1->GetAttribute(
"A", iv);
564 obj2->GetAttribute(
"A", iv);
567 obj3->GetAttribute(
"A", iv);
574 obj0->GetAttribute(
"A", iv);
577 obj1->GetAttribute(
"A", iv);
580 obj2->GetAttribute(
"A", iv);
583 obj3->GetAttribute(
"A", iv);
590 obj0->GetAttribute(
"A", iv);
593 obj1->GetAttribute(
"A", iv);
596 obj2->GetAttribute(
"A", iv);
599 obj3->GetAttribute(
"A", iv);
606 obj0->GetAttribute(
"A", iv);
609 obj1->GetAttribute(
"A", iv);
612 obj2->GetAttribute(
"A", iv);
615 obj3->GetAttribute(
"A", iv);
639 void Trace(int16_t oldValue [[maybe_unused]], int16_t newValue)
650 void TraceWithPath(std::string path, int16_t old [[maybe_unused]], int16_t newValue)
657 void DoRun()
override;
664 :
TestCase(
"Check ability to trace connect through vectors of Object using regular expressions")
760 "/NodeA/NodeB/NodesB/0/Source",
761 "Trace 0 did not provide expected context");
772 "/NodeA/NodeB/NodesB/1/Source",
773 "Trace 1 did not provide expected context");
793 "/NodeA/NodeB/NodesB/1/Source",
794 "Trace 1 did not provide expected context");
817 void DoRun()
override;
821 :
TestCase(
"Check that attributes of base class are searchable from paths including objects of "
848 a->AggregateObject(derived);
850 derived->GetAttribute(
"X", iv);
Hold a signed integer type.
Object()
Caller graph was not generated because of its size.
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.
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new 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.
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 AttributeChecker > MakeIntegerChecker()
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 AttributeChecker > MakeObjectVectorChecker()
ObjectPtrContainerValue ObjectVectorValue
ObjectVectorValue is an alias for ObjectPtrContainerValue.
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.
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
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...
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.
Namespace for test files, TestCases and TestSuites.
Every class exported by the ns3 library is enclosed in the ns3 namespace.