20#include "ns3/assert.h" 
   21#include "ns3/object-factory.h" 
   22#include "ns3/object.h" 
   84                                     .HideFromDocumentation()
 
  116                                     .SetGroupName(
"Core")
 
  143                                     .SetGroupName(
"Core")
 
  144                                     .HideFromDocumentation()
 
  187    void DoRun() 
override;
 
  191    : 
TestCase(
"Check CreateObject<Type> template function")
 
  210                          "GetObject() of same type returns different Ptr");
 
  217                          "GetObject() of unrelated type returns nonzero pointer");
 
  225                          "GetObject() of unrelated returns nonzero Ptr");
 
  227    baseA = CreateObject<DerivedA>();
 
  230                          "Unable to CreateObject<DerivedA> with implicit cast to BaseA");
 
  244                          "GetObject() of the original type returns different Ptr");
 
  252                          "GetObject returns different Ptr");
 
  268    void DoRun() 
override;
 
  272    : 
TestCase(
"Check Object aggregation functionality")
 
  295    baseA->AggregateObject(baseB);
 
  303                          "Cannot GetObject (through baseA) for BaseA Object");
 
  311                          "Unexpectedly found a DerivedA through baseA");
 
  318                          "Cannot GetObject (through baseA) for BaseB Object");
 
  326                          "Unexpectedly found a DerivedB through baseA");
 
  333                          "Cannot GetObject (through baseB) for BaseB Object");
 
  341                          "Unexpectedly found a DerivedB through baseB");
 
  349                          "Cannot GetObject (through baseB) for BaseA Object");
 
  357                          "Unexpectedly found a DerivedA through baseB");
 
  367                          "Cannot GetObject (through baseBCopy) for a BaseA Object");
 
  372    baseA = CreateObject<DerivedA>();
 
  375                          "Unable to CreateObject<DerivedA> with implicit cast to BaseA");
 
  377    baseB = CreateObject<DerivedB>();
 
  380                          "Unable to CreateObject<DerivedB> with implicit cast to BaseB");
 
  387    baseA->AggregateObject(baseB);
 
  394                          "Cannot GetObject (through baseA) for DerivedB Object");
 
  402                          "Cannot GetObject (through baseA) for BaseB Object");
 
  409                          "Cannot GetObject (through baseB) for DerivedA Object");
 
  417                          "Cannot GetObject (through baseB) for BaseA Object");
 
  428                          "Cannot GetObject (through baseBCopy) for a BaseA Object");
 
  431                          "Cannot GetObject (through baseBCopy) for a BaseA Object");
 
  439                          "Cannot GetObject (through baseB) for DerivedB Object");
 
  447                          "Cannot GetObject (through baseB) for BaseB Object");
 
  454    baseA = CreateObject<BaseA>();
 
  457    baseB = CreateObject<BaseB>();
 
  460    baseA->AggregateObject(baseB);
 
  463    baseA = baseB->GetObject<BaseA>();
 
  480    void DoRun() 
override;
 
  484    : 
TestCase(
"Check ObjectFactory functionality")
 
  509                          "BaseA is unexpectedly a DerivedA also");
 
  516                          "BaseA unexpectedly responds to GetObject for DerivedA");
 
  522    factory.
SetTypeId(DerivedA::GetTypeId());
 
  531                          "Unable to use GetObject as dynamic_cast<BaseA>()");
 
  540                          "GetObject with implied cast returns different Ptr");
 
  549                          "Unexpectedly able to work around C++ type system");
 
static ns3::TypeId GetTypeId()
Register this type.
 
static ns3::TypeId GetTypeId()
Register this type.
 
static ns3::TypeId GetTypeId()
Register this type.
 
void DoDispose() override
Destructor implementation.
 
void DoDispose() override
Destructor implementation.
 
static ns3::TypeId GetTypeId()
Register this type.
 
Instantiate subclasses of ns3::Object.
 
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
 
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
 
A base class which provides memory management and object aggregation.
 
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 HideFromDocumentation()
Hide this TypeId from documentation.
 
TypeId AddConstructor()
Record in this TypeId the fact that the default constructor is accessible.
 
TypeId SetParent(TypeId tid)
Set the parent TypeId.
 
Test we can aggregate Objects.
 
AggregateObjectTestCase()
Constructor.
 
~AggregateObjectTestCase() override
Destructor.
 
void DoRun() override
Implementation to actually run this TestCase.
 
Test we can make Objects using CreateObject.
 
CreateObjectTestCase()
Constructor.
 
~CreateObjectTestCase() override
Destructor.
 
void DoRun() override
Implementation to actually run this TestCase.
 
Test an Object factory can create Objects.
 
ObjectFactoryTestCase()
Constructor.
 
void DoRun() override
Implementation to actually run this TestCase.
 
~ObjectFactoryTestCase() override
Destructor.
 
The Test Suite that glues the Test Cases together.
 
ObjectTestSuite()
Constructor.
 
static ObjectTestSuite g_objectTestSuite
ObjectTestSuite instance variable.
 
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
 
#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.
 
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
 
Every class exported by the ns3 library is enclosed in the ns3 namespace.