A Discrete-Event Network Simulator
API
callback-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) 2009 University of Washington
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 
19 #include "ns3/test.h"
20 #include "ns3/callback.h"
21 #include "ns3/unused.h"
22 #include <stdint.h>
23 
24 using namespace ns3;
25 
26 // ===========================================================================
27 // Test the basic Callback mechanism
28 // ===========================================================================
30 {
31 public:
34  {}
35 
36  void Target1 (void)
37  {
38  m_test1 = true;
39  }
40  int Target2 (void)
41  {
42  m_test2 = true;
43  return 2;
44  }
45  void Target3 (double a)
46  {
47  NS_UNUSED (a);
48  m_test3 = true;
49  }
50  int Target4 (double a, int b)
51  {
52  NS_UNUSED (a);
53  NS_UNUSED (b);
54  m_test4 = true;
55  return 4;
56  }
57 
58 private:
59  virtual void DoRun (void);
60  virtual void DoSetup (void);
61 
62  bool m_test1;
63  bool m_test2;
64  bool m_test3;
65  bool m_test4;
66 };
67 
68 static bool gBasicCallbackTest5;
69 static bool gBasicCallbackTest6;
70 static bool gBasicCallbackTest7;
71 
72 void
74 {
75  gBasicCallbackTest5 = true;
76 }
77 
78 void
80 {
81  gBasicCallbackTest6 = true;
82 }
83 
84 int
86 {
87  gBasicCallbackTest7 = true;
88  return a;
89 }
90 
92  : TestCase ("Check basic Callback mechansim")
93 {}
94 
95 void
97 {
98  m_test1 = false;
99  m_test2 = false;
100  m_test3 = false;
101  m_test4 = false;
102  gBasicCallbackTest5 = false;
103  gBasicCallbackTest6 = false;
104  gBasicCallbackTest7 = false;
105 }
106 
107 void
109 {
110  //
111  // Make sure we can declare and compile a Callback pointing to a member
112  // function returning void and execute it.
113  //
115  target1 ();
116  NS_TEST_ASSERT_MSG_EQ (m_test1, true, "Callback did not fire");
117 
118  //
119  // Make sure we can declare and compile a Callback pointing to a member
120  // function that returns an int and execute it.
121  //
122  Callback<int> target2;
124  target2 ();
125  NS_TEST_ASSERT_MSG_EQ (m_test2, true, "Callback did not fire");
126 
127  //
128  // Make sure we can declare and compile a Callback pointing to a member
129  // function that returns void, takes a double parameter, and execute it.
130  //
132  target3 (0.0);
133  NS_TEST_ASSERT_MSG_EQ (m_test3, true, "Callback did not fire");
134 
135  //
136  // Make sure we can declare and compile a Callback pointing to a member
137  // function that returns void, takes two parameters, and execute it.
138  //
140  target4 (0.0, 1);
141  NS_TEST_ASSERT_MSG_EQ (m_test4, true, "Callback did not fire");
142 
143  //
144  // Make sure we can declare and compile a Callback pointing to a non-member
145  // function that returns void, and execute it. This is a lower level call
146  // than MakeCallback so we have got to include at least two arguments to make
147  // sure that the constructor is properly disambiguated. If the arguments are
148  // not needed, we just pass in dummy values.
149  //
150  Callback<void> target5 = Callback<void> (&BasicCallbackTarget5, true, true);
151  target5 ();
152  NS_TEST_ASSERT_MSG_EQ (gBasicCallbackTest5, true, "Callback did not fire");
153 
154  //
155  // Make sure we can declare and compile a Callback pointing to a non-member
156  // function that returns void, takes one integer argument and execute it.
157  // We also need to provide two dummy arguments to the constructor here.
158  //
160  target6 (1);
161  NS_TEST_ASSERT_MSG_EQ (gBasicCallbackTest6, true, "Callback did not fire");
162 
163  //
164  // Make sure we can declare and compile a Callback pointing to a non-member
165  // function that returns int, takes one integer argument and execute it.
166  // We also need to provide two dummy arguments to the constructor here.
167  //
169  target7 (1);
170  NS_TEST_ASSERT_MSG_EQ (gBasicCallbackTest7, true, "Callback did not fire");
171 }
172 
173 // ===========================================================================
174 // Test the MakeCallback mechanism
175 // ===========================================================================
177 {
178 public:
181  {}
182 
183  void Target1 (void)
184  {
185  m_test1 = true;
186  }
187  int Target2 (void)
188  {
189  m_test2 = true;
190  return 2;
191  }
192  void Target3 (double a)
193  {
194  NS_UNUSED (a);
195  m_test3 = true;
196  }
197  int Target4 (double a, int b)
198  {
199  NS_UNUSED (a);
200  NS_UNUSED (b);
201  m_test4 = true;
202  return 4;
203  }
204 
205 private:
206  virtual void DoRun (void);
207  virtual void DoSetup (void);
208 
209  bool m_test1;
210  bool m_test2;
211  bool m_test3;
212  bool m_test4;
213 };
214 
215 static bool gMakeCallbackTest5;
216 static bool gMakeCallbackTest6;
217 static bool gMakeCallbackTest7;
218 
219 void
221 {
222  gMakeCallbackTest5 = true;
223 }
224 
225 void
227 {
228  gMakeCallbackTest6 = true;
229 }
230 
231 int
233 {
234  gMakeCallbackTest7 = true;
235  return a;
236 }
237 
239  : TestCase ("Check MakeCallback() mechanism")
240 {}
241 
242 void
244 {
245  m_test1 = false;
246  m_test2 = false;
247  m_test3 = false;
248  m_test4 = false;
249  gMakeCallbackTest5 = false;
250  gMakeCallbackTest6 = false;
251  gMakeCallbackTest7 = false;
252 }
253 
254 void
256 {
257  //
258  // Make sure we can declare and make a Callback pointing to a member
259  // function returning void and execute it.
260  //
262  target1 ();
263  NS_TEST_ASSERT_MSG_EQ (m_test1, true, "Callback did not fire");
264 
265  //
266  // Make sure we can declare and make a Callback pointing to a member
267  // function that returns an int and execute it.
268  //
270  target2 ();
271  NS_TEST_ASSERT_MSG_EQ (m_test2, true, "Callback did not fire");
272 
273  //
274  // Make sure we can declare and make a Callback pointing to a member
275  // function that returns void, takes a double parameter, and execute it.
276  //
278  target3 (0.0);
279  NS_TEST_ASSERT_MSG_EQ (m_test3, true, "Callback did not fire");
280 
281  //
282  // Make sure we can declare and make a Callback pointing to a member
283  // function that returns void, takes two parameters, and execute it.
284  //
286  target4 (0.0, 1);
287  NS_TEST_ASSERT_MSG_EQ (m_test4, true, "Callback did not fire");
288 
289  //
290  // Make sure we can declare and make a Callback pointing to a non-member
291  // function that returns void, and execute it. This uses a higher level call
292  // than in the basic tests so we do not need to include any dummy arguments
293  // here.
294  //
296  target5 ();
297  NS_TEST_ASSERT_MSG_EQ (gMakeCallbackTest5, true, "Callback did not fire");
298 
299  //
300  // Make sure we can declare and compile a Callback pointing to a non-member
301  // function that returns void, takes one integer argument and execute it.
302  // This uses a higher level call than in the basic tests so we do not need to
303  // include any dummy arguments here.
304  //
306  target6 (1);
307  NS_TEST_ASSERT_MSG_EQ (gMakeCallbackTest6, true, "Callback did not fire");
308 
309  //
310  // Make sure we can declare and compile a Callback pointing to a non-member
311  // function that returns int, takes one integer argument and execute it.
312  // This uses a higher level call than in the basic tests so we do not need to
313  // include any dummy arguments here.
314  //
316  target7 (1);
317  NS_TEST_ASSERT_MSG_EQ (gMakeCallbackTest7, true, "Callback did not fire");
318 }
319 
320 // ===========================================================================
321 // Test the MakeBoundCallback mechanism
322 // ===========================================================================
324 {
325 public:
328  {}
329 
330 private:
331  virtual void DoRun (void);
332  virtual void DoSetup (void);
333 };
334 
357 
358 void
360 {
362 }
363 
364 void
366 {
368 }
369 
370 int
371 MakeBoundCallbackTarget3 (bool *a, int b)
372 {
375  return 1234;
376 }
377 
378 void
380 {
383 }
384 
385 int
387 {
390  return 1234;
391 }
392 
393 int
394 MakeBoundCallbackTarget6 (int a, int b, int c)
395 {
399  return 1234;
400 }
401 
402 void
403 MakeBoundCallbackTarget7 (int a, int b, int c)
404 {
408 }
409 
410 int
411 MakeBoundCallbackTarget8 (int a, int b, int c)
412 {
416  return 1234;
417 }
418 
419 int
420 MakeBoundCallbackTarget9 (int a, int b, int c, int d)
421 {
426  return 1234;
427 }
428 
430  : TestCase ("Check MakeBoundCallback() mechanism")
431 {}
432 
433 void
435 {
458 }
459 
460 void
462 {
463  //
464  // This is slightly tricky to explain. A bound Callback allows us to package
465  // up arguments for use later. The arguments are bound when the callback is
466  // created and the code that fires the Callback does not know they are there.
467  //
468  // Since the callback is *declared* according to the way it will be used, the
469  // arguments are not seen there. However, the target function of the callback
470  // will have the provided arguments present. The MakeBoundCallback template
471  // function is what connects the two together and where you provide the
472  // arguments to be bound.
473  //
474  // Here we declare a Callback that returns a void and takes no parameters.
475  // MakeBoundCallback connects this Callback to a target function that returns
476  // void and takes an integer argument. That integer argument is bound to the
477  // value 1234. When the Callback is fired, no integer argument is provided
478  // directly. The argument is provided by bound Callback mechanism.
479  //
481  target1 ();
482  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest1, 1234, "Callback did not fire or binding not correct");
483 
484  //
485  // Make sure we can bind a pointer value (a common use case).
486  //
487  bool a;
489  target2 ();
490  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest2, &a, "Callback did not fire or binding not correct");
491 
492  //
493  // Make sure we can mix and match bound and unbound arguments. This callback
494  // returns an integer so we should see that appear.
495  //
497  int result = target3 (2468);
498  NS_TEST_ASSERT_MSG_EQ (result, 1234, "Return value of callback not correct");
499  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest3a, &a, "Callback did not fire or binding not correct");
500  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest3b, 2468, "Callback did not fire or argument not correct");
501 
502  //
503  // Test the TwoBound variant
504  //
506  target4 ();
507  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest4a, 3456, "Callback did not fire or binding not correct");
508  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest4b, 5678, "Callback did not fire or binding not correct");
509 
511  int resultTwoA = target5 ();
512  NS_TEST_ASSERT_MSG_EQ (resultTwoA, 1234, "Return value of callback not correct");
513  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest5a, 3456, "Callback did not fire or binding not correct");
514  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest5b, 5678, "Callback did not fire or binding not correct");
515 
517  int resultTwoB = target6 (6789);
518  NS_TEST_ASSERT_MSG_EQ (resultTwoB, 1234, "Return value of callback not correct");
519  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest6a, 3456, "Callback did not fire or binding not correct");
520  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest6b, 5678, "Callback did not fire or binding not correct");
521  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest6c, 6789, "Callback did not fire or argument not correct");
522 
523  //
524  // Test the ThreeBound variant
525  //
526  Callback<void> target7 = MakeBoundCallback (&MakeBoundCallbackTarget7, 2345, 3456, 4567);
527  target7 ();
528  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest7a, 2345, "Callback did not fire or binding not correct");
529  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest7b, 3456, "Callback did not fire or binding not correct");
530  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest7c, 4567, "Callback did not fire or binding not correct");
531 
532  Callback<int> target8 = MakeBoundCallback (&MakeBoundCallbackTarget8, 2345, 3456, 4567);
533  int resultThreeA = target8 ();
534  NS_TEST_ASSERT_MSG_EQ (resultThreeA, 1234, "Return value of callback not correct");
535  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest8a, 2345, "Callback did not fire or binding not correct");
536  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest8b, 3456, "Callback did not fire or binding not correct");
537  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest8c, 4567, "Callback did not fire or binding not correct");
538 
539  Callback<int, int> target9 = MakeBoundCallback (&MakeBoundCallbackTarget9, 2345, 3456, 4567);
540  int resultThreeB = target9 (5678);
541  NS_TEST_ASSERT_MSG_EQ (resultThreeB, 1234, "Return value of callback not correct");
542  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest9a, 2345, "Callback did not fire or binding not correct");
543  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest9b, 3456, "Callback did not fire or binding not correct");
544  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest9c, 4567, "Callback did not fire or binding not correct");
545  NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest9d, 5678, "Callback did not fire or binding not correct");
546 }
547 
548 // ===========================================================================
549 // Test the Nullify mechanism
550 // ===========================================================================
552 {
553 public:
556  {}
557 
558  void Target1 (void)
559  {
560  m_test1 = true;
561  }
562 
563 private:
564  virtual void DoRun (void);
565  virtual void DoSetup (void);
566 
567  bool m_test1;
568 };
569 
571  : TestCase ("Check Nullify() and IsNull()")
572 {}
573 
574 void
576 {
577  m_test1 = false;
578 }
579 
580 void
582 {
583  //
584  // Make sure we can declare and make a Callback pointing to a member
585  // function returning void and execute it.
586  //
588  target1 ();
589  NS_TEST_ASSERT_MSG_EQ (m_test1, true, "Callback did not fire");
590 
591  NS_TEST_ASSERT_MSG_EQ (target1.IsNull (), false, "Working Callback reports IsNull()");
592 
593  target1.Nullify ();
594 
595  NS_TEST_ASSERT_MSG_EQ (target1.IsNull (), true, "Nullified Callback reports not IsNull()");
596 }
597 
598 // ===========================================================================
599 // Make sure that various MakeCallback template functions compile and execute.
600 // Doesn't check an results of the execution.
601 // ===========================================================================
603 {
604 public:
607  {}
608 
609  void Target1 (void)
610  {
611  m_test1 = true;
612  }
613 
614 private:
615  virtual void DoRun (void);
616 
617  bool m_test1;
618 };
619 
620 /* *NS_CHECK_STYLE_OFF* */
621 void TestFZero (void) {}
622 void TestFOne (int) {}
623 void TestFTwo (int, int) {}
624 void TestFThree (int, int, int) {}
625 void TestFFour (int, int, int, int) {}
626 void TestFFive (int, int, int, int, int) {}
627 void TestFSix (int, int, int, int, int, int) {}
628 
629 void TestFROne (int &) {}
630 void TestFRTwo (int &, int &) {}
631 void TestFRThree (int &, int &, int &) {}
632 void TestFRFour (int &, int &, int &, int &) {}
633 void TestFRFive (int &, int &, int &, int &, int &) {}
634 void TestFRSix (int &, int &, int &, int &, int &, int &) {}
635 /* *NS_CHECK_STYLE_ON* */
636 
638 {
639 public:
640  void PublicParent (void)
641  {}
642 
643 protected:
644  void ProtectedParent (void)
645  {}
646  static void StaticProtectedParent (void)
647  {}
648 
649 private:
650  void PrivateParent (void)
651  {}
652 };
653 
655 {
656 public:
657  /* *NS_CHECK_STYLE_OFF* */
658  void TestZero (void) {}
659  void TestOne (int) {}
660  void TestTwo (int, int) {}
661  void TestThree (int, int, int) {}
662  void TestFour (int, int, int, int) {}
663  void TestFive (int, int, int, int, int) {}
664  void TestSix (int, int, int, int, int, int) {}
665  void TestCZero (void) const {}
666  void TestCOne (int) const {}
667  void TestCTwo (int, int) const {}
668  void TestCThree (int, int, int) const {}
669  void TestCFour (int, int, int, int) const {}
670  void TestCFive (int, int, int, int, int) const {}
671  void TestCSix (int, int, int, int, int, int) const {}
672  /* *NS_CHECK_STYLE_ON* */
673 
675  {
679  // as expected, fails.
680  // MakeCallback (&CallbackTestParent::PrivateParent, this);
681  // unexpected, but fails too. It does fumble me.
682  // MakeCallback (&CallbackTestParent::ProtectedParent, this);
683  }
684 
685 };
686 
688  : TestCase ("Check various MakeCallback() template functions")
689 {}
690 
691 void
693 {
694  CallbackTestClass that;
695 
703 
711 
719 
726 
732 
738 
739  that.CheckParentalRights ();
740 }
741 
742 // ===========================================================================
743 // The Test Suite that glues all of the Test Cases together.
744 // ===========================================================================
746 {
747 public:
749 };
750 
752  : TestSuite ("callback", UNIT)
753 {
754  AddTestCase (new BasicCallbackTestCase, TestCase::QUICK);
755  AddTestCase (new MakeCallbackTestCase, TestCase::QUICK);
756  AddTestCase (new MakeBoundCallbackTestCase, TestCase::QUICK);
757  AddTestCase (new NullifyCallbackTestCase, TestCase::QUICK);
758  AddTestCase (new MakeCallbackTemplatesTestCase, TestCase::QUICK);
759 }
760 
MakeCallbackTestCase::m_test3
bool m_test3
Definition: callback-test-suite.cc:211
CallbackTestClass::TestCThree
void TestCThree(int, int, int) const
Definition: callback-test-suite.cc:668
BasicCallbackTarget6
void BasicCallbackTarget6(int)
Definition: callback-test-suite.cc:79
BasicCallbackTestCase::Target4
int Target4(double a, int b)
Definition: callback-test-suite.cc:50
TestFRFive
void TestFRFive(int &, int &, int &, int &, int &)
Definition: callback-test-suite.cc:633
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
gMakeBoundCallbackTest4a
static int gMakeBoundCallbackTest4a
Definition: callback-test-suite.cc:339
gMakeBoundCallbackTest7a
static int gMakeBoundCallbackTest7a
Definition: callback-test-suite.cc:347
TestFOne
void TestFOne(int)
Definition: callback-test-suite.cc:622
MakeBoundCallbackTestCase::DoSetup
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
Definition: callback-test-suite.cc:434
CallbackTestClass::TestCFive
void TestCFive(int, int, int, int, int) const
Definition: callback-test-suite.cc:670
gMakeBoundCallbackTest6a
static int gMakeBoundCallbackTest6a
Definition: callback-test-suite.cc:344
gMakeBoundCallbackTest4b
static int gMakeBoundCallbackTest4b
Definition: callback-test-suite.cc:340
gMakeCallbackTest7
static bool gMakeCallbackTest7
Definition: callback-test-suite.cc:217
MakeCallbackTestCase
Definition: callback-test-suite.cc:177
CallbackTestSuite
Definition: callback-test-suite.cc:746
CallbackTestParent::PrivateParent
void PrivateParent(void)
Definition: callback-test-suite.cc:650
ns3::Callback< void >
MakeCallbackTarget5
void MakeCallbackTarget5(void)
Definition: callback-test-suite.cc:220
TestFRSix
void TestFRSix(int &, int &, int &, int &, int &, int &)
Definition: callback-test-suite.cc:634
CallbackTestParent::StaticProtectedParent
static void StaticProtectedParent(void)
Definition: callback-test-suite.cc:646
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
CallbackTestClass::TestThree
void TestThree(int, int, int)
Definition: callback-test-suite.cc:661
ns3::Callback::IsNull
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1386
TestFRFour
void TestFRFour(int &, int &, int &, int &)
Definition: callback-test-suite.cc:632
gMakeBoundCallbackTest3a
static bool * gMakeBoundCallbackTest3a
Definition: callback-test-suite.cc:337
MakeBoundCallbackTarget3
int MakeBoundCallbackTarget3(bool *a, int b)
Definition: callback-test-suite.cc:371
MakeCallbackTemplatesTestCase::m_test1
bool m_test1
Definition: callback-test-suite.cc:617
MakeBoundCallbackTarget9
int MakeBoundCallbackTarget9(int a, int b, int c, int d)
Definition: callback-test-suite.cc:420
gMakeBoundCallbackTest7b
static int gMakeBoundCallbackTest7b
Definition: callback-test-suite.cc:348
MakeCallbackTestCase::MakeCallbackTestCase
MakeCallbackTestCase()
Definition: callback-test-suite.cc:238
BasicCallbackTestCase::m_test3
bool m_test3
Definition: callback-test-suite.cc:64
MakeCallbackTestCase::~MakeCallbackTestCase
virtual ~MakeCallbackTestCase()
Definition: callback-test-suite.cc:180
MakeCallbackTestCase::Target2
int Target2(void)
Definition: callback-test-suite.cc:187
BasicCallbackTarget5
void BasicCallbackTarget5(void)
Definition: callback-test-suite.cc:73
BasicCallbackTestCase::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: callback-test-suite.cc:108
NullifyCallbackTestCase::~NullifyCallbackTestCase
virtual ~NullifyCallbackTestCase()
Definition: callback-test-suite.cc:555
NullifyCallbackTestCase::m_test1
bool m_test1
Definition: callback-test-suite.cc:567
MakeCallbackTestCase::m_test4
bool m_test4
Definition: callback-test-suite.cc:212
MakeBoundCallbackTestCase::~MakeBoundCallbackTestCase
virtual ~MakeBoundCallbackTestCase()
Definition: callback-test-suite.cc:327
CallbackTestClass::CheckParentalRights
void CheckParentalRights(void)
Definition: callback-test-suite.cc:674
TestFSix
void TestFSix(int, int, int, int, int, int)
Definition: callback-test-suite.cc:627
TestFThree
void TestFThree(int, int, int)
Definition: callback-test-suite.cc:624
MakeBoundCallbackTarget4
void MakeBoundCallbackTarget4(int a, int b)
Definition: callback-test-suite.cc:379
BasicCallbackTestCase::~BasicCallbackTestCase
virtual ~BasicCallbackTestCase()
Definition: callback-test-suite.cc:33
gMakeCallbackTest6
static bool gMakeCallbackTest6
Definition: callback-test-suite.cc:216
NullifyCallbackTestCase
Definition: callback-test-suite.cc:552
gBasicCallbackTest6
static bool gBasicCallbackTest6
Definition: callback-test-suite.cc:69
MakeBoundCallbackTarget7
void MakeBoundCallbackTarget7(int a, int b, int c)
Definition: callback-test-suite.cc:403
MakeCallbackTestCase::Target4
int Target4(double a, int b)
Definition: callback-test-suite.cc:197
NullifyCallbackTestCase::Target1
void Target1(void)
Definition: callback-test-suite.cc:558
TestFZero
void TestFZero(void)
Definition: callback-test-suite.cc:621
BasicCallbackTestCase
Definition: callback-test-suite.cc:30
MakeCallbackTarget6
void MakeCallbackTarget6(int)
Definition: callback-test-suite.cc:226
ns3::TestCase
encapsulates test code
Definition: test.h:1154
CallbackTestClass::TestCTwo
void TestCTwo(int, int) const
Definition: callback-test-suite.cc:667
CallbackTestParent
Definition: callback-test-suite.cc:638
NullifyCallbackTestCase::DoSetup
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
Definition: callback-test-suite.cc:575
BasicCallbackTestCase::Target1
void Target1(void)
Definition: callback-test-suite.cc:36
gMakeBoundCallbackTest6c
static int gMakeBoundCallbackTest6c
Definition: callback-test-suite.cc:346
CallbackTestClass
Definition: callback-test-suite.cc:655
MakeCallbackTemplatesTestCase::MakeCallbackTemplatesTestCase
MakeCallbackTemplatesTestCase()
Definition: callback-test-suite.cc:687
MakeBoundCallbackTestCase::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: callback-test-suite.cc:461
MakeCallbackTarget7
int MakeCallbackTarget7(int a)
Definition: callback-test-suite.cc:232
BasicCallbackTarget7
int BasicCallbackTarget7(int a)
Definition: callback-test-suite.cc:85
CallbackTestClass::TestFive
void TestFive(int, int, int, int, int)
Definition: callback-test-suite.cc:663
TestFTwo
void TestFTwo(int, int)
Definition: callback-test-suite.cc:623
gMakeCallbackTest5
static bool gMakeCallbackTest5
Definition: callback-test-suite.cc:215
CallbackTestClass::TestSix
void TestSix(int, int, int, int, int, int)
Definition: callback-test-suite.cc:664
MakeCallbackTestCase::Target3
void Target3(double a)
Definition: callback-test-suite.cc:192
CallbackTestClass::TestCSix
void TestCSix(int, int, int, int, int, int) const
Definition: callback-test-suite.cc:671
BasicCallbackTestCase::m_test2
bool m_test2
Definition: callback-test-suite.cc:63
gMakeBoundCallbackTest3b
static int gMakeBoundCallbackTest3b
Definition: callback-test-suite.cc:338
NS_UNUSED
#define NS_UNUSED(x)
Mark a local variable as unused.
Definition: unused.h:36
MakeCallbackTestCase::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: callback-test-suite.cc:255
MakeBoundCallbackTestCase
Definition: callback-test-suite.cc:324
CallbackTestClass::TestOne
void TestOne(int)
Definition: callback-test-suite.cc:659
MakeCallbackTemplatesTestCase
Definition: callback-test-suite.cc:603
gMakeBoundCallbackTest5b
static int gMakeBoundCallbackTest5b
Definition: callback-test-suite.cc:342
BasicCallbackTestCase::m_test1
bool m_test1
Definition: callback-test-suite.cc:62
CallbackTestClass::TestCZero
void TestCZero(void) const
Definition: callback-test-suite.cc:665
gMakeBoundCallbackTest5a
static int gMakeBoundCallbackTest5a
Definition: callback-test-suite.cc:341
gMakeBoundCallbackTest6b
static int gMakeBoundCallbackTest6b
Definition: callback-test-suite.cc:345
MakeCallbackTestCase::DoSetup
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
Definition: callback-test-suite.cc:243
gMakeBoundCallbackTest8c
static int gMakeBoundCallbackTest8c
Definition: callback-test-suite.cc:352
MakeBoundCallbackTarget1
void MakeBoundCallbackTarget1(int a)
Definition: callback-test-suite.cc:359
TestFRTwo
void TestFRTwo(int &, int &)
Definition: callback-test-suite.cc:630
MakeCallbackTemplatesTestCase::~MakeCallbackTemplatesTestCase
virtual ~MakeCallbackTemplatesTestCase()
Definition: callback-test-suite.cc:606
gMakeBoundCallbackTest9c
static int gMakeBoundCallbackTest9c
Definition: callback-test-suite.cc:355
gMakeBoundCallbackTest9d
static int gMakeBoundCallbackTest9d
Definition: callback-test-suite.cc:356
ns3::MakeCallback
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:1642
NullifyCallbackTestCase::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: callback-test-suite.cc:581
ns3::TestSuite
A suite of tests to run.
Definition: test.h:1344
NS_TEST_ASSERT_MSG_EQ
#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:166
gBasicCallbackTest7
static bool gBasicCallbackTest7
Definition: callback-test-suite.cc:70
BasicCallbackTestCase::DoSetup
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
Definition: callback-test-suite.cc:96
MakeCallbackTemplatesTestCase::Target1
void Target1(void)
Definition: callback-test-suite.cc:609
MakeCallbackTestCase::m_test2
bool m_test2
Definition: callback-test-suite.cc:210
gMakeBoundCallbackTest8a
static int gMakeBoundCallbackTest8a
Definition: callback-test-suite.cc:350
MakeBoundCallbackTarget5
int MakeBoundCallbackTarget5(int a, int b)
Definition: callback-test-suite.cc:386
gMakeBoundCallbackTest1
static int gMakeBoundCallbackTest1
Definition: callback-test-suite.cc:335
gMakeBoundCallbackTest8b
static int gMakeBoundCallbackTest8b
Definition: callback-test-suite.cc:351
ns3::MakeBoundCallback
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1703
gMakeBoundCallbackTest9a
static int gMakeBoundCallbackTest9a
Definition: callback-test-suite.cc:353
TestFFive
void TestFFive(int, int, int, int, int)
Definition: callback-test-suite.cc:626
gMakeBoundCallbackTest9b
static int gMakeBoundCallbackTest9b
Definition: callback-test-suite.cc:354
MakeBoundCallbackTarget8
int MakeBoundCallbackTarget8(int a, int b, int c)
Definition: callback-test-suite.cc:411
gMakeBoundCallbackTest2
static bool * gMakeBoundCallbackTest2
Definition: callback-test-suite.cc:336
MakeCallbackTestCase::Target1
void Target1(void)
Definition: callback-test-suite.cc:183
gMakeBoundCallbackTest7c
static int gMakeBoundCallbackTest7c
Definition: callback-test-suite.cc:349
CallbackTestClass::TestCOne
void TestCOne(int) const
Definition: callback-test-suite.cc:666
MakeBoundCallbackTarget2
void MakeBoundCallbackTarget2(bool *a)
Definition: callback-test-suite.cc:365
gBasicCallbackTest5
static bool gBasicCallbackTest5
Definition: callback-test-suite.cc:68
CallbackTestClass::TestCFour
void TestCFour(int, int, int, int) const
Definition: callback-test-suite.cc:669
BasicCallbackTestCase::m_test4
bool m_test4
Definition: callback-test-suite.cc:65
BasicCallbackTestCase::BasicCallbackTestCase
BasicCallbackTestCase()
Definition: callback-test-suite.cc:91
MakeCallbackTemplatesTestCase::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: callback-test-suite.cc:692
CallbackTestParent::ProtectedParent
void ProtectedParent(void)
Definition: callback-test-suite.cc:644
MakeBoundCallbackTarget6
int MakeBoundCallbackTarget6(int a, int b, int c)
Definition: callback-test-suite.cc:394
MakeBoundCallbackTestCase::MakeBoundCallbackTestCase
MakeBoundCallbackTestCase()
Definition: callback-test-suite.cc:429
CallbackTestSuite
static CallbackTestSuite CallbackTestSuite
Definition: callback-test-suite.cc:761
BasicCallbackTestCase::Target3
void Target3(double a)
Definition: callback-test-suite.cc:45
TestFROne
void TestFROne(int &)
Definition: callback-test-suite.cc:629
CallbackTestClass::TestTwo
void TestTwo(int, int)
Definition: callback-test-suite.cc:660
TestFFour
void TestFFour(int, int, int, int)
Definition: callback-test-suite.cc:625
BasicCallbackTestCase::Target2
int Target2(void)
Definition: callback-test-suite.cc:40
CallbackTestSuite::CallbackTestSuite
CallbackTestSuite()
Definition: callback-test-suite.cc:751
gMakeBoundCallbackTest5c
static int gMakeBoundCallbackTest5c
Definition: callback-test-suite.cc:343
CallbackTestClass::TestFour
void TestFour(int, int, int, int)
Definition: callback-test-suite.cc:662
TestFRThree
void TestFRThree(int &, int &, int &)
Definition: callback-test-suite.cc:631
NullifyCallbackTestCase::NullifyCallbackTestCase
NullifyCallbackTestCase()
Definition: callback-test-suite.cc:570
CallbackTestClass::TestZero
void TestZero(void)
Definition: callback-test-suite.cc:658
ns3::Callback::Nullify
void Nullify(void)
Discard the implementation, set it to null.
Definition: callback.h:1391
CallbackTestParent::PublicParent
void PublicParent(void)
Definition: callback-test-suite.cc:640
MakeCallbackTestCase::m_test1
bool m_test1
Definition: callback-test-suite.cc:209