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 <stdint.h>
22
23using namespace ns3;
24
42{
43public:
46 {}
47
51 void Target1 (void)
52 {
53 m_test1 = true;
54 }
59 int Target2 (void)
60 {
61 m_test2 = true;
62 return 2;
63 }
68 void Target3 ([[maybe_unused]] double a)
69 {
70 m_test3 = true;
71 }
78 int Target4 ([[maybe_unused]] double a, [[maybe_unused]] int b)
79 {
80 m_test4 = true;
81 return 4;
82 }
83
84private:
85 virtual void DoRun (void);
86 virtual void DoSetup (void);
87
88 bool m_test1;
89 bool m_test2;
90 bool m_test3;
91 bool m_test4;
92};
93
106void
108{
109 gBasicCallbackTest5 = true;
110}
111
115void
117{
118 gBasicCallbackTest6 = true;
119}
120
126int
128{
129 gBasicCallbackTest7 = true;
130 return a;
131}
132
134 : TestCase ("Check basic Callback mechansim")
135{}
136
137void
139{
140 m_test1 = false;
141 m_test2 = false;
142 m_test3 = false;
143 m_test4 = false;
144 gBasicCallbackTest5 = false;
145 gBasicCallbackTest6 = false;
146 gBasicCallbackTest7 = false;
147}
148
149void
151{
152 //
153 // Make sure we can declare and compile a Callback pointing to a member
154 // function returning void and execute it.
155 //
157 target1 ();
158 NS_TEST_ASSERT_MSG_EQ (m_test1, true, "Callback did not fire");
159
160 //
161 // Make sure we can declare and compile a Callback pointing to a member
162 // function that returns an int and execute it.
163 //
164 Callback<int> target2;
166 target2 ();
167 NS_TEST_ASSERT_MSG_EQ (m_test2, true, "Callback did not fire");
168
169 //
170 // Make sure we can declare and compile a Callback pointing to a member
171 // function that returns void, takes a double parameter, and execute it.
172 //
174 target3 (0.0);
175 NS_TEST_ASSERT_MSG_EQ (m_test3, true, "Callback did not fire");
176
177 //
178 // Make sure we can declare and compile a Callback pointing to a member
179 // function that returns void, takes two parameters, and execute it.
180 //
182 target4 (0.0, 1);
183 NS_TEST_ASSERT_MSG_EQ (m_test4, true, "Callback did not fire");
184
185 //
186 // Make sure we can declare and compile a Callback pointing to a non-member
187 // function that returns void, and execute it. This is a lower level call
188 // than MakeCallback so we have got to include at least two arguments to make
189 // sure that the constructor is properly disambiguated. If the arguments are
190 // not needed, we just pass in dummy values.
191 //
192 Callback<void> target5 = Callback<void> (&BasicCallbackTarget5, true, true);
193 target5 ();
194 NS_TEST_ASSERT_MSG_EQ (gBasicCallbackTest5, true, "Callback did not fire");
195
196 //
197 // Make sure we can declare and compile a Callback pointing to a non-member
198 // function that returns void, takes one integer argument and execute it.
199 // We also need to provide two dummy arguments to the constructor here.
200 //
202 target6 (1);
203 NS_TEST_ASSERT_MSG_EQ (gBasicCallbackTest6, true, "Callback did not fire");
204
205 //
206 // Make sure we can declare and compile a Callback pointing to a non-member
207 // function that returns int, takes one integer argument and execute it.
208 // We also need to provide two dummy arguments to the constructor here.
209 //
211 target7 (1);
212 NS_TEST_ASSERT_MSG_EQ (gBasicCallbackTest7, true, "Callback did not fire");
213}
214
221{
222public:
225 {}
226
230 void Target1 (void)
231 {
232 m_test1 = true;
233 }
238 int Target2 (void)
239 {
240 m_test2 = true;
241 return 2;
242 }
247 void Target3 ([[maybe_unused]] double a)
248 {
249 m_test3 = true;
250 }
257 int Target4 ([[maybe_unused]] double a, [[maybe_unused]] int b)
258 {
259 m_test4 = true;
260 return 4;
261 }
262
263private:
264 virtual void DoRun (void);
265 virtual void DoSetup (void);
266
267 bool m_test1;
268 bool m_test2;
269 bool m_test3;
270 bool m_test4;
271};
272
285void
287{
288 gMakeCallbackTest5 = true;
289}
290
294void
296{
297 gMakeCallbackTest6 = true;
298}
299
305int
307{
308 gMakeCallbackTest7 = true;
309 return a;
310}
311
313 : TestCase ("Check MakeCallback() mechanism")
314{}
315
316void
318{
319 m_test1 = false;
320 m_test2 = false;
321 m_test3 = false;
322 m_test4 = false;
323 gMakeCallbackTest5 = false;
324 gMakeCallbackTest6 = false;
325 gMakeCallbackTest7 = false;
326}
327
328void
330{
331 //
332 // Make sure we can declare and make a Callback pointing to a member
333 // function returning void and execute it.
334 //
336 target1 ();
337 NS_TEST_ASSERT_MSG_EQ (m_test1, true, "Callback did not fire");
338
339 //
340 // Make sure we can declare and make a Callback pointing to a member
341 // function that returns an int and execute it.
342 //
344 target2 ();
345 NS_TEST_ASSERT_MSG_EQ (m_test2, true, "Callback did not fire");
346
347 //
348 // Make sure we can declare and make a Callback pointing to a member
349 // function that returns void, takes a double parameter, and execute it.
350 //
352 target3 (0.0);
353 NS_TEST_ASSERT_MSG_EQ (m_test3, true, "Callback did not fire");
354
355 //
356 // Make sure we can declare and make a Callback pointing to a member
357 // function that returns void, takes two parameters, and execute it.
358 //
360 target4 (0.0, 1);
361 NS_TEST_ASSERT_MSG_EQ (m_test4, true, "Callback did not fire");
362
363 //
364 // Make sure we can declare and make a Callback pointing to a non-member
365 // function that returns void, and execute it. This uses a higher level call
366 // than in the basic tests so we do not need to include any dummy arguments
367 // here.
368 //
370 target5 ();
371 NS_TEST_ASSERT_MSG_EQ (gMakeCallbackTest5, true, "Callback did not fire");
372
373 //
374 // Make sure we can declare and compile a Callback pointing to a non-member
375 // function that returns void, takes one integer argument and execute it.
376 // This uses a higher level call than in the basic tests so we do not need to
377 // include any dummy arguments here.
378 //
380 target6 (1);
381 NS_TEST_ASSERT_MSG_EQ (gMakeCallbackTest6, true, "Callback did not fire");
382
383 //
384 // Make sure we can declare and compile a Callback pointing to a non-member
385 // function that returns int, takes one integer argument and execute it.
386 // This uses a higher level call than in the basic tests so we do not need to
387 // include any dummy arguments here.
388 //
390 target7 (1);
391 NS_TEST_ASSERT_MSG_EQ (gMakeCallbackTest7, true, "Callback did not fire");
392}
393
400{
401public:
404 {}
405
406private:
407 virtual void DoRun (void);
408 virtual void DoSetup (void);
409};
410
439// Note: doxygen compounds don not work due to params / return variability.
440
445void
447{
449}
450
455void
457{
459}
460
467int
469{
472 return 1234;
473}
474
480void
482{
485}
486
493int
495{
498 return 1234;
499}
500
508int
509MakeBoundCallbackTarget6 (int a, int b, int c)
510{
514 return 1234;
515}
516
523void
524MakeBoundCallbackTarget7 (int a, int b, int c)
525{
529}
530
538int
539MakeBoundCallbackTarget8 (int a, int b, int c)
540{
544 return 1234;
545}
546
555int
556MakeBoundCallbackTarget9 (int a, int b, int c, int d)
557{
562 return 1234;
563}
564
566 : TestCase ("Check MakeBoundCallback() mechanism")
567{}
568
569void
571{
594}
595
596void
598{
599 //
600 // This is slightly tricky to explain. A bound Callback allows us to package
601 // up arguments for use later. The arguments are bound when the callback is
602 // created and the code that fires the Callback does not know they are there.
603 //
604 // Since the callback is *declared* according to the way it will be used, the
605 // arguments are not seen there. However, the target function of the callback
606 // will have the provided arguments present. The MakeBoundCallback template
607 // function is what connects the two together and where you provide the
608 // arguments to be bound.
609 //
610 // Here we declare a Callback that returns a void and takes no parameters.
611 // MakeBoundCallback connects this Callback to a target function that returns
612 // void and takes an integer argument. That integer argument is bound to the
613 // value 1234. When the Callback is fired, no integer argument is provided
614 // directly. The argument is provided by bound Callback mechanism.
615 //
617 target1 ();
618 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest1, 1234, "Callback did not fire or binding not correct");
619
620 //
621 // Make sure we can bind a pointer value (a common use case).
622 //
623 bool a;
625 target2 ();
626 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest2, &a, "Callback did not fire or binding not correct");
627
628 //
629 // Make sure we can mix and match bound and unbound arguments. This callback
630 // returns an integer so we should see that appear.
631 //
633 int result = target3 (2468);
634 NS_TEST_ASSERT_MSG_EQ (result, 1234, "Return value of callback not correct");
635 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest3a, &a, "Callback did not fire or binding not correct");
636 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest3b, 2468, "Callback did not fire or argument not correct");
637
638 //
639 // Test the TwoBound variant
640 //
642 target4 ();
643 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest4a, 3456, "Callback did not fire or binding not correct");
644 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest4b, 5678, "Callback did not fire or binding not correct");
645
647 int resultTwoA = target5 ();
648 NS_TEST_ASSERT_MSG_EQ (resultTwoA, 1234, "Return value of callback not correct");
649 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest5a, 3456, "Callback did not fire or binding not correct");
650 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest5b, 5678, "Callback did not fire or binding not correct");
651
653 int resultTwoB = target6 (6789);
654 NS_TEST_ASSERT_MSG_EQ (resultTwoB, 1234, "Return value of callback not correct");
655 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest6a, 3456, "Callback did not fire or binding not correct");
656 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest6b, 5678, "Callback did not fire or binding not correct");
657 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest6c, 6789, "Callback did not fire or argument not correct");
658
659 //
660 // Test the ThreeBound variant
661 //
662 Callback<void> target7 = MakeBoundCallback (&MakeBoundCallbackTarget7, 2345, 3456, 4567);
663 target7 ();
664 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest7a, 2345, "Callback did not fire or binding not correct");
665 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest7b, 3456, "Callback did not fire or binding not correct");
666 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest7c, 4567, "Callback did not fire or binding not correct");
667
668 Callback<int> target8 = MakeBoundCallback (&MakeBoundCallbackTarget8, 2345, 3456, 4567);
669 int resultThreeA = target8 ();
670 NS_TEST_ASSERT_MSG_EQ (resultThreeA, 1234, "Return value of callback not correct");
671 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest8a, 2345, "Callback did not fire or binding not correct");
672 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest8b, 3456, "Callback did not fire or binding not correct");
673 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest8c, 4567, "Callback did not fire or binding not correct");
674
676 int resultThreeB = target9 (5678);
677 NS_TEST_ASSERT_MSG_EQ (resultThreeB, 1234, "Return value of callback not correct");
678 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest9a, 2345, "Callback did not fire or binding not correct");
679 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest9b, 3456, "Callback did not fire or binding not correct");
680 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest9c, 4567, "Callback did not fire or binding not correct");
681 NS_TEST_ASSERT_MSG_EQ (gMakeBoundCallbackTest9d, 5678, "Callback did not fire or binding not correct");
682}
683
690{
691public:
694 {}
695
699 void Target1 (void)
700 {
701 m_test1 = true;
702 }
703
704private:
705 virtual void DoRun (void);
706 virtual void DoSetup (void);
707
708 bool m_test1;
709};
710
712 : TestCase ("Check Nullify() and IsNull()")
713{}
714
715void
717{
718 m_test1 = false;
719}
720
721void
723{
724 //
725 // Make sure we can declare and make a Callback pointing to a member
726 // function returning void and execute it.
727 //
729 target1 ();
730 NS_TEST_ASSERT_MSG_EQ (m_test1, true, "Callback did not fire");
731
732 NS_TEST_ASSERT_MSG_EQ (target1.IsNull (), false, "Working Callback reports IsNull()");
733
734 target1.Nullify ();
735
736 NS_TEST_ASSERT_MSG_EQ (target1.IsNull (), true, "Nullified Callback reports not IsNull()");
737}
738
746{
747public:
750 {}
751
755 void Target1 (void)
756 {
757 m_test1 = true;
758 }
759
760private:
761 virtual void DoRun (void);
762
763 bool m_test1;
764};
765
766/* *NS_CHECK_STYLE_OFF* */
771void TestFZero (void) {}
772void TestFOne (int) {}
773void TestFTwo (int, int) {}
774void TestFThree (int, int, int) {}
775void TestFFour (int, int, int, int) {}
776void TestFFive (int, int, int, int, int) {}
777void TestFSix (int, int, int, int, int, int) {}
778
779void TestFROne (int &) {}
780void TestFRTwo (int &, int &) {}
781void TestFRThree (int &, int &, int &) {}
782void TestFRFour (int &, int &, int &, int &) {}
783void TestFRFive (int &, int &, int &, int &, int &) {}
784void TestFRSix (int &, int &, int &, int &, int &, int &) {}
786/* *NS_CHECK_STYLE_ON* */
787
795{
796public:
798 void PublicParent (void)
799 {}
800
801protected:
803 void ProtectedParent (void)
804 {}
806 static void StaticProtectedParent (void)
807 {}
808
809private:
811 void PrivateParent (void)
812 {}
813};
814
822{
823public:
824 /* *NS_CHECK_STYLE_OFF* */
829 void TestZero (void) {}
830 void TestOne (int) {}
831 void TestTwo (int, int) {}
832 void TestThree (int, int, int) {}
833 void TestFour (int, int, int, int) {}
834 void TestFive (int, int, int, int, int) {}
835 void TestSix (int, int, int, int, int, int) {}
836 void TestCZero (void) const {}
837 void TestCOne (int) const {}
838 void TestCTwo (int, int) const {}
839 void TestCThree (int, int, int) const {}
840 void TestCFour (int, int, int, int) const {}
841 void TestCFive (int, int, int, int, int) const {}
842 void TestCSix (int, int, int, int, int, int) const {}
844 /* *NS_CHECK_STYLE_ON* */
845
851 {
855 // as expected, fails.
856 // MakeCallback (&CallbackTestParent::PrivateParent, this);
857 // as expected, fails.
858 // Pointers do not carry the access restriction info, so it is forbidden
859 // to generate a pointer to a parent's protected function, because
860 // this could lead to un-protect them, e.g., by making it public.
861 // MakeCallback (&CallbackTestParent::ProtectedParent, this);
862 }
863
864};
865
867 : TestCase ("Check various MakeCallback() template functions")
868{}
869
870void
872{
874
882
890
898
905
911
917
918 that.CheckParentalRights ();
919}
920
927{
928public:
930};
931
933 : TestSuite ("callback", UNIT)
934{
935 AddTestCase (new BasicCallbackTestCase, TestCase::QUICK);
936 AddTestCase (new MakeCallbackTestCase, TestCase::QUICK);
937 AddTestCase (new MakeBoundCallbackTestCase, TestCase::QUICK);
938 AddTestCase (new NullifyCallbackTestCase, TestCase::QUICK);
939 AddTestCase (new MakeCallbackTemplatesTestCase, TestCase::QUICK);
940}
941
void TestFZero(void)
Test function - does nothing.
static bool gBasicCallbackTest7
Variable to verify that a calback has been called.
static int gMakeBoundCallbackTest5a
Variable to verify that a calback has been called.
static int gMakeBoundCallbackTest7c
Variable to verify that a calback has been called.
int MakeBoundCallbackTarget5(int a, int b)
MakeBoundCallback 5 target function.
static bool * gMakeBoundCallbackTest2
Variable to verify that a calback has been called.
static int gMakeBoundCallbackTest6b
Variable to verify that a calback has been called.
void TestFSix(int, int, int, int, int, int)
Test function - does nothing.
int MakeCallbackTarget7(int a)
MakeCallback 7 target function.
static int gMakeBoundCallbackTest7b
Variable to verify that a calback has been called.
static int gMakeBoundCallbackTest9a
Variable to verify that a calback has been called.
static CallbackTestSuite g_gallbackTestSuite
Static variable for test initialization.
int MakeBoundCallbackTarget8(int a, int b, int c)
MakeBoundCallback 8 target function.
static bool gMakeCallbackTest5
Variable to verify that a calback has been called.
static int gMakeBoundCallbackTest1
Variable to verify that a calback has been called.
static bool gBasicCallbackTest5
Variable to verify that a calback has been called.
static bool * gMakeBoundCallbackTest3a
Variable to verify that a calback has been called.
static int gMakeBoundCallbackTest6c
Variable to verify that a calback has been called.
static int gMakeBoundCallbackTest9b
Variable to verify that a calback has been called.
int BasicCallbackTarget7(int a)
Callback 6 target function.
void MakeBoundCallbackTarget2(bool *a)
MakeBoundCallback 2 target function.
void MakeBoundCallbackTarget7(int a, int b, int c)
MakeBoundCallback 7 target function.
static int gMakeBoundCallbackTest7a
Variable to verify that a calback has been called.
void BasicCallbackTarget6(int)
Callback 6 target function.
void TestFROne(int &)
Test function - does nothing.
void TestFRTwo(int &, int &)
Test function - does nothing.
static int gMakeBoundCallbackTest4b
Variable to verify that a calback has been called.
static int gMakeBoundCallbackTest5b
Variable to verify that a calback has been called.
int MakeBoundCallbackTarget6(int a, int b, int c)
MakeBoundCallback 5 target function.
static int gMakeBoundCallbackTest6a
Variable to verify that a calback has been called.
static int gMakeBoundCallbackTest5c
Variable to verify that a calback has been called.
void TestFFive(int, int, int, int, int)
Test function - does nothing.
static bool gMakeCallbackTest7
Variable to verify that a calback has been called.
int MakeBoundCallbackTarget3(bool *a, int b)
MakeBoundCallback 3 target function.
void MakeBoundCallbackTarget4(int a, int b)
MakeBoundCallback 4 target function.
static int gMakeBoundCallbackTest3b
Variable to verify that a calback has been called.
void TestFRFive(int &, int &, int &, int &, int &)
Test function - does nothing.
void TestFFour(int, int, int, int)
Test function - does nothing.
void TestFRThree(int &, int &, int &)
Test function - does nothing.
static int gMakeBoundCallbackTest8b
Variable to verify that a calback has been called.
void TestFOne(int)
Test function - does nothing.
int MakeBoundCallbackTarget9(int a, int b, int c, int d)
MakeBoundCallback 5 target function.
void TestFThree(int, int, int)
Test function - does nothing.
void TestFTwo(int, int)
Test function - does nothing.
static int gMakeBoundCallbackTest9d
Variable to verify that a calback has been called.
void BasicCallbackTarget5(void)
Callback 5 target function.
void MakeCallbackTarget5(void)
MakeCallback 5 target function.
static int gMakeBoundCallbackTest4a
Variable to verify that a calback has been called.
static bool gMakeCallbackTest6
Variable to verify that a calback has been called.
void TestFRSix(int &, int &, int &, int &, int &, int &)
Test function - does nothing.
void TestFRFour(int &, int &, int &, int &)
Test function - does nothing.
static int gMakeBoundCallbackTest8c
Variable to verify that a calback has been called.
void MakeCallbackTarget6(int)
MakeCallback 6 target function.
void MakeBoundCallbackTarget1(int a)
MakeBoundCallback 1 target function.
static int gMakeBoundCallbackTest9c
Variable to verify that a calback has been called.
static int gMakeBoundCallbackTest8a
Variable to verify that a calback has been called.
static bool gBasicCallbackTest6
Variable to verify that a calback has been called.
Test the basic Callback mechanism.
bool m_test2
true if Target2 has been called, false otherwise.
bool m_test3
true if Target3 has been called, false otherwise.
void Target1(void)
Callback 1 target function.
bool m_test1
true if Target1 has been called, false otherwise.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
void Target3(double a)
Callback 3 target function.
bool m_test4
true if Target4 has been called, false otherwise.
int Target2(void)
Callback 2 target function.
int Target4(double a, int b)
Callback 4 target function.
Derived class used to check the capability of callbacks to call public, protected,...
void TestSix(int, int, int, int, int, int)
Test function - does nothing.
void TestCThree(int, int, int) const
Test function - does nothing.
void TestZero(void)
Test function - does nothing.
void CheckParentalRights(void)
Tries to make a callback to public and protected functions of a class.
void TestCSix(int, int, int, int, int, int) const
Test function - does nothing.
void TestOne(int)
Test function - does nothing.
void TestCZero(void) const
Test function - does nothing.
void TestThree(int, int, int)
Test function - does nothing.
void TestCFour(int, int, int, int) const
Test function - does nothing.
void TestCOne(int) const
Test function - does nothing.
void TestCFive(int, int, int, int, int) const
Test function - does nothing.
void TestFour(int, int, int, int)
Test function - does nothing.
void TestCTwo(int, int) const
Test function - does nothing.
void TestFive(int, int, int, int, int)
Test function - does nothing.
void TestTwo(int, int)
Test function - does nothing.
Class used to check the capability of callbacks to call public, protected, and private functions.
static void StaticProtectedParent(void)
A static protected function.
void PublicParent(void)
A public function.
void ProtectedParent(void)
A protected function.
void PrivateParent(void)
A private function.
The callback Test Suite.
Test the MakeBoundCallback mechanism.
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Make sure that various MakeCallback template functions compile and execute; doesn't check an results ...
bool m_test1
true if Target1 has been called, false otherwise.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Target1(void)
Callback 1 target function.
Test the MakeCallback mechanism.
int Target4(double a, int b)
Callback 4 target function.
virtual void DoRun(void)
Implementation to actually run this TestCase.
bool m_test1
true if Target1 has been called, false otherwise.
int Target2(void)
Callback 2 target function.
void Target1(void)
Callback 1 target function.
bool m_test2
true if Target2 has been called, false otherwise.
bool m_test4
true if Target4 has been called, false otherwise.
void Target3(double a)
Callback 3 target function.
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
bool m_test3
true if Target3 has been called, false otherwise.
Test the Nullify mechanism.
bool m_test1
true if Target1 has been called, false otherwise.
void Target1(void)
Callback 1 target function.
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1386
void Nullify(void)
Discard the implementation, set it to null.
Definition: callback.h:1391
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
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1709
#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
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