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#include <sstream>
22
23/**
24 * \file
25 * \ingroup core-tests
26 * \ingroup config
27 * \ingroup config-tests
28 * Config test suite
29 */
30
31/**
32 * \ingroup core-tests
33 * \defgroup config-tests Config test suite
34 */
35
36namespace ns3
37{
38
39namespace tests
40{
41
42/**
43 * \ingroup config-tests
44 * An object with some attributes that we can play with using config.
45 */
47{
48 public:
49 /**
50 * \brief Get the type ID.
51 * \return the object TypeId
52 */
53 static TypeId GetTypeId();
54
55 /**
56 * Add node A function
57 * \param a test object a
58 */
60 /**
61 * Add node B function
62 * \param b test object b
63 */
65
66 /**
67 * Set node A function
68 * \param a test object a
69 */
71 /**
72 * Set node b function
73 * \param b test object b
74 */
76
77 /**
78 * Get node A function
79 * \returns the value of node a
80 */
81 int8_t GetA() const;
82 /**
83 * Get node b function
84 * \returns the value of node b
85 */
86 int8_t GetB() const;
87
88 private:
89 std::vector<Ptr<ConfigTestObject>> m_nodesA; //!< NodesA attribute target.
90 std::vector<Ptr<ConfigTestObject>> m_nodesB; //!< NodesB attribute target.
91 Ptr<ConfigTestObject> m_nodeA; //!< NodeA attribute target.
92 Ptr<ConfigTestObject> m_nodeB; //!< NodeB attribute target.
93 int8_t m_a; //!< A attribute target.
94 int8_t m_b; //!< B attribute target.
95 TracedValue<int16_t> m_trace; //!< Source TraceSource target.
96};
97
100{
101 static TypeId tid = TypeId("ConfigTestObject")
102 .SetParent<Object>()
103 .AddAttribute("NodesA",
104 "",
108 .AddAttribute("NodesB",
109 "",
113 .AddAttribute("NodeA",
114 "",
115 PointerValue(),
118 .AddAttribute("NodeB",
119 "",
120 PointerValue(),
123 .AddAttribute("A",
124 "",
125 IntegerValue(10),
128 .AddAttribute("B",
129 "",
130 IntegerValue(9),
133 .AddAttribute("Source",
134 "XX",
135 IntegerValue(-1),
138 .AddTraceSource("Source",
139 "XX",
141 "ns3::TracedValueCallback::Int16");
142 return tid;
143}
144
145void
150
151void
156
157void
162
163void
168
169int8_t
171{
172 return m_a;
173}
174
175int8_t
177{
178 return m_b;
179}
180
181/**
182 * \ingroup config-tests
183 * Derived test objects.
184 */
186{
187 public:
188 /**
189 * \brief Get the type ID.
190 * \return the object TypeId
191 */
192 static TypeId GetTypeId();
193
194 /** Constructor. */
198
199 /** Destructor */
201 {
202 }
203};
204
205TypeId
207{
208 static TypeId tid = TypeId("DerivedConfigTestObject").SetParent<ConfigTestObject>();
209 return tid;
210}
211
212/**
213 * \ingroup config-tests
214 * Base config object.
215 */
217{
218 public:
219 /**
220 * \brief Get the type ID.
221 * \return the object TypeId
222 */
223 static TypeId GetTypeId();
224
225 /** Constructor. */
227 : m_x(15)
228 {
229 }
230
231 /** Destructor. */
233 {
234 }
235
236 private:
237 int8_t m_x; //!< X attribute target.
238};
239
240TypeId
242{
243 static TypeId tid = TypeId("BaseConfigObject")
244 .SetParent<Object>()
245 .AddAttribute("X",
246 "",
247 IntegerValue(10),
250 return tid;
251}
252
253/**
254 * \ingroup config-tests
255 * Derived config object.
256 */
258{
259 public:
260 /**
261 * \brief Get the type ID.
262 * \return the object TypeId
263 */
264 static TypeId GetTypeId();
265
266 /** Constructor. */
268 {
269 }
270
271 /** Destructor. */
273 {
274 }
275};
276
277TypeId
279{
280 static TypeId tid = TypeId("DerivedConfigObject").SetParent<BaseConfigObject>();
281 return tid;
282}
283
284/**
285 * \ingroup config-tests
286 * Test for the ability to register and use a root namespace.
287 */
289{
290 public:
291 /** Constructor. */
293
294 /** Destructor. */
296 {
297 }
298
299 private:
300 void DoRun() override;
301};
302
304 : TestCase("Check ability to register a root namespace and use it")
305{
306}
307
308void
310{
311 IntegerValue iv;
312 //
313 // Create an object and register its attributes directly in the root
314 // namespace.
315 //
318
319 //
320 // We should find the default values there.
321 //
322 root->GetAttribute("A", iv);
323 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" not initialized as expected");
324
325 //
326 // Now use the config mechanism to set the attribute; and we should find the
327 // new value.
328 //
329 Config::Set("/A", IntegerValue(1));
330 root->GetAttribute("A", iv);
331 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 1, "Object Attribute \"A\" not set correctly");
332
333 //
334 // We should find the default values of "B" too.
335 //
336 root->GetAttribute("B", iv);
337 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 9, "Object Attribute \"B\" not initialized as expected");
338
339 //
340 // Now use the config mechanism to set the attribute; and we should find the
341 // new value.
342 //
343 Config::Set("/B", IntegerValue(-1));
344 root->GetAttribute("B", iv);
345 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -1, "Object Attribute \"B\" not set correctly");
346}
347
348/**
349 * \ingroup config-tests
350 * Test for the ability to add an object under the root namespace.
351 */
353{
354 public:
355 /** Constructor. */
357
358 /** Destructor. */
360 {
361 }
362
363 private:
364 void DoRun() override;
365};
366
368 : TestCase("Check ability to register an object under the root namespace and use it")
369{
370}
371
372void
374{
375 IntegerValue iv;
376 //
377 // Create an object and register its attributes directly in the root
378 // namespace.
379 //
382
384 root->SetNodeA(a);
385
386 //
387 // We should find the default values there.
388 //
389 a->GetAttribute("A", iv);
390 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" not initialized as expected");
391
392 //
393 // Now use the config mechanism to set the attribute; and we should find the
394 // new value.
395 //
396 Config::Set("/NodeA/A", IntegerValue(1));
397 a->GetAttribute("A", iv);
398 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 1, "Object Attribute \"A\" not set correctly");
399
400 //
401 // We should find the default values of "B" too.
402 //
403 a->GetAttribute("B", iv);
404 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 9, "Object Attribute \"B\" not initialized as expected");
405
406 //
407 // Now use the config mechanism to set the attribute; and we should find the
408 // new value.
409 //
410 Config::Set("/NodeA/B", IntegerValue(-1));
411 a->GetAttribute("B", iv);
412 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -1, "Object Attribute \"B\" not set correctly");
413
414 //
415 // Try and set through a nonexistent path. Should do nothing.
416 //
417 Config::Set("/NodeB/A", IntegerValue(1234));
418 a->GetAttribute("A", iv);
419 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 1, "Object Attribute \"A\" unexpectedly set via bad path");
420
421 Config::Set("/NodeB/B", IntegerValue(1234));
422 a->GetAttribute("B", iv);
423 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -1, "Object Attribute \"B\" unexpectedly set via bad path");
424
425 //
426 // Step down one level of recursion and try again
427 //
429
430 //
431 // We should find the default values there.
432 //
433 b->GetAttribute("A", iv);
434 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" not initialized as expected");
435 b->GetAttribute("B", iv);
436 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 9, "Object Attribute \"B\" not initialized as expected");
437
438 //
439 // Now tell A that it has a B; and we should be able to set this new object's
440 // Attributes.
441 //
442 a->SetNodeB(b);
443
444 Config::Set("/NodeA/NodeB/A", IntegerValue(4));
445 Config::Set("/NodeA/NodeB/B", IntegerValue(-4));
446 b->GetAttribute("A", iv);
447 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 4, "Object Attribute \"A\" not set as expected");
448 b->GetAttribute("B", iv);
449 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -4, "Object Attribute \"B\" not set as expected");
450
451 //
452 // Try '*' for attributes
453 //
454 Config::Set("/*/A", IntegerValue(2));
455 a->GetAttribute("A", iv);
456 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 2, "Object Attribute \"A\" not set correctly");
457 b->GetAttribute("A", iv);
458 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 4, "Object Attribute \"A\" not set correctly");
459}
460
461/**
462 * \ingroup config-tests
463 * Test for the ability to deal configure with vectors of objects.
464 */
466{
467 public:
468 /** Constructor. */
470
471 /** Destructor. */
473 {
474 }
475
476 private:
477 void DoRun() override;
478};
479
481 : TestCase("Check ability to configure vectors of Object using regular expressions")
482{
483}
484
485void
487{
488 IntegerValue iv;
489
490 //
491 // Create a root namespace object
492 //
495
496 //
497 // Create an object under the root.
498 //
500 root->SetNodeA(a);
501
502 //
503 // Create an object one level down.
504 //
506 a->SetNodeB(b);
507
508 //
509 // Add four objects to the ObjectVector Attribute at the bottom of the
510 // object hierarchy. By this point, we believe that the Attributes
511 // will be initialized correctly.
512 //
517 b->AddNodeB(obj0);
518 b->AddNodeB(obj1);
519 b->AddNodeB(obj2);
520 b->AddNodeB(obj3);
521
522 //
523 // Set an Attribute of the zeroth Object in the vector by explicitly writing
524 // the '0' and make sure that only the one thing changed.
525 //
526 Config::Set("/NodeA/NodeB/NodesB/0/A", IntegerValue(-11));
527 obj0->GetAttribute("A", iv);
528 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -11, "Object Attribute \"A\" not set as expected");
529
530 obj1->GetAttribute("A", iv);
531 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
532
533 obj2->GetAttribute("A", iv);
534 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
535
536 obj3->GetAttribute("A", iv);
537 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
538
539 //
540 // Start using regular expression-like syntax to set Attributes. First try
541 // the OR syntax. Make sure that the two objects changed and nothing else
542 //
543 Config::Set("/NodeA/NodeB/NodesB/0|1/A", IntegerValue(-12));
544 obj0->GetAttribute("A", iv);
545 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -12, "Object Attribute \"A\" not set as expected");
546
547 obj1->GetAttribute("A", iv);
548 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -12, "Object Attribute \"A\" not set as expected");
549
550 obj2->GetAttribute("A", iv);
551 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
552
553 obj3->GetAttribute("A", iv);
554 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
555
556 //
557 // Make sure that extra '|' are allowed at the start and end of the regular expression
558 //
559 Config::Set("/NodeA/NodeB/NodesB/|0|1|/A", IntegerValue(-13));
560 obj0->GetAttribute("A", iv);
561 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -13, "Object Attribute \"A\" not set as expected");
562
563 obj1->GetAttribute("A", iv);
564 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -13, "Object Attribute \"A\" not set as expected");
565
566 obj2->GetAttribute("A", iv);
567 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
568
569 obj3->GetAttribute("A", iv);
570 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
571
572 //
573 // Try the [x-y] syntax
574 //
575 Config::Set("/NodeA/NodeB/NodesB/[0-2]/A", IntegerValue(-14));
576 obj0->GetAttribute("A", iv);
577 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -14, "Object Attribute \"A\" not set as expected");
578
579 obj1->GetAttribute("A", iv);
580 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -14, "Object Attribute \"A\" not set as expected");
581
582 obj2->GetAttribute("A", iv);
583 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -14, "Object Attribute \"A\" not set as expected");
584
585 obj3->GetAttribute("A", iv);
586 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 10, "Object Attribute \"A\" unexpectedly set");
587
588 //
589 // Try the [x-y] syntax at the other limit
590 //
591 Config::Set("/NodeA/NodeB/NodesB/[1-3]/A", IntegerValue(-15));
592 obj0->GetAttribute("A", iv);
593 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -14, "Object Attribute \"A\" unexpectedly set");
594
595 obj1->GetAttribute("A", iv);
596 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -15, "Object Attribute \"A\" not set as expected");
597
598 obj2->GetAttribute("A", iv);
599 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -15, "Object Attribute \"A\" not set as expected");
600
601 obj3->GetAttribute("A", iv);
602 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -15, "Object Attribute \"A\" not set as expected");
603
604 //
605 // Combine the [x-y] syntax and the OR sntax
606 //
607 Config::Set("/NodeA/NodeB/NodesB/[0-1]|3/A", IntegerValue(-16));
608 obj0->GetAttribute("A", iv);
609 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -16, "Object Attribute \"A\" not set as expected");
610
611 obj1->GetAttribute("A", iv);
612 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -16, "Object Attribute \"A\" not set as expected");
613
614 obj2->GetAttribute("A", iv);
615 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -15, "Object Attribute \"A\" unexpectedly set");
616
617 obj3->GetAttribute("A", iv);
618 NS_TEST_ASSERT_MSG_EQ(iv.Get(), -16, "Object Attribute \"A\" not set as expected");
619}
620
621/**
622 * \ingroup config-tests
623 * Test for the ability to trace configure with vectors of objects.
624 */
626{
627 public:
628 /** Constructor. */
630
631 /** Destructor. */
633 {
634 }
635
636 /**
637 * Trace callback without context.
638 * \param oldValue The old value.
639 * \param newValue The new value.
640 */
641 void Trace(int16_t oldValue [[maybe_unused]], int16_t newValue)
642 {
643 m_newValue = newValue;
644 }
645
646 /**
647 * Trace callback with context path.
648 * \param path The context path.
649 * \param old The old value.
650 * \param newValue The new value.
651 */
652 void TraceWithPath(std::string path, int16_t old [[maybe_unused]], int16_t newValue)
653 {
654 m_newValue = newValue;
655 m_path = path;
656 }
657
658 private:
659 void DoRun() override;
660
661 int16_t m_newValue; //!< Flag to detect tracing result.
662 std::string m_path; //!< The context path.
663};
664
666 : TestCase("Check ability to trace connect through vectors of Object using regular expressions")
667{
668}
669
670void
672{
673 IntegerValue iv;
674
675 //
676 // Create a root namespace object
677 //
680
681 //
682 // Create an object under the root.
683 //
685 root->SetNodeA(a);
686
687 //
688 // Create an object one level down.
689 //
691 a->SetNodeB(b);
692
693 //
694 // Add four objects to the ObjectVector Attribute at the bottom of the
695 // object hierarchy. By this point, we believe that the Attributes
696 // will be initialized correctly.
697 //
702 b->AddNodeB(obj0);
703 b->AddNodeB(obj1);
704 b->AddNodeB(obj2);
705 b->AddNodeB(obj3);
706
707 //
708 // Do a trace connect to some of the sources. We already checked parsing of
709 // the regular expressions, so we'll concentrate on the tracing part of the
710 // puzzle here.
711 //
712 Config::ConnectWithoutContext("/NodeA/NodeB/NodesB/[0-1]|3/Source",
714
715 //
716 // If we bug the trace source referred to by index '0' above, we should see
717 // the trace fire.
718 //
719 m_newValue = 0;
720 obj0->SetAttribute("Source", IntegerValue(-1));
721 NS_TEST_ASSERT_MSG_EQ(m_newValue, -1, "Trace 0 did not fire as expected");
722
723 //
724 // If we bug the trace source referred to by index '1' above, we should see
725 // the trace fire.
726 //
727 m_newValue = 0;
728 obj1->SetAttribute("Source", IntegerValue(-2));
729 NS_TEST_ASSERT_MSG_EQ(m_newValue, -2, "Trace 1 did not fire as expected");
730
731 //
732 // If we bug the trace source referred to by index '2' which is skipped above,
733 // we should not see the trace fire.
734 //
735 m_newValue = 0;
736 obj2->SetAttribute("Source", IntegerValue(-3));
737 NS_TEST_ASSERT_MSG_EQ(m_newValue, 0, "Trace 2 fired unexpectedly");
738
739 //
740 // If we bug the trace source referred to by index '3' above, we should see
741 // the trace fire.
742 //
743 m_newValue = 0;
744 obj3->SetAttribute("Source", IntegerValue(-4));
745 NS_TEST_ASSERT_MSG_EQ(m_newValue, -4, "Trace 3 did not fire as expected");
746
747 //
748 // Do a trace connect (with context) to some of the sources.
749 //
750 Config::Connect("/NodeA/NodeB/NodesB/[0-1]|3/Source",
752
753 //
754 // If we bug the trace source referred to by index '0' above, we should see
755 // the trace fire with the expected context path.
756 //
757 m_newValue = 0;
758 m_path = "";
759 obj0->SetAttribute("Source", IntegerValue(-1));
760 NS_TEST_ASSERT_MSG_EQ(m_newValue, -1, "Trace 0 did not fire as expected");
762 "/NodeA/NodeB/NodesB/0/Source",
763 "Trace 0 did not provide expected context");
764
765 //
766 // If we bug the trace source referred to by index '1' above, we should see
767 // the trace fire with the expected context path.
768 //
769 m_newValue = 0;
770 m_path = "";
771 obj1->SetAttribute("Source", IntegerValue(-2));
772 NS_TEST_ASSERT_MSG_EQ(m_newValue, -2, "Trace 1 did not fire as expected");
774 "/NodeA/NodeB/NodesB/1/Source",
775 "Trace 1 did not provide expected context");
776
777 //
778 // If we bug the trace source referred to by index '2' which is skipped above,
779 // we should not see the trace fire.
780 //
781 m_newValue = 0;
782 m_path = "";
783 obj2->SetAttribute("Source", IntegerValue(-3));
784 NS_TEST_ASSERT_MSG_EQ(m_newValue, 0, "Trace 2 fired unexpectedly");
785
786 //
787 // If we bug the trace source referred to by index '3' above, we should see
788 // the trace fire with the expected context path.
789 //
790 m_newValue = 0;
791 m_path = "";
792 obj3->SetAttribute("Source", IntegerValue(-4));
793 NS_TEST_ASSERT_MSG_EQ(m_newValue, -4, "Trace 3 did not fire as expected");
795 "/NodeA/NodeB/NodesB/1/Source",
796 "Trace 1 did not provide expected context");
797}
798
799/**
800 * \ingroup config-tests
801 * Test for the ability to search attributes of parent classes
802 * when Resolver searches for attributes in a derived class object.
803 * This test passes with the patch found in
804 * https://www.nsnam.org/bugzilla/show_bug.cgi?id=1673
805 * (also reported in https://www.nsnam.org/bugzilla/show_bug.cgi?id=1959)
806 */
808{
809 public:
810 /** Constructor. */
812
813 /** Destructor. */
817
818 private:
819 void DoRun() override;
820};
821
823 : TestCase("Check that attributes of base class are searchable from paths including objects of "
824 "derived class")
825{
826}
827
828void
830{
831 IntegerValue iv;
832 //
833 // Create a root namespace object that doesn't have attributes but
834 // whose parent class has 'NodeA' attribute
835 //
838
839 //
840 // Instantiate /NodeA
841 //
843 root->SetNodeA(a);
844
845 //
846 // BaseConfigObject has attribute X, but we aggregate DerivedConfigObject
847 // instead
848 //
850 a->AggregateObject(derived);
851 Config::Set("/NodeA/$DerivedConfigObject/X", IntegerValue(42));
852 derived->GetAttribute("X", iv);
853 NS_TEST_ASSERT_MSG_EQ(iv.Get(), 42, "Object Attribute \"X\" not settable in derived class");
854}
855
856/**
857 * \ingroup config-tests
858 * The Test Suite that glues all of the Test Cases together.
859 */
861{
862 public:
863 /** Constructor. */
865};
866
875
876/**
877 * \ingroup config-tests
878 * ConfigTestSuite instance variable.
879 */
881
882} // namespace tests
883
884} // namespace ns3
Hold a signed integer type.
Definition integer.h:34
int64_t Get() const
Definition integer.cc:26
A base class which provides memory management and object aggregation.
Definition object.h:78
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
encapsulates test code
Definition test.h:1050
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:292
A suite of tests to run.
Definition test.h:1267
Trace classes with value semantics.
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
~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.
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.
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 AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition pointer.h:248
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
Definition pointer.h:269
static ConfigTestSuite g_configTestSuite
ConfigTestSuite instance variable.
void Connect(std::string path, const CallbackBase &cb)
Definition config.cc:967
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition config.cc:943
void Set(std::string path, const AttributeValue &value)
Definition config.cc:869
void RegisterRootNamespaceObject(Ptr< Object > obj)
Definition config.cc:998
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
#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:134
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 > MakeIntegerChecker()
Definition integer.h:99
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Definition integer.h:35
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:684
Ptr< const AttributeChecker > MakeObjectVectorChecker()
ObjectPtrContainerValue ObjectVectorValue
ObjectVectorValue is an alias for ObjectPtrContainerValue.
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.