20 #include "ns3/object.h"
21 #include "ns3/boolean.h"
22 #include "ns3/integer.h"
23 #include "ns3/uinteger.h"
24 #include "ns3/config.h"
26 #include "ns3/string.h"
27 #include "ns3/random-variable-stream.h"
28 #include "ns3/double.h"
29 #include "ns3/object-vector.h"
30 #include "ns3/object-map.h"
31 #include "ns3/traced-value.h"
32 #include "ns3/callback.h"
33 #include "ns3/trace-source-accessor.h"
34 #include "ns3/pointer.h"
35 #include "ns3/object-factory.h"
36 #include "ns3/nstime.h"
111 .SetParent<Object> ()
112 .HideFromDocumentation ()
113 .AddAttribute (
"TestBoolName",
"help text",
117 .AddAttribute (
"TestBoolA",
"help text",
122 .AddAttribute (
"TestInt16",
"help text",
125 MakeIntegerChecker<int16_t> ())
126 .AddAttribute (
"TestInt16WithBounds",
"help text",
129 MakeIntegerChecker<int16_t> (-5, 10))
130 .AddAttribute (
"TestInt16SetGet",
"help text",
134 MakeIntegerChecker<int16_t> ())
135 .AddAttribute (
"TestUint8",
"help text",
138 MakeUintegerChecker<uint8_t> ())
139 .AddAttribute (
"TestEnum",
"help text",
145 .AddAttribute (
"TestEnumSetGet",
"help text",
152 .AddAttribute (
"TestRandom",
"help text",
153 StringValue (
"ns3::ConstantRandomVariable[Constant=1.0]"),
155 MakePointerChecker <RandomVariableStream>())
156 .AddAttribute (
"TestFloat",
"help text",
159 MakeDoubleChecker<float> ())
160 .AddAttribute (
"TestVector1",
"help text",
163 MakeObjectVectorChecker<Derived> ())
164 .AddAttribute (
"TestVector2",
"help text",
168 MakeObjectVectorChecker<Derived> ())
169 .AddAttribute (
"TestMap1",
"help text",
172 MakeObjectMapChecker<Derived> ())
173 .AddAttribute (
"IntegerTraceSource1",
"help text",
176 MakeIntegerChecker<int8_t> ())
177 .AddAttribute (
"IntegerTraceSource2",
"help text",
181 MakeIntegerChecker<int8_t> ())
182 .AddAttribute (
"UIntegerTraceSource",
"help text",
185 MakeIntegerChecker<uint8_t> ())
186 .AddAttribute (
"DoubleTraceSource",
"help text",
189 MakeDoubleChecker<double> ())
190 .AddAttribute (
"BoolTraceSource",
"help text",
194 .AddAttribute (
"EnumTraceSource",
"help text",
198 .AddAttribute (
"ValueClassSource",
"help text",
202 .AddTraceSource (
"Source1",
"help test",
204 "ns3::TracedValueCallback::Int8")
205 .AddTraceSource (
"Source2",
"help text",
207 "ns3::AttributeObjectTest::NumericTracedCallback")
208 .AddTraceSource (
"ValueSource",
"help text",
210 "ns3::ValueClassTest::TracedValueCallback")
211 .AddAttribute (
"Pointer",
"help text",
214 MakePointerChecker<Derived> ())
215 .AddAttribute (
"PointerInitialized",
"help text",
218 MakePointerChecker<Derived> ())
219 .AddAttribute (
"PointerInitialized2",
"help text",
222 MakePointerChecker<Derived> ())
223 .AddAttribute (
"Callback",
"help text",
227 .AddAttribute (
"TestTimeWithBounds",
"help text",
231 .AddAttribute (
"TestDeprecated",
"help text",
236 "DEPRECATED test working.")
258 m_vector1.push_back (CreateObject<Derived> ());
262 m_vector2.push_back (CreateObject<Derived> ());
267 m_map1.insert (std::pair <uint32_t,
Ptr<Derived> > (i, CreateObject<Derived> ()));
277 if (!m_cbValue.IsNull ())
294 return m_int16SetGet;
302 return m_vector2.size ();
340 std::map <uint32_t, Ptr<Derived> >
m_map1;
345 typedef void (* NumericTracedCallback) (double, int, float);
364 template <
typename T>
374 bool CheckGetCodePaths (
Ptr<Object> p, std::string attributeName, std::string expectedString, T expectedValue);
377 template <
typename T>
382 template <
typename T>
386 template <
typename T>
bool
389 std::string attributeName,
390 std::string expectedString,
400 bool ok2 = stringValue.
Get () == expectedString;
406 bool ok4 = expectedValue.Get () == actualValue.Get ();
408 return ok1 && ok2 && ok3 && ok4;
420 p = CreateObject<AttributeObjectTest> ();
428 p = CreateObject<AttributeObjectTest> ();
431 ok = CheckGetCodePaths (p,
"TestBoolName",
"true",
BooleanValue (
true));
434 std::string expected (
"Attribute 'TestDeprecated' is deprecated: DEPRECATED test working.\n");
436 std::stringstream buffer;
437 std::streambuf *oldBuffer = std::cerr.rdbuf (buffer.rdbuf());
444 std::cerr.rdbuf (oldBuffer);
454 p = CreateObject<AttributeObjectTest> ();
457 ok = CheckGetCodePaths (p,
"TestBoolName",
"false",
BooleanValue (
false));
463 ok = p->SetAttributeFailSafe (
"TestBoolName",
StringValue (
"true"));
466 ok = CheckGetCodePaths (p,
"TestBoolName",
"true",
BooleanValue (
true));
467 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() via StringValue");
472 ok = p->SetAttributeFailSafe (
"TestBoolName",
StringValue (
"false"));
475 ok = CheckGetCodePaths (p,
"TestBoolName",
"false",
BooleanValue (
false));
476 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() via StringValue");
481 p = CreateObject<AttributeObjectTest> ();
490 ok = p->SetAttributeFailSafe (
"TestBoolA",
StringValue (
"true"));
493 ok = CheckGetCodePaths (p,
"TestBoolA",
"true",
BooleanValue (
true));
494 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() (getter/setter) via StringValue");
499 ok = p->SetAttributeFailSafe (
"TestBoolA",
StringValue (
"false"));
502 ok = CheckGetCodePaths (p,
"TestBoolA",
"false",
BooleanValue (
false));
503 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() (getter/setter) via StringValue");
512 p = CreateObject<AttributeObjectTest> ();
519 ok = CheckGetCodePaths (p,
"TestInt16",
"-2",
IntegerValue (-2));
525 ok = p->SetAttributeFailSafe (
"TestInt16",
StringValue (
"-5"));
528 ok = CheckGetCodePaths (p,
"TestInt16",
"-5",
IntegerValue (-5));
529 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() via StringValue");
534 ok = p->SetAttributeFailSafe (
"TestInt16",
StringValue (
"+2"));
537 ok = CheckGetCodePaths (p,
"TestInt16",
"2",
IntegerValue (2));
538 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() via StringValue");
543 ok = p->SetAttributeFailSafe (
"TestInt16",
StringValue (
"-32768"));
546 ok = CheckGetCodePaths (p,
"TestInt16",
"-32768",
IntegerValue (-32768));
547 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() (most negative) via StringValue");
553 ok = p->SetAttributeFailSafe (
"TestInt16",
StringValue (
"-32769"));
554 NS_TEST_ASSERT_MSG_EQ (ok,
false,
"Unexpectedly could SetAttributeFailSafe() via StringValue to -32769");
556 ok = CheckGetCodePaths (p,
"TestInt16",
"-32768",
IntegerValue (-32768));
562 ok = p->SetAttributeFailSafe (
"TestInt16",
StringValue (
"32767"));
565 ok = CheckGetCodePaths (p,
"TestInt16",
"32767",
IntegerValue (32767));
566 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() (most positive) via StringValue");
572 ok = p->SetAttributeFailSafe (
"TestInt16",
StringValue (
"32768"));
573 NS_TEST_ASSERT_MSG_EQ (ok,
false,
"Unexpectedly could SetAttributeFailSafe() via StringValue to 32768");
575 ok = CheckGetCodePaths (p,
"TestInt16",
"32767",
IntegerValue (32767));
582 ok = p->SetAttributeFailSafe (
"TestInt16WithBounds",
IntegerValue (10));
585 ok = CheckGetCodePaths (p,
"TestInt16WithBounds",
"10",
IntegerValue (10));
586 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() (positive limit) via StringValue");
591 ok = p->SetAttributeFailSafe (
"TestInt16WithBounds",
IntegerValue (11));
592 NS_TEST_ASSERT_MSG_EQ (ok,
false,
"Unexpectedly could SetAttributeFailSafe() via IntegerValue to 11");
594 ok = CheckGetCodePaths (p,
"TestInt16WithBounds",
"10",
IntegerValue (10));
600 ok = p->SetAttributeFailSafe (
"TestInt16WithBounds",
IntegerValue (-5));
603 ok = CheckGetCodePaths (p,
"TestInt16WithBounds",
"-5",
IntegerValue (-5));
604 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() (negative limit) via StringValue");
609 ok = p->SetAttributeFailSafe (
"TestInt16WithBounds",
IntegerValue (-6));
610 NS_TEST_ASSERT_MSG_EQ (ok,
false,
"Unexpectedly could SetAttributeFailSafe() via IntegerValue to -6");
612 ok = CheckGetCodePaths (p,
"TestInt16WithBounds",
"-5",
IntegerValue (-5));
622 p = CreateObject<AttributeObjectTest> ();
629 ok = CheckGetCodePaths (p,
"TestUint8",
"1",
UintegerValue (1));
635 ok = p->SetAttributeFailSafe (
"TestUint8",
UintegerValue (0));
638 ok = CheckGetCodePaths (p,
"TestUint8",
"0",
UintegerValue (0));
639 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() via StringValue");
644 ok = p->SetAttributeFailSafe (
"TestUint8",
UintegerValue (255));
647 ok = CheckGetCodePaths (p,
"TestUint8",
"255",
UintegerValue (255));
648 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() (positive limit) via UintegerValue");
654 ok = p->SetAttributeFailSafe (
"TestUint8",
UintegerValue (256));
657 ok = CheckGetCodePaths (p,
"TestUint8",
"255",
UintegerValue (255));
664 ok = p->SetAttributeFailSafe (
"TestUint8",
StringValue (
"255"));
667 ok = CheckGetCodePaths (p,
"TestUint8",
"255",
UintegerValue (255));
668 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() via StringValue");
674 ok = p->SetAttributeFailSafe (
"TestUint8",
StringValue (
"256"));
675 NS_TEST_ASSERT_MSG_EQ (ok,
false,
"Unexpectedly could SetAttributeFailSafe() via StringValue to 256");
677 ok = CheckGetCodePaths (p,
"TestUint8",
"255",
UintegerValue (255));
683 ok = p->SetAttributeFailSafe (
"TestUint8",
StringValue (
"-1"));
684 NS_TEST_ASSERT_MSG_EQ (ok,
false,
"Unexpectedly could SetAttributeFailSafe() via StringValue to -1");
693 p = CreateObject<AttributeObjectTest> ();
700 ok = CheckGetCodePaths (p,
"TestFloat",
"-1.1",
DoubleValue ((
float)-1.1));
706 ok = p->SetAttributeFailSafe (
"TestFloat",
DoubleValue ((
float)2.3));
709 ok = CheckGetCodePaths (p,
"TestFloat",
"2.3",
DoubleValue ((
float)2.3));
710 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() via DoubleValue");
719 p = CreateObject<AttributeObjectTest> ();
736 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() via EnumValue");
752 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() via EnumValue");
757 ok = p->SetAttributeFailSafe (
"TestEnum",
StringValue (
"TestB"));
761 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe() via StringValue");
777 ok = p->SetAttributeFailSafe (
"TestEnum",
EnumValue (5));
790 p = CreateObject<AttributeObjectTest> ();
794 Time::SetResolution (Time::NS);
799 ok = p->SetAttributeFailSafe (
"TestTimeWithBounds",
TimeValue (
Seconds (5)));
802 ok = CheckGetCodePaths (p,
"TestTimeWithBounds",
"+5e+09ns",
TimeValue (
Seconds (5)));
803 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe(5s) via TimeValue");
805 ok = p->SetAttributeFailSafe (
"TestTimeWithBounds",
StringValue (
"3s"));
808 ok = CheckGetCodePaths (p,
"TestTimeWithBounds",
"+3e+09ns",
TimeValue (
Seconds (3)));
809 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe(3s) via StringValue");
820 ok = p->SetAttributeFailSafe (
"TestTimeWithBounds",
TimeValue (
Seconds (10)));
823 ok = CheckGetCodePaths (p,
"TestTimeWithBounds",
"+1e+10ns",
TimeValue (
Seconds (10)));
824 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe(10s [positive limit]) via StringValue");
829 ok = p->SetAttributeFailSafe (
"TestTimeWithBounds",
TimeValue (
Seconds (11)));
830 NS_TEST_ASSERT_MSG_EQ (ok,
false,
"Unexpectedly could SetAttributeFailSafe() via TimeValue to 11s [greater than positive limit]");
832 ok = CheckGetCodePaths (p,
"TestTimeWithBounds",
"+1e+10ns",
TimeValue (
Seconds (10)));
838 ok = p->SetAttributeFailSafe (
"TestTimeWithBounds",
TimeValue (
Seconds (-5)));
841 ok = CheckGetCodePaths (p,
"TestTimeWithBounds",
"-5e+09ns",
TimeValue (
Seconds (-5)));
842 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Attribute not set properly by SetAttributeFailSafe(-5s [negative limit]) via StringValue");
847 ok = p->SetAttributeFailSafe (
"TestTimeWithBounds",
TimeValue (
Seconds (-6)));
850 ok = CheckGetCodePaths (p,
"TestTimeWithBounds",
"-5e+09ns",
TimeValue (
Seconds (-5)));
873 virtual void DoRun (
void);
895 p = CreateObject<AttributeObjectTest> ();
901 ok = p->SetAttributeFailSafe (
"TestRandom",
StringValue (
"ns3::UniformRandomVariable[Min=0.|Max=1.]"));
907 ok = p->SetAttributeFailSafe (
"TestRandom",
StringValue (
"ns3::ConstantRandomVariable[Constant=1.0]"));
923 virtual void DoRun (
void);
936 p = CreateObject<AttributeObjectTest> ();
943 p->GetAttribute (
"TestVector1", vector);
955 p->GetAttribute (
"TestVector1", vector);
973 p->GetAttribute (
"TestVector1", vector);
988 virtual void DoRun (
void);
1001 p = CreateObject<AttributeObjectTest> ();
1008 p->GetAttribute (
"TestMap1", map);
1020 p->GetAttribute (
"TestMap1", map);
1038 p->GetAttribute (
"TestMap1", map);
1054 virtual void DoRun (
void);
1068 p = CreateObject<AttributeObjectTest> ();
1075 p->GetAttribute (
"IntegerTraceSource1", iv);
1081 ok = p->SetAttributeFailSafe (
"IntegerTraceSource1",
IntegerValue (5));
1084 p->GetAttribute (
"IntegerTraceSource1", iv);
1090 ok = p->SetAttributeFailSafe (
"IntegerTraceSource1",
IntegerValue (127));
1093 ok = p->SetAttributeFailSafe (
"IntegerTraceSource1",
IntegerValue (128));
1094 NS_TEST_ASSERT_MSG_EQ (ok,
false,
"Unexpectedly could SetAttributeFailSafe() via IntegerValue to 128");
1096 ok = p->SetAttributeFailSafe (
"IntegerTraceSource1",
IntegerValue (-128));
1099 ok = p->SetAttributeFailSafe (
"IntegerTraceSource1",
IntegerValue (-129));
1100 NS_TEST_ASSERT_MSG_EQ (ok,
false,
"Unexpectedly could SetAttributeFailSafe() via IntegerValue to -129");
1106 p->GetAttribute (
"IntegerTraceSource2", iv);
1112 ok = p->SetAttributeFailSafe (
"IntegerTraceSource2",
IntegerValue (5));
1115 p->GetAttribute (
"IntegerTraceSource2", iv);
1121 ok = p->SetAttributeFailSafe (
"IntegerTraceSource2",
IntegerValue (127));
1124 ok = p->SetAttributeFailSafe (
"IntegerTraceSource2",
IntegerValue (128));
1125 NS_TEST_ASSERT_MSG_EQ (ok,
false,
"Unexpectedly could SetAttributeFailSafe() via IntegerValue to 128");
1127 ok = p->SetAttributeFailSafe (
"IntegerTraceSource2",
IntegerValue (-128));
1130 ok = p->SetAttributeFailSafe (
"IntegerTraceSource2",
IntegerValue (-129));
1131 NS_TEST_ASSERT_MSG_EQ (ok,
false,
"Unexpectedly could SetAttributeFailSafe() via IntegerValue to -129");
1146 virtual void DoRun (
void);
1166 p = CreateObject<AttributeObjectTest> ();
1175 ok = p->SetAttributeFailSafe (
"IntegerTraceSource1",
IntegerValue (-1));
1185 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Could not TraceConnectWithoutContext() \"Source1\" to NodifySource1()");
1192 ok = p->SetAttributeFailSafe (
"IntegerTraceSource1",
IntegerValue (0));
1202 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Could not TraceConnectWithoutContext() \"Source1\" to NodifySource1()");
1204 ok = p->SetAttributeFailSafe (
"IntegerTraceSource1",
IntegerValue (1));
1222 virtual void DoRun (
void);
1244 p = CreateObject<AttributeObjectTest> ();
1260 p->InvokeCb (1.0, -5, 0.0);
1274 p->InvokeCb (1.0, -5, 0.0);
1285 p->InvokeCb (-1.0, -5, 0.0);
1301 virtual void DoRun (
void);
1323 p = CreateObject<AttributeObjectTest> ();
1332 p->GetAttribute (
"Pointer", ptr);
1334 NS_TEST_ASSERT_MSG_EQ (derived, 0,
"Unexpectedly found non-null pointer in newly initialized PointerValue Attribute");
1340 derived = Create<Derived> ();
1341 ok = p->SetAttributeFailSafe (
"Pointer",
PointerValue (derived));
1342 NS_TEST_ASSERT_MSG_EQ (ok,
true,
"Could not SetAttributeFailSafe() a PointerValue of the correct type");
1348 p->GetAttribute (
"Pointer", ptr);
1358 p->GetAttribute (
"Pointer", ptr);
1360 NS_TEST_ASSERT_MSG_EQ (storedBase, stored,
"Retrieved Ptr<Object> does not match stored Ptr<Derived>");
1366 p->GetAttribute (
"Pointer", ptr);
1374 p->GetAttribute (
"PointerInitialized", ptr);
1378 p2->GetAttribute (
"PointerInitialized", ptr2);
1380 NS_TEST_ASSERT_MSG_NE (storedPtr, storedPtr2,
"ptr and ptr2 both have PointerInitialized pointing to the same object");
1382 p2->GetAttribute (
"PointerInitialized", ptr3);
1384 NS_TEST_ASSERT_MSG_NE (storedPtr, storedPtr3,
"ptr and ptr3 both have PointerInitialized pointing to the same object");
1390 factory.
SetTypeId (
"ns3::AttributeObjectTest");
1391 factory.
Set (
"PointerInitialized",
StringValue (
"ns3::Derived"));
1398 aotPtr->GetAttribute (
"PointerInitialized", ptr4);
1401 aotPtr2->GetAttribute (
"PointerInitialized", ptr5);
1403 NS_TEST_ASSERT_MSG_NE (storedPtr4, storedPtr5,
"aotPtr and aotPtr2 are unique, but their Derived member is not");
1425 virtual void DoRun (
void);
1447 p = CreateObject<AttributeObjectTest> ();
1467 p->InvokeCbValue (2);
1472 ok = p->SetAttributeFailSafe (
"Callback", cbValue);
1478 p->InvokeCbValue (2);
1481 ok = p->SetAttributeFailSafe (
"Callback",
CallbackValue (MakeNullCallback<void,int8_t> ()));
1487 p->InvokeCbValue (3);
Ptr< const AttributeAccessor > MakeValueClassTestAccessor(T1 a1)
Ptr< const AttributeChecker > MakeValueClassTestChecker(void)
static AttributesTestSuite attributesTestSuite
bool DoSetIntSrc(int8_t v)
bool DoGetTestB(void) const
static TypeId GetTypeId(void)
std::map< uint32_t, Ptr< Derived > > m_map1
void InvokeCb(double a, int b, float c)
Ptr< Derived > DoGetVector(std::size_t i) const
Ptr< RandomVariableStream > m_random
std::vector< Ptr< Derived > > m_vector1
void InvokeCbValue(int8_t a)
TracedValue< double > m_doubleSrc
bool m_boolTestDeprecated
void AddToMap1(uint32_t i)
TracedCallback< double, int, float > m_cb
AttributeObjectTest(void)
Test_e DoGetEnum(void) const
virtual ~AttributeObjectTest(void)
int8_t DoGetIntSrc(void) const
int16_t m_int16WithBounds
TracedValue< int8_t > m_intSrc1
Callback< void, int8_t > m_cbValue
Ptr< Derived > m_ptrInitialized
Ptr< Derived > m_ptrInitialized2
std::size_t DoGetVectorN(void) const
TracedValue< ValueClassTest > m_valueSrc
TracedValue< uint8_t > m_uintSrc
int16_t DoGetInt16(void) const
TracedValue< bool > m_boolSrc
TracedValue< int8_t > m_intSrc2
TracedValue< enum Test_e > m_enumSrc
std::vector< Ptr< Derived > > m_vector2
void DoSetInt16(int16_t v)
virtual void DoRun(void)
Implementation to actually run this TestCase.
bool CheckGetCodePaths(Ptr< Object > p, std::string attributeName, std::string expectedString, T expectedValue)
virtual ~AttributeTestCase()
AttributeTestCase(std::string description)
CallbackValueTestCase(std::string description)
void NotifyCallbackValue(int8_t a)
Callback< void, int8_t > m_cbValue
void InvokeCbValue(int8_t a)
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~CallbackValueTestCase()
static TypeId GetTypeId(void)
IntegerTraceSourceAttributeTestCase(std::string description)
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~IntegerTraceSourceAttributeTestCase()
IntegerTraceSourceTestCase(std::string description)
virtual ~IntegerTraceSourceTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
void NotifySource1(int8_t old, int8_t n)
ObjectMapAttributeTestCase(std::string description)
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~ObjectMapAttributeTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
ObjectVectorAttributeTestCase(std::string description)
virtual ~ObjectVectorAttributeTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~PointerAttributeTestCase()
PointerAttributeTestCase(std::string description)
void NotifySource2(double a, int b, float c)
void InvokeCbValue(int8_t a)
Callback< void, int8_t > m_cbValue
virtual ~RandomVariableStreamAttributeTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
void NotifyCallbackValue(int8_t a)
RandomVariableStreamAttributeTestCase(std::string description)
TracedCallbackTestCase(std::string description)
void NotifySource2(double a, int b, float c)
virtual ~TracedCallbackTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test class for TracedValue callbacks.
AttributeValue implementation for Boolean.
bool IsNull(void) const
Check for null implementation.
AttributeValue implementation for Callback.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
Hold a signed integer type.
bool GetAttributeFailSafe(std::string name, AttributeValue &value) const
Get the value of an attribute without raising erros.
Instantiate subclasses of ns3::Object.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
Ptr< Object > Create(void) 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.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Container for a set of ns3::Object pointers.
std::size_t GetN(void) const
Get the number of Objects.
Ptr< Object > Get(std::size_t i) const
Get a specific Object.
Hold objects of type Ptr<T>.
Hold variables of type string.
std::string Get(void) const
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
a unique identifier for an interface.
TypeId AddConstructor(void)
Record in this TypeId the fact that the default constructor is accessible.
@ DEPRECATED
Attribute or trace source is deprecated; user is warned.
Hold an unsigned integer type.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeCallbackAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeCallbackChecker(void)
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
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 > MakeObjectMapAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
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< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define ATTRIBUTE_HELPER_CPP(type)
Define the attribute value, accessor and checkers for class type
#define ATTRIBUTE_HELPER_HEADER(type)
Declare the attribute value, accessor and checkers for class type
void SetDefault(std::string name, const AttributeValue &value)
bool SetDefaultFailSafe(std::string fullName, const AttributeValue &value)
#define NS_UNUSED(x)
Mark a local variable as unused.
#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.
Time Seconds(double value)
Construct a Time in the indicated unit.
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 > MakeEnumChecker(int v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
bool operator!=(Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > a, Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > b)
Inequality test.
std::istream & operator>>(std::istream &is, Angles &a)
std::ostream & operator<<(std::ostream &os, const Angles &a)
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...