20 #include "ns3/callback.h"
78 int Target4 ([[maybe_unused]]
double a, [[maybe_unused]]
int b)
85 virtual void DoRun (
void);
86 virtual void DoSetup (
void);
134 :
TestCase (
"Check basic Callback mechansim")
257 int Target4 ([[maybe_unused]]
double a, [[maybe_unused]]
int b)
264 virtual void DoRun (
void);
313 :
TestCase (
"Check MakeCallback() mechanism")
407 virtual void DoRun (
void);
566 :
TestCase (
"Check MakeBoundCallback() mechanism")
633 int result = target3 (2468);
647 int resultTwoA = target5 ();
653 int resultTwoB = target6 (6789);
669 int resultThreeA = target8 ();
676 int resultThreeB = target9 (5678);
705 virtual void DoRun (
void);
712 :
TestCase (
"Check Nullify() and IsNull()")
761 virtual void DoRun (
void);
784 void TestFRSix (
int &,
int &,
int &,
int &,
int &,
int &) {}
835 void TestSix (
int,
int,
int,
int,
int,
int) {}
842 void TestCSix (
int,
int,
int,
int,
int,
int)
const {}
867 :
TestCase (
"Check various MakeCallback() template functions")
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.
int Target4([[maybe_unused]] double a, [[maybe_unused]] int b)
Callback 4 target function.
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
void Target3([[maybe_unused]] double a)
Callback 3 target function.
bool m_test4
true if Target4 has been called, false otherwise.
virtual ~BasicCallbackTestCase()
int Target2(void)
Callback 2 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.
Test the MakeBoundCallback mechanism.
MakeBoundCallbackTestCase()
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~MakeBoundCallbackTestCase()
Make sure that various MakeCallback template functions compile and execute; doesn't check an results ...
MakeCallbackTemplatesTestCase()
bool m_test1
true if Target1 has been called, false otherwise.
virtual ~MakeCallbackTemplatesTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Target1(void)
Callback 1 target function.
Test the MakeCallback mechanism.
virtual ~MakeCallbackTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
bool m_test1
true if Target1 has been called, false otherwise.
int Target4([[maybe_unused]] double a, [[maybe_unused]] int b)
Callback 4 target function.
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([[maybe_unused]] 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.
virtual ~NullifyCallbackTestCase()
NullifyCallbackTestCase()
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.
void Nullify(void)
Discard the implementation, set it to null.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
#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.
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...