A Discrete-Event Network Simulator
API
config-test-suite.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #include "ns3/config.h"
21 #include "ns3/test.h"
22 #include "ns3/integer.h"
23 #include "ns3/traced-value.h"
24 #include "ns3/trace-source-accessor.h"
25 #include "ns3/callback.h"
26 
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"
32 #include "ns3/log.h"
33 
34 
35 #include <sstream>
36 
50 namespace ns3 {
51 
52 namespace tests {
53 
54 
59 class ConfigTestObject : public Object
60 {
61 public:
66  static TypeId GetTypeId (void);
67 
78 
89 
94  int8_t GetA (void) const;
99  int8_t GetB (void) const;
100 
101 private:
102  std::vector<Ptr<ConfigTestObject> > m_nodesA;
103  std::vector<Ptr<ConfigTestObject> > m_nodesB;
106  int8_t m_a;
107  int8_t m_b;
109 };
110 
111 TypeId
113 {
114  static TypeId tid = TypeId ("ConfigTestObject")
115  .SetParent<Object> ()
116  .AddAttribute ("NodesA", "",
119  MakeObjectVectorChecker<ConfigTestObject> ())
120  .AddAttribute ("NodesB", "",
123  MakeObjectVectorChecker<ConfigTestObject> ())
124  .AddAttribute ("NodeA", "",
125  PointerValue (),
127  MakePointerChecker<ConfigTestObject> ())
128  .AddAttribute ("NodeB", "",
129  PointerValue (),
131  MakePointerChecker<ConfigTestObject> ())
132  .AddAttribute ("A", "",
133  IntegerValue (10),
135  MakeIntegerChecker<int8_t> ())
136  .AddAttribute ("B", "",
137  IntegerValue (9),
139  MakeIntegerChecker<int8_t> ())
140  .AddAttribute ("Source", "XX",
141  IntegerValue (-1),
143  MakeIntegerChecker<int16_t> ())
144  .AddTraceSource ("Source", "XX",
146  "ns3::TracedValueCallback::Int16")
147  ;
148  return tid;
149 }
150 
151 void
153 {
154  m_nodeA = a;
155 }
156 
157 void
159 {
160  m_nodeB = b;
161 }
162 
163 void
165 {
166  m_nodesA.push_back (a);
167 }
168 
169 void
171 {
172  m_nodesB.push_back (b);
173 }
174 
175 int8_t
177 {
178  return m_a;
179 }
180 
181 int8_t
183 {
184  return m_b;
185 }
186 
192 {
193 public:
198  static TypeId GetTypeId (void);
201  {}
204  {}
205 };
206 
207 TypeId
209 {
210  static TypeId tid = TypeId ("DerivedConfigTestObject")
212  ;
213  return tid;
214 }
215 
220 class BaseConfigObject : public Object
221 {
222 public:
227  static TypeId GetTypeId (void);
229  BaseConfigObject (void) : m_x (15)
230  {}
232  virtual ~BaseConfigObject (void)
233  {}
234 
235 private:
236  int8_t m_x;
237 };
238 
239 TypeId
241 {
242  static TypeId tid = TypeId ("BaseConfigObject")
243  .SetParent<Object> ()
244  .AddAttribute ("X", "",
245  IntegerValue (10),
247  MakeIntegerChecker<int8_t> ())
248  ;
249  return tid;
250 }
251 
257 {
258 public:
263  static TypeId GetTypeId (void);
266  {}
268  virtual ~DerivedConfigObject (void)
269  {}
270 };
271 
272 TypeId
274 {
275  static TypeId tid = TypeId ("DerivedConfigObject")
277  ;
278  return tid;
279 }
280 
281 
287 {
288 public:
293  {}
294 
295 private:
296  virtual void DoRun (void);
297 };
298 
300  : TestCase ("Check ability to register a root namespace and use it")
301 {}
302 
303 void
305 {
306  IntegerValue iv;
307  //
308  // Create an object and register its attributes directly in the root
309  // namespace.
310  //
311  Ptr<ConfigTestObject> root = CreateObject<ConfigTestObject> ();
313 
314  //
315  // We should find the default values there.
316  //
317  root->GetAttribute ("A", iv);
318  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" not initialized as expected");
319 
320  //
321  // Now use the config mechanism to set the attribute; and we should find the
322  // new value.
323  //
324  Config::Set ("/A", IntegerValue (1));
325  root->GetAttribute ("A", iv);
326  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 1, "Object Attribute \"A\" not set correctly");
327 
328  //
329  // We should find the default values of "B" too.
330  //
331  root->GetAttribute ("B", iv);
332  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 9, "Object Attribute \"B\" not initialized as expected");
333 
334  //
335  // Now use the config mechanism to set the attribute; and we should find the
336  // new value.
337  //
338  Config::Set ("/B", IntegerValue (-1));
339  root->GetAttribute ("B", iv);
340  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -1, "Object Attribute \"B\" not set correctly");
341 }
342 
348 {
349 public:
354  {}
355 
356 private:
357  virtual void DoRun (void);
358 };
359 
361  : TestCase ("Check ability to register an object under the root namespace and use it")
362 {}
363 
364 void
366 {
367  IntegerValue iv;
368  //
369  // Create an object and register its attributes directly in the root
370  // namespace.
371  //
372  Ptr<ConfigTestObject> root = CreateObject<ConfigTestObject> ();
374 
375  Ptr<ConfigTestObject> a = CreateObject<ConfigTestObject> ();
376  root->SetNodeA (a);
377 
378  //
379  // We should find the default values there.
380  //
381  a->GetAttribute ("A", iv);
382  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" not initialized as expected");
383 
384  //
385  // Now use the config mechanism to set the attribute; and we should find the
386  // new value.
387  //
388  Config::Set ("/NodeA/A", IntegerValue (1));
389  a->GetAttribute ("A", iv);
390  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 1, "Object Attribute \"A\" not set correctly");
391 
392 
393  //
394  // We should find the default values of "B" too.
395  //
396  a->GetAttribute ("B", iv);
397  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 9, "Object Attribute \"B\" not initialized as expected");
398 
399  //
400  // Now use the config mechanism to set the attribute; and we should find the
401  // new value.
402  //
403  Config::Set ("/NodeA/B", IntegerValue (-1));
404  a->GetAttribute ("B", iv);
405  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -1, "Object Attribute \"B\" not set correctly");
406 
407  //
408  // Try and set through a nonexistent path. Should do nothing.
409  //
410  Config::Set ("/NodeB/A", IntegerValue (1234));
411  a->GetAttribute ("A", iv);
412  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 1, "Object Attribute \"A\" unexpectedly set via bad path");
413 
414  Config::Set ("/NodeB/B", IntegerValue (1234));
415  a->GetAttribute ("B", iv);
416  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -1, "Object Attribute \"B\" unexpectedly set via bad path");
417 
418  //
419  // Step down one level of recursion and try again
420  //
421  Ptr<ConfigTestObject> b = CreateObject<ConfigTestObject> ();
422 
423  //
424  // We should find the default values there.
425  //
426  b->GetAttribute ("A", iv);
427  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" not initialized as expected");
428  b->GetAttribute ("B", iv);
429  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 9, "Object Attribute \"B\" not initialized as expected");
430 
431  //
432  // Now tell A that it has a B; and we should be able to set this new object's
433  // Attributes.
434  //
435  a->SetNodeB (b);
436 
437  Config::Set ("/NodeA/NodeB/A", IntegerValue (4));
438  Config::Set ("/NodeA/NodeB/B", IntegerValue (-4));
439  b->GetAttribute ("A", iv);
440  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 4, "Object Attribute \"A\" not set as expected");
441  b->GetAttribute ("B", iv);
442  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -4, "Object Attribute \"B\" not set as expected");
443 
444 
445  //
446  // Try '*' for attributes
447  //
448  Config::Set ("/*/A", IntegerValue (2));
449  a->GetAttribute ("A", iv);
450  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 2, "Object Attribute \"A\" not set correctly");
451  b->GetAttribute ("A", iv);
452  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 4, "Object Attribute \"A\" not set correctly");
453 }
454 
460 {
461 public:
466  {}
467 
468 private:
469  virtual void DoRun (void);
470 };
471 
473  : TestCase ("Check ability to configure vectors of Object using regular expressions")
474 {}
475 
476 void
478 {
479  IntegerValue iv;
480 
481  //
482  // Create a root namespace object
483  //
484  Ptr<ConfigTestObject> root = CreateObject<ConfigTestObject> ();
486 
487  //
488  // Create an object under the root.
489  //
490  Ptr<ConfigTestObject> a = CreateObject<ConfigTestObject> ();
491  root->SetNodeA (a);
492 
493  //
494  // Create an object one level down.
495  //
496  Ptr<ConfigTestObject> b = CreateObject<ConfigTestObject> ();
497  a->SetNodeB (b);
498 
499  //
500  // Add four objects to the ObjectVector Attribute at the bottom of the
501  // object hierarchy. By this point, we believe that the Attributes
502  // will be initialized correctly.
503  //
504  Ptr<ConfigTestObject> obj0 = CreateObject<ConfigTestObject> ();
505  Ptr<ConfigTestObject> obj1 = CreateObject<ConfigTestObject> ();
506  Ptr<ConfigTestObject> obj2 = CreateObject<ConfigTestObject> ();
507  Ptr<ConfigTestObject> obj3 = CreateObject<ConfigTestObject> ();
508  b->AddNodeB (obj0);
509  b->AddNodeB (obj1);
510  b->AddNodeB (obj2);
511  b->AddNodeB (obj3);
512 
513  //
514  // Set an Attribute of the zeroth Object in the vector by explicitly writing
515  // the '0' and make sure that only the one thing changed.
516  //
517  Config::Set ("/NodeA/NodeB/NodesB/0/A", IntegerValue (-11));
518  obj0->GetAttribute ("A", iv);
519  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -11, "Object Attribute \"A\" not set as expected");
520 
521  obj1->GetAttribute ("A", iv);
522  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
523 
524  obj2->GetAttribute ("A", iv);
525  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
526 
527  obj3->GetAttribute ("A", iv);
528  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
529 
530  //
531  // Start using regular expression-like syntax to set Attributes. First try
532  // the OR syntax. Make sure that the two objects changed and nothing else
533  //
534  Config::Set ("/NodeA/NodeB/NodesB/0|1/A", IntegerValue (-12));
535  obj0->GetAttribute ("A", iv);
536  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -12, "Object Attribute \"A\" not set as expected");
537 
538  obj1->GetAttribute ("A", iv);
539  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -12, "Object Attribute \"A\" not set as expected");
540 
541  obj2->GetAttribute ("A", iv);
542  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
543 
544  obj3->GetAttribute ("A", iv);
545  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
546 
547  //
548  // Make sure that extra '|' are allowed at the start and end of the regular expression
549  //
550  Config::Set ("/NodeA/NodeB/NodesB/|0|1|/A", IntegerValue (-13));
551  obj0->GetAttribute ("A", iv);
552  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -13, "Object Attribute \"A\" not set as expected");
553 
554  obj1->GetAttribute ("A", iv);
555  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -13, "Object Attribute \"A\" not set as expected");
556 
557  obj2->GetAttribute ("A", iv);
558  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
559 
560  obj3->GetAttribute ("A", iv);
561  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
562 
563  //
564  // Try the [x-y] syntax
565  //
566  Config::Set ("/NodeA/NodeB/NodesB/[0-2]/A", IntegerValue (-14));
567  obj0->GetAttribute ("A", iv);
568  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -14, "Object Attribute \"A\" not set as expected");
569 
570  obj1->GetAttribute ("A", iv);
571  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -14, "Object Attribute \"A\" not set as expected");
572 
573  obj2->GetAttribute ("A", iv);
574  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -14, "Object Attribute \"A\" not set as expected");
575 
576  obj3->GetAttribute ("A", iv);
577  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
578 
579  //
580  // Try the [x-y] syntax at the other limit
581  //
582  Config::Set ("/NodeA/NodeB/NodesB/[1-3]/A", IntegerValue (-15));
583  obj0->GetAttribute ("A", iv);
584  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -14, "Object Attribute \"A\" unexpectedly set");
585 
586  obj1->GetAttribute ("A", iv);
587  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -15, "Object Attribute \"A\" not set as expected");
588 
589  obj2->GetAttribute ("A", iv);
590  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -15, "Object Attribute \"A\" not set as expected");
591 
592  obj3->GetAttribute ("A", iv);
593  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -15, "Object Attribute \"A\" not set as expected");
594 
595  //
596  // Combine the [x-y] syntax and the OR sntax
597  //
598  Config::Set ("/NodeA/NodeB/NodesB/[0-1]|3/A", IntegerValue (-16));
599  obj0->GetAttribute ("A", iv);
600  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -16, "Object Attribute \"A\" not set as expected");
601 
602  obj1->GetAttribute ("A", iv);
603  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -16, "Object Attribute \"A\" not set as expected");
604 
605  obj2->GetAttribute ("A", iv);
606  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -15, "Object Attribute \"A\" unexpectedly set");
607 
608  obj3->GetAttribute ("A", iv);
609  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -16, "Object Attribute \"A\" not set as expected");
610 }
611 
617 {
618 public:
623  {}
624 
630  void Trace ([[maybe_unused]] int16_t oldValue, int16_t newValue)
631  {
632  m_newValue = newValue;
633  }
640  void TraceWithPath (std::string path, [[maybe_unused]] int16_t old, int16_t newValue)
641  {
642  m_newValue = newValue;
643  m_path = path;
644  }
645 
646 private:
647  virtual void DoRun (void);
648 
649  int16_t m_newValue;
650  std::string m_path;
651 };
652 
654  : TestCase ("Check ability to trace connect through vectors of Object using regular expressions")
655 {}
656 
657 void
659 {
660  IntegerValue iv;
661 
662  //
663  // Create a root namespace object
664  //
665  Ptr<ConfigTestObject> root = CreateObject<ConfigTestObject> ();
667 
668  //
669  // Create an object under the root.
670  //
671  Ptr<ConfigTestObject> a = CreateObject<ConfigTestObject> ();
672  root->SetNodeA (a);
673 
674  //
675  // Create an object one level down.
676  //
677  Ptr<ConfigTestObject> b = CreateObject<ConfigTestObject> ();
678  a->SetNodeB (b);
679 
680  //
681  // Add four objects to the ObjectVector Attribute at the bottom of the
682  // object hierarchy. By this point, we believe that the Attributes
683  // will be initialized correctly.
684  //
685  Ptr<ConfigTestObject> obj0 = CreateObject<ConfigTestObject> ();
686  Ptr<ConfigTestObject> obj1 = CreateObject<ConfigTestObject> ();
687  Ptr<ConfigTestObject> obj2 = CreateObject<ConfigTestObject> ();
688  Ptr<ConfigTestObject> obj3 = CreateObject<ConfigTestObject> ();
689  b->AddNodeB (obj0);
690  b->AddNodeB (obj1);
691  b->AddNodeB (obj2);
692  b->AddNodeB (obj3);
693 
694  //
695  // Do a trace connect to some of the sources. We already checked parsing of
696  // the regular expressions, so we'll concentrate on the tracing part of the
697  // puzzle here.
698  //
699  Config::ConnectWithoutContext ("/NodeA/NodeB/NodesB/[0-1]|3/Source",
701 
702  //
703  // If we bug the trace source referred to by index '0' above, we should see
704  // the trace fire.
705  //
706  m_newValue = 0;
707  obj0->SetAttribute ("Source", IntegerValue (-1));
708  NS_TEST_ASSERT_MSG_EQ (m_newValue, -1, "Trace 0 did not fire as expected");
709 
710  //
711  // If we bug the trace source referred to by index '1' above, we should see
712  // the trace fire.
713  //
714  m_newValue = 0;
715  obj1->SetAttribute ("Source", IntegerValue (-2));
716  NS_TEST_ASSERT_MSG_EQ (m_newValue, -2, "Trace 1 did not fire as expected");
717 
718  //
719  // If we bug the trace source referred to by index '2' which is skipped above,
720  // we should not see the trace fire.
721  //
722  m_newValue = 0;
723  obj2->SetAttribute ("Source", IntegerValue (-3));
724  NS_TEST_ASSERT_MSG_EQ (m_newValue, 0, "Trace 2 fired unexpectedly");
725 
726  //
727  // If we bug the trace source referred to by index '3' above, we should see
728  // the trace fire.
729  //
730  m_newValue = 0;
731  obj3->SetAttribute ("Source", IntegerValue (-4));
732  NS_TEST_ASSERT_MSG_EQ (m_newValue, -4, "Trace 3 did not fire as expected");
733 
734  //
735  // Do a trace connect (with context) to some of the sources.
736  //
737  Config::Connect ("/NodeA/NodeB/NodesB/[0-1]|3/Source",
739 
740  //
741  // If we bug the trace source referred to by index '0' above, we should see
742  // the trace fire with the expected context path.
743  //
744  m_newValue = 0;
745  m_path = "";
746  obj0->SetAttribute ("Source", IntegerValue (-1));
747  NS_TEST_ASSERT_MSG_EQ (m_newValue, -1, "Trace 0 did not fire as expected");
748  NS_TEST_ASSERT_MSG_EQ (m_path, "/NodeA/NodeB/NodesB/0/Source", "Trace 0 did not provide expected context");
749 
750  //
751  // If we bug the trace source referred to by index '1' above, we should see
752  // the trace fire with the expected context path.
753  //
754  m_newValue = 0;
755  m_path = "";
756  obj1->SetAttribute ("Source", IntegerValue (-2));
757  NS_TEST_ASSERT_MSG_EQ (m_newValue, -2, "Trace 1 did not fire as expected");
758  NS_TEST_ASSERT_MSG_EQ (m_path, "/NodeA/NodeB/NodesB/1/Source", "Trace 1 did not provide expected context");
759 
760  //
761  // If we bug the trace source referred to by index '2' which is skipped above,
762  // we should not see the trace fire.
763  //
764  m_newValue = 0;
765  m_path = "";
766  obj2->SetAttribute ("Source", IntegerValue (-3));
767  NS_TEST_ASSERT_MSG_EQ (m_newValue, 0, "Trace 2 fired unexpectedly");
768 
769  //
770  // If we bug the trace source referred to by index '3' above, we should see
771  // the trace fire with the expected context path.
772  //
773  m_newValue = 0;
774  m_path = "";
775  obj3->SetAttribute ("Source", IntegerValue (-4));
776  NS_TEST_ASSERT_MSG_EQ (m_newValue, -4, "Trace 3 did not fire as expected");
777  NS_TEST_ASSERT_MSG_EQ (m_path, "/NodeA/NodeB/NodesB/1/Source", "Trace 1 did not provide expected context");
778 }
779 
789 {
790 public:
795  {}
796 
797 private:
798  virtual void DoRun (void);
799 
800 };
801 
803  : TestCase ("Check that attributes of base class are searchable from paths including objects of derived class")
804 {}
805 
806 void
808 {
809  IntegerValue iv;
810  //
811  // Create a root namespace object that doesn't have attributes but
812  // whose parent class has 'NodeA' attribute
813  //
814  Ptr<DerivedConfigTestObject> root = CreateObject<DerivedConfigTestObject> ();
816 
817  //
818  // Instantiate /NodeA
819  //
820  Ptr<DerivedConfigTestObject> a = CreateObject<DerivedConfigTestObject> ();
821  root->SetNodeA (a);
822 
823  //
824  // BaseConfigObject has attribute X, but we aggregate DerivedConfigObject
825  // instead
826  //
827  Ptr<DerivedConfigObject> derived = CreateObject<DerivedConfigObject> ();
828  a->AggregateObject (derived);
829  Config::Set ("/NodeA/$DerivedConfigObject/X", IntegerValue (42));
830  derived->GetAttribute ("X", iv);
831  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 42, "Object Attribute \"X\" not settable in derived class");
832 
833 }
834 
840 {
841 public:
843  ConfigTestSuite ();
844 };
845 
847  : TestSuite ("config")
848 {
853 }
854 
860 
861 
862 } // namespace tests
863 
864 } // namespace ns3
865 
Hold a signed integer type.
Definition: integer.h:44
int64_t Get(void) const
Definition: integer.cc:35
A base class which provides memory management and object aggregation.
Definition: object.h:88
Container for a set of ns3::Object pointers.
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
encapsulates test code
Definition: test.h:994
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
A suite of tests to run.
Definition: test.h:1188
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
int8_t m_x
X attribute target.
virtual ~BaseConfigObject(void)
Destructor.
static TypeId GetTypeId(void)
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.
int8_t GetB(void) const
Get node b 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.
static TypeId GetTypeId(void)
Get the type ID.
int8_t GetA(void) const
Get node A function.
int8_t m_b
B attribute target.
std::vector< Ptr< ConfigTestObject > > m_nodesB
NodesB attribute target.
int8_t m_a
A attribute target.
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(void)
Get the type ID.
virtual ~DerivedConfigObject(void)
Destructor.
virtual ~DerivedConfigTestObject(void)
Destructor.
static TypeId GetTypeId(void)
Get the type ID.
Test for the ability to deal configure with vectors of objects.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test for the ability to trace configure with vectors of objects.
int16_t m_newValue
Flag to detect tracing result.
void TraceWithPath(std::string path, [[maybe_unused]] int16_t old, int16_t newValue)
Trace callback with context path.
void Trace([[maybe_unused]] int16_t oldValue, int16_t newValue)
Trace callback without context.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test for the ability to register and use a root namespace.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test for the ability to search attributes of parent classes when Resolver searches for attributes in ...
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test for the ability to add an object under the root namespace.
virtual void DoRun(void)
Implementation to actually run this TestCase.
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:45
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Definition: object-vector.h:81
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:227
static ConfigTestSuite g_configTestSuite
ConfigTestSuite instance variable.
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:920
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:901
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:839
void RegisterRootNamespaceObject(Ptr< Object > obj)
Definition: config.cc:946
#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:141
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.
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...
Definition: callback.h:1648