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")
250 .AddAttribute (
"X",
"",
253 MakeIntegerChecker<int8_t> ())
302 virtual void DoRun (
void);
306 :
TestCase (
"Check ability to register a root namespace and use it")
323 root->GetAttribute (
"A", iv);
331 root->GetAttribute (
"A", iv);
337 root->GetAttribute (
"B", iv);
345 root->GetAttribute (
"B", iv);
363 virtual void DoRun (
void);
367 :
TestCase (
"Check ability to register an object under the root namespace and use it")
387 a->GetAttribute (
"A", iv);
395 a->GetAttribute (
"A", iv);
402 a->GetAttribute (
"B", iv);
410 a->GetAttribute (
"B", iv);
417 a->GetAttribute (
"A", iv);
421 a->GetAttribute (
"B", iv);
432 b->GetAttribute (
"A", iv);
434 b->GetAttribute (
"B", iv);
445 b->GetAttribute (
"A", iv);
447 b->GetAttribute (
"B", iv);
455 a->GetAttribute (
"A", iv);
457 b->GetAttribute (
"A", iv);
475 virtual void DoRun (
void);
479 :
TestCase (
"Check ability to configure vectors of Object using regular expressions")
524 obj0->GetAttribute (
"A", iv);
527 obj1->GetAttribute (
"A", iv);
530 obj2->GetAttribute (
"A", iv);
533 obj3->GetAttribute (
"A", iv);
541 obj0->GetAttribute (
"A", iv);
544 obj1->GetAttribute (
"A", iv);
547 obj2->GetAttribute (
"A", iv);
550 obj3->GetAttribute (
"A", iv);
557 obj0->GetAttribute (
"A", iv);
560 obj1->GetAttribute (
"A", iv);
563 obj2->GetAttribute (
"A", iv);
566 obj3->GetAttribute (
"A", iv);
573 obj0->GetAttribute (
"A", iv);
576 obj1->GetAttribute (
"A", iv);
579 obj2->GetAttribute (
"A", iv);
582 obj3->GetAttribute (
"A", iv);
589 obj0->GetAttribute (
"A", iv);
592 obj1->GetAttribute (
"A", iv);
595 obj2->GetAttribute (
"A", iv);
598 obj3->GetAttribute (
"A", iv);
605 obj0->GetAttribute (
"A", iv);
608 obj1->GetAttribute (
"A", iv);
611 obj2->GetAttribute (
"A", iv);
614 obj3->GetAttribute (
"A", iv);
636 void Trace (int16_t oldValue, int16_t newValue)
655 virtual void DoRun (
void);
662 :
TestCase (
"Check ability to trace connect through vectors of Object using regular expressions")
806 virtual void DoRun (
void);
811 :
TestCase (
"Check that attributes of base class are searchable from paths including objects of derived class")
836 a->AggregateObject (derived);
838 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.
void Increment(void)
Silence unused variable warning.
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.
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.
virtual void DoRun(void)
Implementation to actually run this TestCase.
ObjectVectorTraceConfigTestCase()
Constructor.
void TraceWithPath(std::string path, int16_t old, int16_t newValue)
Trace callback with context path.
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_UNUSED(x)
Mark a local variable as unused.
#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...