OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2009 University of Washington | 3 * Copyright (c) 2009 University of Washington |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 */ | 17 */ |
18 | 18 |
19 #include "ns3/test.h" | 19 #include "ns3/test.h" |
20 #include "ns3/traced-callback.h" | 20 #include "ns3/traced-callback.h" |
21 | 21 |
22 using namespace ns3; | 22 using namespace ns3; |
23 | 23 |
| 24 /** |
| 25 * \ingroup core-test |
| 26 * \ingroup tests |
| 27 * |
| 28 * \brief Basic traced callback test |
| 29 */ |
24 class BasicTracedCallbackTestCase : public TestCase | 30 class BasicTracedCallbackTestCase : public TestCase |
25 { | 31 { |
26 public: | 32 public: |
27 BasicTracedCallbackTestCase (); | 33 BasicTracedCallbackTestCase (); |
28 virtual ~BasicTracedCallbackTestCase () {} | 34 virtual ~BasicTracedCallbackTestCase () {} |
29 | 35 |
30 private: | 36 private: |
31 virtual void DoRun (void); | 37 virtual void DoRun (void); |
32 | 38 |
| 39 /** |
| 40 * First callback test function |
| 41 * \param a int parameter |
| 42 * \param b double parameter |
| 43 */ |
33 void CbOne (uint8_t a, double b); | 44 void CbOne (uint8_t a, double b); |
| 45 /** |
| 46 * Second callback test function |
| 47 * \param a int parameter |
| 48 * \param b double parameter |
| 49 */ |
34 void CbTwo (uint8_t a, double b); | 50 void CbTwo (uint8_t a, double b); |
35 | 51 |
36 bool m_one; | 52 bool m_one; ///< test variable |
37 bool m_two; | 53 bool m_two; ///< test variable |
38 }; | 54 }; |
39 | 55 |
40 BasicTracedCallbackTestCase::BasicTracedCallbackTestCase () | 56 BasicTracedCallbackTestCase::BasicTracedCallbackTestCase () |
41 : TestCase ("Check basic TracedCallback operation") | 57 : TestCase ("Check basic TracedCallback operation") |
42 { | 58 { |
43 } | 59 } |
44 | 60 |
45 void | 61 void |
46 BasicTracedCallbackTestCase::CbOne (uint8_t a, double b) | 62 BasicTracedCallbackTestCase::CbOne (uint8_t a, double b) |
47 { | 63 { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // | 117 // |
102 trace.ConnectWithoutContext (MakeCallback (&BasicTracedCallbackTestCase::CbOne
, this)); | 118 trace.ConnectWithoutContext (MakeCallback (&BasicTracedCallbackTestCase::CbOne
, this)); |
103 trace.ConnectWithoutContext (MakeCallback (&BasicTracedCallbackTestCase::CbTwo
, this)); | 119 trace.ConnectWithoutContext (MakeCallback (&BasicTracedCallbackTestCase::CbTwo
, this)); |
104 m_one = false; | 120 m_one = false; |
105 m_two = false; | 121 m_two = false; |
106 trace (1, 2); | 122 trace (1, 2); |
107 NS_TEST_ASSERT_MSG_EQ (m_one, true, "Callback CbOne not called"); | 123 NS_TEST_ASSERT_MSG_EQ (m_one, true, "Callback CbOne not called"); |
108 NS_TEST_ASSERT_MSG_EQ (m_two, true, "Callback CbTwo not called"); | 124 NS_TEST_ASSERT_MSG_EQ (m_two, true, "Callback CbTwo not called"); |
109 } | 125 } |
110 | 126 |
| 127 /** |
| 128 * \ingroup core-test |
| 129 * \ingroup tests |
| 130 * |
| 131 * \brief Traced callback test suite |
| 132 */ |
111 class TracedCallbackTestSuite : public TestSuite | 133 class TracedCallbackTestSuite : public TestSuite |
112 { | 134 { |
113 public: | 135 public: |
114 TracedCallbackTestSuite (); | 136 TracedCallbackTestSuite (); |
115 }; | 137 }; |
116 | 138 |
117 TracedCallbackTestSuite::TracedCallbackTestSuite () | 139 TracedCallbackTestSuite::TracedCallbackTestSuite () |
118 : TestSuite ("traced-callback", UNIT) | 140 : TestSuite ("traced-callback", UNIT) |
119 { | 141 { |
120 AddTestCase (new BasicTracedCallbackTestCase, TestCase::QUICK); | 142 AddTestCase (new BasicTracedCallbackTestCase, TestCase::QUICK); |
121 } | 143 } |
122 | 144 |
123 static TracedCallbackTestSuite tracedCallbackTestSuite; | 145 static TracedCallbackTestSuite tracedCallbackTestSuite; |
OLD | NEW |