LEFT | RIGHT |
(no file at all) | |
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) 2005,2006 INRIA | 3 * Copyright (c) 2005,2006 INRIA |
4 * Copyright (c) 2007 Emmanuelle Laprise | 4 * Copyright (c) 2007 Emmanuelle Laprise |
5 * | 5 * |
6 * This program is free software; you can redistribute it and/or modify | 6 * This program is free software; you can redistribute it and/or modify |
7 * it under the terms of the GNU General Public License version 2 as | 7 * it under the terms of the GNU General Public License version 2 as |
8 * published by the Free Software Foundation; | 8 * published by the Free Software Foundation; |
9 * | 9 * |
10 * This program is distributed in the hope that it will be useful, | 10 * This program is distributed in the hope that it will be useful, |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include <iostream> | 24 #include <iostream> |
25 #include <string> | 25 #include <string> |
26 #include <sstream> | 26 #include <sstream> |
27 | 27 |
28 #include "ns3/nstime.h" | 28 #include "ns3/nstime.h" |
29 #include "ns3/int64x64.h" | 29 #include "ns3/int64x64.h" |
30 #include "ns3/test.h" | 30 #include "ns3/test.h" |
31 | 31 |
32 using namespace ns3; | 32 using namespace ns3; |
33 | 33 |
| 34 /** |
| 35 * \ingroup core-test |
| 36 * \ingroup tests |
| 37 * |
| 38 * \brief Basic time test |
| 39 */ |
34 class TimeSimpleTestCase : public TestCase | 40 class TimeSimpleTestCase : public TestCase |
35 { | 41 { |
36 public: | 42 public: |
37 TimeSimpleTestCase (); | 43 TimeSimpleTestCase (); |
38 private: | 44 private: |
39 virtual void DoSetup (void); | 45 virtual void DoSetup (void); |
40 virtual void DoRun (void); | 46 virtual void DoRun (void); |
41 virtual void DoTeardown (void); | 47 virtual void DoTeardown (void); |
42 }; | 48 }; |
43 | 49 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 int64_t tenKValue = ten.GetInteger (); | 101 int64_t tenKValue = ten.GetInteger (); |
96 NS_TEST_ASSERT_MSG_EQ (tenValue * 1000, tenKValue, | 102 NS_TEST_ASSERT_MSG_EQ (tenValue * 1000, tenKValue, |
97 "change resolution to PS"); | 103 "change resolution to PS"); |
98 } | 104 } |
99 | 105 |
100 void· | 106 void· |
101 TimeSimpleTestCase::DoTeardown (void) | 107 TimeSimpleTestCase::DoTeardown (void) |
102 { | 108 { |
103 } | 109 } |
104 | 110 |
| 111 /** |
| 112 * \ingroup core-test |
| 113 * \ingroup tests |
| 114 * |
| 115 * \brief Time with sign test |
| 116 */ |
105 class TimeWithSignTestCase : public TestCase | 117 class TimeWithSignTestCase : public TestCase |
106 { | 118 { |
107 public: | 119 public: |
108 TimeWithSignTestCase (); | 120 TimeWithSignTestCase (); |
109 private: | 121 private: |
110 virtual void DoSetup (void); | 122 virtual void DoSetup (void); |
111 virtual void DoRun (void); | 123 virtual void DoRun (void); |
112 virtual void DoTeardown (void); | 124 virtual void DoTeardown (void); |
113 }; | 125 }; |
114 | 126 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 1.0e-8, | 163 1.0e-8, |
152 "Negative time with units not parsed correctly."); | 164 "Negative time with units not parsed correctly."); |
153 } | 165 } |
154 | 166 |
155 void· | 167 void· |
156 TimeWithSignTestCase::DoTeardown (void) | 168 TimeWithSignTestCase::DoTeardown (void) |
157 { | 169 { |
158 } | 170 } |
159 | 171 |
160 | 172 |
| 173 /** |
| 174 * \ingroup core-test |
| 175 * \ingroup tests |
| 176 * |
| 177 * \brief Time input / output test |
| 178 */ |
161 class TimeInputOutputTestCase : public TestCase | 179 class TimeInputOutputTestCase : public TestCase |
162 { | 180 { |
163 public: | 181 public: |
164 TimeInputOutputTestCase (); | 182 TimeInputOutputTestCase (); |
165 private: | 183 private: |
166 virtual void DoRun (void); | 184 virtual void DoRun (void); |
| 185 /** |
| 186 * Check test function |
| 187 * \param str the reference string |
| 188 */ |
167 void Check (const std::string & str); | 189 void Check (const std::string & str); |
168 }; | 190 }; |
169 | 191 |
170 TimeInputOutputTestCase::TimeInputOutputTestCase () | 192 TimeInputOutputTestCase::TimeInputOutputTestCase () |
171 : TestCase ("Input,output from,to strings") | 193 : TestCase ("Input,output from,to strings") |
172 { | 194 { |
173 } | 195 } |
174 | 196 |
175 void | 197 void |
176 TimeInputOutputTestCase::Check (const std::string & str) | 198 TimeInputOutputTestCase::Check (const std::string & str) |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 << "example: in ms: " << t.As (Time::MS) | 245 << "example: in ms: " << t.As (Time::MS) |
224 << std::endl; | 246 << std::endl; |
225 | 247 |
226 std::cout << GetParent ()->GetName () << " InputOutput: " | 248 std::cout << GetParent ()->GetName () << " InputOutput: " |
227 << "example: Get ns: " << t.GetNanoSeconds () | 249 << "example: Get ns: " << t.GetNanoSeconds () |
228 << std::endl; | 250 << std::endl; |
229 | 251 |
230 std::cout << std::endl; | 252 std::cout << std::endl; |
231 } | 253 } |
232 ···· | 254 ···· |
| 255 /** |
| 256 * \ingroup core-test |
| 257 * \ingroup tests |
| 258 * |
| 259 * \brief Time test suite |
| 260 */ |
233 static class TimeTestSuite : public TestSuite | 261 static class TimeTestSuite : public TestSuite |
234 { | 262 { |
235 public: | 263 public: |
236 TimeTestSuite () | 264 TimeTestSuite () |
237 : TestSuite ("time", UNIT) | 265 : TestSuite ("time", UNIT) |
238 { | 266 { |
239 AddTestCase (new TimeWithSignTestCase (), TestCase::QUICK); | 267 AddTestCase (new TimeWithSignTestCase (), TestCase::QUICK); |
240 AddTestCase (new TimeInputOutputTestCase (), TestCase::QUICK); | 268 AddTestCase (new TimeInputOutputTestCase (), TestCase::QUICK); |
241 // This should be last, since it changes the resolution | 269 // This should be last, since it changes the resolution |
242 AddTestCase (new TimeSimpleTestCase (), TestCase::QUICK); | 270 AddTestCase (new TimeSimpleTestCase (), TestCase::QUICK); |
243 } | 271 } |
244 } g_timeTestSuite; | 272 } g_timeTestSuite; ///< the test suite |
245 | |
246 | |
LEFT | RIGHT |