A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
config-test-suite.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8#include "ns3/callback.h"
9#include "ns3/config.h"
10#include "ns3/integer.h"
11#include "ns3/log.h"
12#include "ns3/names.h"
13#include "ns3/object-vector.h"
14#include "ns3/object.h"
15#include "ns3/pointer.h"
16#include "ns3/singleton.h"
17#include "ns3/test.h"
18#include "ns3/trace-source-accessor.h"
19#include "ns3/traced-value.h"
20
21/**
22 * @file
23 * @ingroup core-tests
24 * @ingroup config
25 * @ingroup config-tests
26 * Config test suite
27 */
28
29/**
30 * @ingroup core-tests
31 * @defgroup config-tests Config test suite
32 */
33
34namespace ns3
35{
36
37namespace tests
38{
39
40/**
41 * @ingroup config-tests
42 * An object with some attributes that we can play with using config.
43 */
45{
46 public:
47 /**
48 * @brief Get the type ID.
49 * @return the object TypeId
50 */
51 static TypeId GetTypeId();
52
53 /**
54 * Add node A function
55 * @param a test object a
56 */
58 /**
59 * Add node B function
60 * @param b test object b
61 */
63
64 /**
65 * Set node A function
66 * @param a test object a
67 */
69 /**
70 * Set node b function
71 * @param b test object b
72 */
74
75 /**
76 * Get node A function
77 * @returns the value of node a
78 */
79 int8_t GetA() const;
80 /**
81 * Get node b function
82 * @returns the value of node b
83 */
84 int8_t GetB() const;
85
86 private:
87 std::vector<Ptr<ConfigTestObject>> m_nodesA; //!< NodesA attribute target.
88 std::vector<Ptr<ConfigTestObject>> m_nodesB; //!< NodesB attribute target.
89 Ptr<ConfigTestObject> m_nodeA; //!< NodeA attribute target.
90 Ptr<ConfigTestObject> m_nodeB; //!< NodeB attribute target.
91 int8_t m_a; //!< A attribute target.
92 int8_t m_b; //!< B attribute target.
93 TracedValue<int16_t> m_trace; //!< Source TraceSource target.
94};
95
98{
99 static TypeId tid = TypeId("ConfigTestObject")
100 .SetParent<Object>()
101 .AddAttribute("NodesA",
102 "",
106 .AddAttribute("NodesB",
107 "",
111 .AddAttribute("NodeA",
112 "",
113 PointerValue(),
116 .AddAttribute("NodeB",
117 "",
118 PointerValue(),
121 .AddAttribute("A",
122 "",
123 IntegerValue(10),
126 .AddAttribute("B",
127 "",
128 IntegerValue(9),
131 .AddAttribute("Source",
132 "XX",
133 IntegerValue(-1),
136 .AddTraceSource("Source",
137 "XX",
139 "ns3::TracedValueCallback::Int16");
140 return tid;
141}
142
143void
148
149void
154
155void
160
161void
166
167int8_t
169{
170 return m_a;
171}
172
173int8_t
175{
176 return m_b;
177}
178
179/**
180 * @ingroup config-tests
181 * Derived test objects.
182 */
184{
185 public:
186 /**
187 * @brief Get the type ID.
188 * @return the object TypeId
189 */
190 static TypeId GetTypeId();
191
192 /** Constructor. */
196
197 /** Destructor */
199 {
200 }
201};
202
203TypeId
205{
206 static TypeId tid = TypeId("DerivedConfigTestObject").SetParent<ConfigTestObject>();
207 return tid;
208}
209
210/**
211 * @ingroup config-tests
212 * Base config object.
213 */
215{
216 public:
217 /**
218 * @brief Get the type ID.
219 * @return the object TypeId
220 */
221 static TypeId GetTypeId();
222
223 /** Constructor. */
225 : m_x(15)
226 {
227 }
228
229 /** Destructor. */
231 {
232 }
233
234 private:
235 int8_t m_x; //!< X attribute target.
236};
237
238TypeId
240{
241 static TypeId tid = TypeId("BaseConfigObject")
242 .SetParent<Object>()
243 .AddAttribute("X",
244 "",
245 IntegerValue(10),
248 return tid;
249}
250
251/**
252 * @ingroup config-tests
253 * Derived config object.
254 */
256{
257 public:
258 /**
259 * @brief Get the type ID.
260 * @return the object TypeId
261 */
262 static TypeId GetTypeId();
263
264 /** Constructor. */
266 {
267 }
268
269 /** Destructor. */
271 {
272 }
273};
274
275TypeId
277{
278 static TypeId tid = TypeId("DerivedConfigObject").SetParent<BaseConfigObject>();
279 return tid;
280}
281
282/**
283 * @ingroup config-tests
284 * Test for the ability to register and use a root namespace.
285 */
287{
288 public:
289 /** Constructor. */
291
292 /** Destructor. */
294 {
295 }
296
297 private:
298 void DoRun() override;
299};
300
302 : TestCase("Check ability to register a root namespace and use it")
303{
304}
305
306void
308{
309 IntegerValue iv;
310 //
311 // Create an object and register its attributes directly in the root
312 // namespace.
313 //
316
317 //
318 // We should find the default values there.
319 //
320 root->GetAttribute("A", iv);
321 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" not initialized as expected");
322
323 //
324 // Now use the config mechanism to set the attribute; and we should find the
325 // new value.
326 //
327 Config::Set("/A", IntegerValue(1));
328 root->GetAttribute("A", iv);
329 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 1, "Object Attribute \"A\" not set correctly");
330
331 //
332 // We should find the default values of "B" too.
333 //
334 root->GetAttribute("B", iv);
335 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 9, "Object Attribute \"B\" not initialized as expected");
336
337 //
338 // Now use the config mechanism to set the attribute; and we should find the
339 // new value.
340 //
341 Config::Set("/B", IntegerValue(-1));
342 root->GetAttribute("B", iv);
343 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -1, "Object Attribute \"B\" not set correctly");
344}
345
346/**
347 * @ingroup config-tests
348 * Test for the ability to add an object under the root namespace.
349 */
351{
352 public:
353 /** Constructor. */
355
356 /** Destructor. */
358 {
359 }
360
361 private:
362 void DoRun() override;
363};
364
366 : TestCase("Check ability to register an object under the root namespace and use it")
367{
368}
369
370void
372{
373 IntegerValue iv;
374 //
375 // Create an object and register its attributes directly in the root
376 // namespace.
377 //
380
382 root->SetNodeA(a);
383
384 //
385 // We should find the default values there.
386 //
387 a->GetAttribute("A", iv);
388 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" not initialized as expected");
389
390 //
391 // Now use the config mechanism to set the attribute; and we should find the
392 // new value.
393 //
394 Config::Set("/NodeA/A", IntegerValue(1));
395 a->GetAttribute("A", iv);
396 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 1, "Object Attribute \"A\" not set correctly");
397
398 //
399 // We should find the default values of "B" too.
400 //
401 a->GetAttribute("B", iv);
402 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 9, "Object Attribute \"B\" not initialized as expected");
403
404 //
405 // Now use the config mechanism to set the attribute; and we should find the
406 // new value.
407 //
408 Config::Set("/NodeA/B", IntegerValue(-1));
409 a->GetAttribute("B", iv);
410 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -1, "Object Attribute \"B\" not set correctly");
411
412 //
413 // Try and set through a nonexistent path. Should do nothing.
414 //
415 Config::Set("/NodeB/A", IntegerValue(1234));
416 a->GetAttribute("A", iv);
417 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 1, "Object Attribute \"A\" unexpectedly set via bad path");
418
419 Config::Set("/NodeB/B", IntegerValue(1234));
420 a->GetAttribute("B", iv);
421 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -1, "Object Attribute \"B\" unexpectedly set via bad path");
422
423 //
424 // Step down one level of recursion and try again
425 //
427
428 //
429 // We should find the default values there.
430 //
431 b->GetAttribute("A", iv);
432 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" not initialized as expected");
433 b->GetAttribute("B", iv);
434 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 9, "Object Attribute \"B\" not initialized as expected");
435
436 //
437 // Now tell A that it has a B; and we should be able to set this new object's
438 // Attributes.
439 //
440 a->SetNodeB(b);
441
442 Config::Set("/NodeA/NodeB/A", IntegerValue(4));
443 Config::Set("/NodeA/NodeB/B", IntegerValue(-4));
444 b->GetAttribute("A", iv);
445 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 4, "Object Attribute \"A\" not set as expected");
446 b->GetAttribute("B", iv);
447 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -4, "Object Attribute \"B\" not set as expected");
448
449 //
450 // Try '*' for attributes
451 //
452 Config::Set("/*/A", IntegerValue(2));
453 a->GetAttribute("A", iv);
454 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 2, "Object Attribute \"A\" not set correctly");
455 b->GetAttribute("A", iv);
456 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 4, "Object Attribute \"A\" not set correctly");
457}
458
459/**
460 * @ingroup config-tests
461 * Test for the ability to deal configure with vectors of objects.
462 */
464{
465 public:
466 /** Constructor. */
468
469 /** Destructor. */
471 {
472 }
473
474 private:
475 void DoRun() override;
476};
477
479 : TestCase("Check ability to configure vectors of Object using regular expressions")
480{
481}
482
483void
485{
486 IntegerValue iv;
487
488 //
489 // Create a root namespace object
490 //
493
494 //
495 // Create an object under the root.
496 //
498 root->SetNodeA(a);
499
500 //
501 // Create an object one level down.
502 //
504 a->SetNodeB(b);
505
506 //
507 // Add four objects to the ObjectVector Attribute at the bottom of the
508 // object hierarchy. By this point, we believe that the Attributes
509 // will be initialized correctly.
510 //
515 b->AddNodeB(obj0);
516 b->AddNodeB(obj1);
517 b->AddNodeB(obj2);
518 b->AddNodeB(obj3);
519
520 //
521 // Set an Attribute of the zeroth Object in the vector by explicitly writing
522 // the '0' and make sure that only the one thing changed.
523 //
524 Config::Set("/NodeA/NodeB/NodesB/0/A", IntegerValue(-11));
525 obj0->GetAttribute("A", iv);
526 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -11, "Object Attribute \"A\" not set as expected");
527
528 obj1->GetAttribute("A", iv);
529 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
530
531 obj2->GetAttribute("A", iv);
532 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
533
534 obj3->GetAttribute("A", iv);
535 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
536
537 //
538 // Start using regular expression-like syntax to set Attributes. First try
539 // the OR syntax. Make sure that the two objects changed and nothing else
540 //
541 Config::Set("/NodeA/NodeB/NodesB/0|1/A", IntegerValue(-12));
542 obj0->GetAttribute("A", iv);
543 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -12, "Object Attribute \"A\" not set as expected");
544
545 obj1->GetAttribute("A", iv);
546 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -12, "Object Attribute \"A\" not set as expected");
547
548 obj2->GetAttribute("A", iv);
549 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
550
551 obj3->GetAttribute("A", iv);
552 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
553
554 //
555 // Make sure that extra '|' are allowed at the start and end of the regular expression
556 //
557 Config::Set("/NodeA/NodeB/NodesB/|0|1|/A", IntegerValue(-13));
558 obj0->GetAttribute("A", iv);
559 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -13, "Object Attribute \"A\" not set as expected");
560
561 obj1->GetAttribute("A", iv);
562 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -13, "Object Attribute \"A\" not set as expected");
563
564 obj2->GetAttribute("A", iv);
565 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
566
567 obj3->GetAttribute("A", iv);
568 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
569
570 //
571 // Try the [x-y] syntax
572 //
573 Config::Set("/NodeA/NodeB/NodesB/[0-2]/A", IntegerValue(-14));
574 obj0->GetAttribute("A", iv);
575 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -14, "Object Attribute \"A\" not set as expected");
576
577 obj1->GetAttribute("A", iv);
578 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -14, "Object Attribute \"A\" not set as expected");
579
580 obj2->GetAttribute("A", iv);
581 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -14, "Object Attribute \"A\" not set as expected");
582
583 obj3->GetAttribute("A", iv);
584 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
585
586 //
587 // Try the [x-y] syntax at the other limit
588 //
589 Config::Set("/NodeA/NodeB/NodesB/[1-3]/A", IntegerValue(-15));
590 obj0->GetAttribute("A", iv);
591 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -14, "Object Attribute \"A\" unexpectedly set");
592
593 obj1->GetAttribute("A", iv);
594 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -15, "Object Attribute \"A\" not set as expected");
595
596 obj2->GetAttribute("A", iv);
597 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -15, "Object Attribute \"A\" not set as expected");
598
599 obj3->GetAttribute("A", iv);
600 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -15, "Object Attribute \"A\" not set as expected");
601
602 //
603 // Combine the [x-y] syntax and the OR sntax
604 //
605 Config::Set("/NodeA/NodeB/NodesB/[0-1]|3/A", IntegerValue(-16));
606 obj0->GetAttribute("A", iv);
607 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -16, "Object Attribute \"A\" not set as expected");
608
609 obj1->GetAttribute("A", iv);
610 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -16, "Object Attribute \"A\" not set as expected");
611
612 obj2->GetAttribute("A", iv);
613 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -15, "Object Attribute \"A\" unexpectedly set");
614
615 obj3->GetAttribute("A", iv);
616 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -16, "Object Attribute \"A\" not set as expected");
617}
618
619/**
620 * @ingroup config-tests
621 * Test for the ability to trace configure with vectors of objects.
622 */
624{
625 public:
626 /** Constructor. */
628
629 /** Destructor. */
631 {
632 }
633
634 /**
635 * Trace callback without context.
636 * @param oldValue The old value.
637 * @param newValue The new value.
638 */
639 void Trace(int16_t oldValue [[maybe_unused]], int16_t newValue)
640 {
641 m_newValue = newValue;
642 }
643
644 /**
645 * Trace callback with context path.
646 * @param path The context path.
647 * @param old The old value.
648 * @param newValue The new value.
649 */
650 void TraceWithPath(std::string path, int16_t old [[maybe_unused]], int16_t newValue)
651 {
652 m_newValue = newValue;
653 m_path = path;
654 }
655
656 private:
657 void DoRun() override;
658
659 int16_t m_newValue; //!< Flag to detect tracing result.
660 std::string m_path; //!< The context path.
661};
662
664 : TestCase("Check ability to trace connect through vectors of Object using regular expressions")
665{
666}
667
668void
670{
671 IntegerValue iv;
672
673 //
674 // Create a root namespace object
675 //
678
679 //
680 // Create an object under the root.
681 //
683 root->SetNodeA(a);
684
685 //
686 // Create an object one level down.
687 //
689 a->SetNodeB(b);
690
691 //
692 // Add four objects to the ObjectVector Attribute at the bottom of the
693 // object hierarchy. By this point, we believe that the Attributes
694 // will be initialized correctly.
695 //
700 b->AddNodeB(obj0);
701 b->AddNodeB(obj1);
702 b->AddNodeB(obj2);
703 b->AddNodeB(obj3);
704
705 //
706 // Do a trace connect to some of the sources. We already checked parsing of
707 // the regular expressions, so we'll concentrate on the tracing part of the
708 // puzzle here.
709 //
710 Config::ConnectWithoutContext("/NodeA/NodeB/NodesB/[0-1]|3/Source",
712
713 //
714 // If we bug the trace source referred to by index '0' above, we should see
715 // the trace fire.
716 //
717 m_newValue = 0;
718 obj0->SetAttribute("Source", IntegerValue(-1));
719 NS_TEST_ASSERT_MSG_EQ(m_newValue, -1, "Trace 0 did not fire as expected");
720
721 //
722 // If we bug the trace source referred to by index '1' above, we should see
723 // the trace fire.
724 //
725 m_newValue = 0;
726 obj1->SetAttribute("Source", IntegerValue(-2));
727 NS_TEST_ASSERT_MSG_EQ(m_newValue, -2, "Trace 1 did not fire as expected");
728
729 //
730 // If we bug the trace source referred to by index '2' which is skipped above,
731 // we should not see the trace fire.
732 //
733 m_newValue = 0;
734 obj2->SetAttribute("Source", IntegerValue(-3));
735 NS_TEST_ASSERT_MSG_EQ(m_newValue, 0, "Trace 2 fired unexpectedly");
736
737 //
738 // If we bug the trace source referred to by index '3' above, we should see
739 // the trace fire.
740 //
741 m_newValue = 0;
742 obj3->SetAttribute("Source", IntegerValue(-4));
743 NS_TEST_ASSERT_MSG_EQ(m_newValue, -4, "Trace 3 did not fire as expected");
744
745 //
746 // Do a trace connect (with context) to some of the sources.
747 //
748 Config::Connect("/NodeA/NodeB/NodesB/[0-1]|3/Source",
750
751 //
752 // If we bug the trace source referred to by index '0' above, we should see
753 // the trace fire with the expected context path.
754 //
755 m_newValue = 0;
756 m_path = "";
757 obj0->SetAttribute("Source", IntegerValue(-1));
758 NS_TEST_ASSERT_MSG_EQ(m_newValue, -1, "Trace 0 did not fire as expected");
760 "/NodeA/NodeB/NodesB/0/Source",
761 "Trace 0 did not provide expected context");
762
763 //
764 // If we bug the trace source referred to by index '1' above, we should see
765 // the trace fire with the expected context path.
766 //
767 m_newValue = 0;
768 m_path = "";
769 obj1->SetAttribute("Source", IntegerValue(-2));
770 NS_TEST_ASSERT_MSG_EQ(m_newValue, -2, "Trace 1 did not fire as expected");
772 "/NodeA/NodeB/NodesB/1/Source",
773 "Trace 1 did not provide expected context");
774
775 //
776 // If we bug the trace source referred to by index '2' which is skipped above,
777 // we should not see the trace fire.
778 //
779 m_newValue = 0;
780 m_path = "";
781 obj2->SetAttribute("Source", IntegerValue(-3));
782 NS_TEST_ASSERT_MSG_EQ(m_newValue, 0, "Trace 2 fired unexpectedly");
783
784 //
785 // If we bug the trace source referred to by index '3' above, we should see
786 // the trace fire with the expected context path.
787 //
788 m_newValue = 0;
789 m_path = "";
790 obj3->SetAttribute("Source", IntegerValue(-4));
791 NS_TEST_ASSERT_MSG_EQ(m_newValue, -4, "Trace 3 did not fire as expected");
793 "/NodeA/NodeB/NodesB/1/Source",
794 "Trace 1 did not provide expected context");
795}
796
797/**
798 * @ingroup config-tests
799 * Test for the ability to search attributes of parent classes
800 * when Resolver searches for attributes in a derived class object.
801 * This test passes with the patch found in
802 * https://www.nsnam.org/bugzilla/show_bug.cgi?id=1673
803 * (also reported in https://www.nsnam.org/bugzilla/show_bug.cgi?id=1959)
804 */
806{
807 public:
808 /** Constructor. */
810
811 /** Destructor. */
815
816 private:
817 void DoRun() override;
818};
819
821 : TestCase("Check that attributes of base class are searchable from paths including objects of "
822 "derived class")
823{
824}
825
826void
828{
829 IntegerValue iv;
830 //
831 // Create a root namespace object that doesn't have attributes but
832 // whose parent class has 'NodeA' attribute
833 //
836
837 //
838 // Instantiate /NodeA
839 //
841 root->SetNodeA(a);
842
843 //
844 // BaseConfigObject has attribute X, but we aggregate DerivedConfigObject
845 // instead
846 //
848 a->AggregateObject(derived);
849 Config::Set("/NodeA/$DerivedConfigObject/X", IntegerValue(42));
850 derived->GetAttribute("X", iv);
851 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 42, "Object Attribute \"X\" not settable in derived class");
852}
853
854/**
855 * @ingroup config-tests
856 * The Test Suite that glues all of the Test Cases together.
857 */
859{
860 public:
861 /** Constructor. */
863};
864
873
874/**
875 * @ingroup config-tests
876 * ConfigTestSuite instance variable.
877 */
879
880} // namespace tests
881
882} // namespace ns3
Hold a signed integer type.
Definition integer.h:34
int64_t Get() const
Definition integer.cc:25
Object()
Caller graph was not generated because of its size.
Definition object.cc:93
AttributeValue implementation for Pointer.
Definition pointer.h:37
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:296
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.
Definition test.cc:494
Trace classes with value semantics.
a unique identifier for an interface.
Definition type-id.h:49
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:999
~BaseConfigObject() override
Destructor.
int8_t m_x
X attribute target.
static TypeId GetTypeId()
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.
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.
static TypeId GetTypeId()
Get the type ID.
~DerivedConfigObject() override
Destructor.
~DerivedConfigTestObject() override
Destructor.
static TypeId GetTypeId()
Get the type ID.
Test for the ability to deal configure with vectors of objects.
void DoRun() override
Implementation to actually run this TestCase.
void Trace(int16_t oldValue, int16_t newValue)
Trace callback without context.
int16_t m_newValue
Flag to detect tracing result.
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.
void DoRun() override
Implementation to actually run this TestCase.
Test for the ability to search attributes of parent classes when Resolver searches for attributes in ...
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.
Ptr< const AttributeChecker > MakeIntegerChecker()
Definition integer.h:99
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition integer.h:35
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.
Definition pointer.h:250
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
Definition pointer.h:273
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...
Definition callback.h:690
static ConfigTestSuite g_configTestSuite
ConfigTestSuite instance variable.
void Connect(std::string path, const CallbackBase &cb)
Definition config.cc:970
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition config.cc:946
void Set(std::string path, const AttributeValue &value)
Definition config.cc:872
void RegisterRootNamespaceObject(Ptr< Object > obj)
Definition config.cc:1001
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:627
#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.
Definition test.h:133
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.