|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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);
Test for the ability to trace configure with vectors of objects.
a unique identifier for an interface.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static TypeId GetTypeId(void)
Get the type ID.
void Set(std::string path, const AttributeValue &value)
ConfigTestSuite()
Constructor.
TracedValue< int16_t > m_trace
Source TraceSource target.
void Trace(int16_t oldValue, int16_t newValue)
Trace callback without context.
void Increment(void)
Silence unused variable warning.
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
std::vector< Ptr< ConfigTestObject > > m_nodesA
NodesA attribute target.
virtual ~DerivedConfigTestObject(void)
Destructor.
virtual ~SearchAttributesOfParentObjectsTestCase()
Destructor.
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
virtual ~UnderRootNamespaceConfigTestCase()
Destructor.
int8_t m_b
B attribute target.
void AddNodeA(Ptr< ConfigTestObject > a)
Add node A function.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TypeId GetTypeId(void)
Get the type ID.
Hold a signed integer type.
int8_t m_x
X attribute target.
BaseConfigObject(void)
Constructor.
void RegisterRootNamespaceObject(Ptr< Object > obj)
virtual ~ObjectVectorTraceConfigTestCase()
Destructor.
Hold objects of type Ptr<T>.
Container for a set of ns3::Object pointers.
static TypeId GetTypeId(void)
Get the type ID.
static TypeId GetTypeId(void)
Get the type ID.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
UnderRootNamespaceConfigTestCase()
Constructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void TraceWithPath(std::string path, int16_t old, int16_t newValue)
Trace callback with context path.
The Test Suite that glues all of the Test Cases together.
ObjectVectorTraceConfigTestCase()
Constructor.
Smart pointer class similar to boost::intrusive_ptr.
DerivedConfigObject(void)
Constructor.
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
void AddNodeB(Ptr< ConfigTestObject > b)
Add node B function.
static ConfigTestSuite g_configTestSuite
ConfigTestSuite instance variable.
SearchAttributesOfParentObjectsTestCase()
Constructor.
A base class which provides memory management and object aggregation.
virtual ~ObjectVectorConfigTestCase()
Destructor.
int8_t GetA(void) const
Get node A function.
void SetNodeA(Ptr< ConfigTestObject > a)
Set node A function.
#define NS_UNUSED(x)
Mark a local variable as unused.
virtual void DoRun(void)
Implementation to actually run this TestCase.
RootNamespaceConfigTestCase()
Constructor.
Test for the ability to register and use a root namespace.
virtual void DoRun(void)
Implementation to actually run this TestCase.
int8_t GetB(void) const
Get node b function.
std::string m_path
The context path.
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...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
virtual ~BaseConfigObject(void)
Destructor.
int16_t m_newValue
Flag to detect tracing result.
virtual ~DerivedConfigObject(void)
Destructor.
ObjectVectorConfigTestCase()
Constructor.
#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 Connect(std::string path, const CallbackBase &cb)
Test for the ability to search attributes of parent classes when Resolver searches for attributes in ...
Ptr< ConfigTestObject > m_nodeB
NodeB attribute target.
DerivedConfigTestObject(void)
Constructor.
virtual ~RootNamespaceConfigTestCase()
Destructor.
std::vector< Ptr< ConfigTestObject > > m_nodesB
NodesB attribute target.
An object with some attributes that we can play with using config.
Test for the ability to deal configure with vectors of objects.
int8_t m_a
A attribute target.
Ptr< ConfigTestObject > m_nodeA
NodeA attribute target.
Test for the ability to add an object under the root namespace.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void SetNodeB(Ptr< ConfigTestObject > b)
Set node b function.