A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
test-angles.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 CTTC
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Nicola Baldo <nbaldo@cttc.es>
18 */
19
20#include <ns3/antenna-model.h>
21#include <ns3/log.h>
22#include <ns3/test.h>
23
24#include <cmath>
25#include <iostream>
26#include <sstream>
27#include <string>
28
29using namespace ns3;
30
31/**
32 * \ingroup tests
33 *
34 * \brief Angles Test using one vector for initialization
35 */
37{
38 public:
39 /**
40 * Build the test name
41 * \param v test parameter
42 * \return the test name
43 */
44 static std::string BuildNameString(Vector v);
45 /**
46 * Constructor
47 * \param v vector
48 * \param a expected angle
49 */
51
52 private:
53 void DoRun() override;
54
55 Vector m_v; //!< vector
56 Angles m_a; //!< expected angle
57};
58
59std::string
61{
62 std::ostringstream oss;
63 oss << " v = " << v;
64 return oss.str();
65}
66
68 : TestCase(BuildNameString(v)),
69 m_v(v),
70 m_a(a)
71{
72}
73
74void
76{
77 Angles a(m_v);
78 NS_TEST_EXPECT_MSG_EQ_TOL(a.GetAzimuth(), m_a.GetAzimuth(), 1e-10, "incorrect phi");
79 NS_TEST_EXPECT_MSG_EQ_TOL(a.GetInclination(), m_a.GetInclination(), 1e-10, "incorrect theta");
80}
81
82/**
83 * \ingroup tests
84 *
85 * \brief Angles Test using two vectors for initialization
86 */
88{
89 public:
90 /**
91 * Build the test name
92 * \param v test parameter
93 * \param o test parameter
94 * \return the test name
95 */
96 static std::string BuildNameString(Vector v, Vector o);
97 /**
98 * Constructor
99 * \param v point
100 * \param o origin
101 * \param a expected angle
102 */
103 TwoVectorsConstructorTestCase(Vector v, Vector o, Angles a);
104
105 private:
106 void DoRun() override;
107
108 Vector m_v; //!< point
109 Vector m_o; //!< origin
110 Angles m_a; //!< expected angle
111};
112
113std::string
115{
116 std::ostringstream oss;
117 oss << " v = " << v << ", o = " << o;
118 return oss.str();
119}
120
122 : TestCase(BuildNameString(v, o)),
123 m_v(v),
124 m_o(o),
125 m_a(a)
126{
127}
128
129void
131{
132 Angles a(m_v, m_o);
133 NS_TEST_EXPECT_MSG_EQ_TOL(a.GetAzimuth(), m_a.GetAzimuth(), 1e-10, "incorrect phi");
134 NS_TEST_EXPECT_MSG_EQ_TOL(a.GetInclination(), m_a.GetInclination(), 1e-10, "incorrect theta");
135}
136
137using WrapToRangeFunction = std::function<double(double)>;
138
139/**
140 * \ingroup tests
141 *
142 * \brief Test bounds for various WrapTo... methods (WrapTo180, WrapTo360, WrapToPi, and WrapTo2Pi)
143 * by using a std::function wrapper
144 */
146{
147 public:
148 /**
149 * Build the test name
150 * \param lowerBound the lower bound of the WrapTo... function
151 * \param upperBound the upper bound of the WrapTo... function
152 * \return the test name
153 */
154 static std::string BuildNameString(double lowerBound, double upperBound);
155 /**
156 * Constructor
157 * \param wrapper for one of WrapTo180, WrapTo360, WrapToPi, and WrapTo2Pi
158 * \param lowerBound the corresponding lower bound
159 * \param upperBound the corresponding upper bound
160 */
161 WrapToRangeTestCase(WrapToRangeFunction wrapper, double lowerBound, double upperBound);
162
163 protected:
164 /**
165 * The given wrapper shall wrap an angle into the expected range
166 * \param wrapPoint an angle
167 */
168 void CheckWrappingPoint(double wrapPoint);
169
170 private:
171 void DoRun() override;
172
173 WrapToRangeFunction m_wrapper; //!< the wrapper function
174 double m_lowerBound; //!< the corresponding lower bound
175 double m_upperBound; //!< the corresponding upper bound
176};
177
178std::string
179WrapToRangeTestCase::BuildNameString(double lowerBound, double upperBound)
180{
181 std::ostringstream oss;
182 oss << "WrapTo [" << lowerBound << ", " << upperBound << ")";
183 return oss.str();
184}
185
187 double lowerBound,
188 double upperBound)
189 : TestCase(BuildNameString(lowerBound, upperBound)),
190 m_wrapper(wrapper),
191 m_lowerBound(lowerBound),
192 m_upperBound(upperBound)
193{
194}
195
196void
198{
201}
202
203void
205{
206 constexpr int STEP_NUM = 100;
207 double directions[] = {std::numeric_limits<double>::lowest(),
208 std::numeric_limits<double>::max()};
209 for (double dir : directions)
210 {
211 int i = 0;
212 for (double x = wrapPoint; i < STEP_NUM; x = std::nextafter(x, dir), ++i)
213 {
214 // If asserts are enabled, this test will crash with an assert instead of failing
215 double result = m_wrapper(x);
217 true,
218 "Invalid wrap (too low) " << x << " maps to " << result << " and "
219 << result - m_lowerBound);
221 true,
222 "Invalid wrap (too high) " << x << " maps to " << result
223 << " and " << result - m_lowerBound);
224 }
225 }
226}
227
228/**
229 * \ingroup tests
230 *
231 * \brief Test the output for WrapToRangeFunction
232 */
234{
235 public:
236 /**
237 * Build the test name
238 * \param angle the angle
239 * \param wrappedAngle the expected result
240 * \return the test name
241 */
242 static std::string BuildNameString(double angle, double wrappedAngle);
243 /**
244 * Constructor
245 * \param wrapper one WrapToRangeFunction
246 * \param angle the angle
247 * \param wrappedAngle the expected result
248 */
249 WrapToRangeFunctionalTestCase(WrapToRangeFunction wrapper, double angle, double wrappedAngle);
250
251 private:
252 void DoRun() override;
253
254 WrapToRangeFunction m_wrapper; //!< the wrapper function
255 double m_angle; //!< the input angle
256 double m_wrappedAngle; //!< the expected wrapper angle
257};
258
259std::string
260WrapToRangeFunctionalTestCase::BuildNameString(double angle, double wrappedAngle)
261{
262 std::ostringstream oss;
263 oss << "Wrap " << angle << " to " << wrappedAngle;
264 return oss.str();
265}
266
268 double angle,
269 double wrappedAngle)
270 : TestCase(BuildNameString(angle, wrappedAngle)),
271 m_wrapper(wrapper),
272 m_angle(angle),
273 m_wrappedAngle(wrappedAngle)
274{
275}
276
277void
279{
282 1e-6,
283 "Invalid wrap " << m_angle << " wrapped to " << m_wrapper(m_angle)
284 << " instead of " << m_wrappedAngle);
285}
286
287/**
288 * \ingroup tests
289 *
290 * \brief Angles TestSuite
291 */
293{
294 public:
296};
297
299 : TestSuite("angles", Type::UNIT)
300{
301 AddTestCase(new OneVectorConstructorTestCase(Vector(1, 0, 0), Angles(0, M_PI_2)),
302 TestCase::Duration::QUICK);
303 AddTestCase(new OneVectorConstructorTestCase(Vector(-1, 0, 0), Angles(M_PI, M_PI_2)),
304 TestCase::Duration::QUICK);
305 AddTestCase(new OneVectorConstructorTestCase(Vector(0, 1, 0), Angles(M_PI_2, M_PI_2)),
306 TestCase::Duration::QUICK);
307 AddTestCase(new OneVectorConstructorTestCase(Vector(0, -1, 0), Angles(-M_PI_2, M_PI_2)),
308 TestCase::Duration::QUICK);
309 AddTestCase(new OneVectorConstructorTestCase(Vector(0, 0, 1), Angles(0, 0)),
310 TestCase::Duration::QUICK);
311 AddTestCase(new OneVectorConstructorTestCase(Vector(0, 0, -1), Angles(0, M_PI)),
312 TestCase::Duration::QUICK);
313
314 AddTestCase(new OneVectorConstructorTestCase(Vector(2, 0, 0), Angles(0, M_PI_2)),
315 TestCase::Duration::QUICK);
316 AddTestCase(new OneVectorConstructorTestCase(Vector(-2, 0, 0), Angles(M_PI, M_PI_2)),
317 TestCase::Duration::QUICK);
318 AddTestCase(new OneVectorConstructorTestCase(Vector(0, 2, 0), Angles(M_PI_2, M_PI_2)),
319 TestCase::Duration::QUICK);
320 AddTestCase(new OneVectorConstructorTestCase(Vector(0, -2, 0), Angles(-M_PI_2, M_PI_2)),
321 TestCase::Duration::QUICK);
322 AddTestCase(new OneVectorConstructorTestCase(Vector(0, 0, 2), Angles(0, 0)),
323 TestCase::Duration::QUICK);
324 AddTestCase(new OneVectorConstructorTestCase(Vector(0, 0, -2), Angles(0, M_PI)),
325 TestCase::Duration::QUICK);
326
327 AddTestCase(new OneVectorConstructorTestCase(Vector(1, 0, 1), Angles(0, M_PI_4)),
328 TestCase::Duration::QUICK);
329 AddTestCase(new OneVectorConstructorTestCase(Vector(1, 0, -1), Angles(0, 3 * M_PI_4)),
330 TestCase::Duration::QUICK);
331 AddTestCase(new OneVectorConstructorTestCase(Vector(1, 1, 0), Angles(M_PI_4, M_PI_2)),
332 TestCase::Duration::QUICK);
333 AddTestCase(new OneVectorConstructorTestCase(Vector(1, -1, 0), Angles(-M_PI_4, M_PI_2)),
334 TestCase::Duration::QUICK);
335 AddTestCase(new OneVectorConstructorTestCase(Vector(-1, 0, 1), Angles(M_PI, M_PI_4)),
336 TestCase::Duration::QUICK);
337 AddTestCase(new OneVectorConstructorTestCase(Vector(-1, 0, -1), Angles(M_PI, 3 * M_PI_4)),
338 TestCase::Duration::QUICK);
339 AddTestCase(new OneVectorConstructorTestCase(Vector(-1, 1, 0), Angles(3 * M_PI_4, M_PI_2)),
340 TestCase::Duration::QUICK);
341 AddTestCase(new OneVectorConstructorTestCase(Vector(-1, -1, 0), Angles(-3 * M_PI_4, M_PI_2)),
342 TestCase::Duration::QUICK);
343 AddTestCase(new OneVectorConstructorTestCase(Vector(0, 1, 1), Angles(M_PI_2, M_PI_4)),
344 TestCase::Duration::QUICK);
345 AddTestCase(new OneVectorConstructorTestCase(Vector(0, 1, -1), Angles(M_PI_2, 3 * M_PI_4)),
346 TestCase::Duration::QUICK);
347 AddTestCase(new OneVectorConstructorTestCase(Vector(0, -1, 1), Angles(-M_PI_2, M_PI_4)),
348 TestCase::Duration::QUICK);
349 AddTestCase(new OneVectorConstructorTestCase(Vector(0, -1, -1), Angles(-M_PI_2, 3 * M_PI_4)),
350 TestCase::Duration::QUICK);
351
353 new OneVectorConstructorTestCase(Vector(1, 1, std::sqrt(2)), Angles(M_PI_4, M_PI_4)),
354 TestCase::Duration::QUICK);
356 new OneVectorConstructorTestCase(Vector(1, 1, -std::sqrt(2)), Angles(M_PI_4, 3 * M_PI_4)),
357 TestCase::Duration::QUICK);
359 new OneVectorConstructorTestCase(Vector(1, -1, std::sqrt(2)), Angles(-M_PI_4, M_PI_4)),
360 TestCase::Duration::QUICK);
362 new OneVectorConstructorTestCase(Vector(-1, 1, std::sqrt(2)), Angles(3 * M_PI_4, M_PI_4)),
363 TestCase::Duration::QUICK);
364
366 new TwoVectorsConstructorTestCase(Vector(1, 0, 0), Vector(0, 0, 0), Angles(0, M_PI_2)),
367 TestCase::Duration::QUICK);
369 new TwoVectorsConstructorTestCase(Vector(-1, 0, 0), Vector(0, 0, 0), Angles(M_PI, M_PI_2)),
370 TestCase::Duration::QUICK);
372 new TwoVectorsConstructorTestCase(Vector(0, 1, 0), Vector(0, 0, 0), Angles(M_PI_2, M_PI_2)),
373 TestCase::Duration::QUICK);
374 AddTestCase(new TwoVectorsConstructorTestCase(Vector(0, -1, 0),
375 Vector(0, 0, 0),
376 Angles(-M_PI_2, M_PI_2)),
377 TestCase::Duration::QUICK);
378 AddTestCase(new TwoVectorsConstructorTestCase(Vector(0, 0, 1), Vector(0, 0, 0), Angles(0, 0)),
379 TestCase::Duration::QUICK);
381 new TwoVectorsConstructorTestCase(Vector(0, 0, -1), Vector(0, 0, 0), Angles(0, M_PI)),
382 TestCase::Duration::QUICK);
383
385 new TwoVectorsConstructorTestCase(Vector(2, 0, 0), Vector(0, 0, 0), Angles(0, M_PI_2)),
386 TestCase::Duration::QUICK);
388 new TwoVectorsConstructorTestCase(Vector(-2, 0, 0), Vector(0, 0, 0), Angles(M_PI, M_PI_2)),
389 TestCase::Duration::QUICK);
391 new TwoVectorsConstructorTestCase(Vector(0, 2, 0), Vector(0, 0, 0), Angles(M_PI_2, M_PI_2)),
392 TestCase::Duration::QUICK);
393 AddTestCase(new TwoVectorsConstructorTestCase(Vector(0, -2, 0),
394 Vector(0, 0, 0),
395 Angles(-M_PI_2, M_PI_2)),
396 TestCase::Duration::QUICK);
397 AddTestCase(new TwoVectorsConstructorTestCase(Vector(0, 0, 2), Vector(0, 0, 0), Angles(0, 0)),
398 TestCase::Duration::QUICK);
400 new TwoVectorsConstructorTestCase(Vector(0, 0, -2), Vector(0, 0, 0), Angles(0, M_PI)),
401 TestCase::Duration::QUICK);
402
404 new TwoVectorsConstructorTestCase(Vector(1, 0, 1), Vector(0, 0, 0), Angles(0, M_PI_4)),
405 TestCase::Duration::QUICK);
407 new TwoVectorsConstructorTestCase(Vector(1, 0, -1), Vector(0, 0, 0), Angles(0, 3 * M_PI_4)),
408 TestCase::Duration::QUICK);
410 new TwoVectorsConstructorTestCase(Vector(1, 1, 0), Vector(0, 0, 0), Angles(M_PI_4, M_PI_2)),
411 TestCase::Duration::QUICK);
412 AddTestCase(new TwoVectorsConstructorTestCase(Vector(1, -1, 0),
413 Vector(0, 0, 0),
414 Angles(-M_PI_4, M_PI_2)),
415 TestCase::Duration::QUICK);
417 new TwoVectorsConstructorTestCase(Vector(-1, 0, 1), Vector(0, 0, 0), Angles(M_PI, M_PI_4)),
418 TestCase::Duration::QUICK);
419 AddTestCase(new TwoVectorsConstructorTestCase(Vector(-1, 0, -1),
420 Vector(0, 0, 0),
421 Angles(M_PI, 3 * M_PI_4)),
422 TestCase::Duration::QUICK);
423 AddTestCase(new TwoVectorsConstructorTestCase(Vector(-1, 1, 0),
424 Vector(0, 0, 0),
425 Angles(3 * M_PI_4, M_PI_2)),
426 TestCase::Duration::QUICK);
427 AddTestCase(new TwoVectorsConstructorTestCase(Vector(-1, -1, 0),
428 Vector(0, 0, 0),
429 Angles(-3 * M_PI_4, M_PI_2)),
430 TestCase::Duration::QUICK);
432 new TwoVectorsConstructorTestCase(Vector(0, 1, 1), Vector(0, 0, 0), Angles(M_PI_2, M_PI_4)),
433 TestCase::Duration::QUICK);
434 AddTestCase(new TwoVectorsConstructorTestCase(Vector(0, 1, -1),
435 Vector(0, 0, 0),
436 Angles(M_PI_2, 3 * M_PI_4)),
437 TestCase::Duration::QUICK);
438 AddTestCase(new TwoVectorsConstructorTestCase(Vector(0, -1, 1),
439 Vector(0, 0, 0),
440 Angles(-M_PI_2, M_PI_4)),
441 TestCase::Duration::QUICK);
442 AddTestCase(new TwoVectorsConstructorTestCase(Vector(0, -1, -1),
443 Vector(0, 0, 0),
444 Angles(-M_PI_2, 3 * M_PI_4)),
445 TestCase::Duration::QUICK);
446
447 AddTestCase(new TwoVectorsConstructorTestCase(Vector(1, 1, std::sqrt(2)),
448 Vector(0, 0, 0),
449 Angles(M_PI_4, M_PI_4)),
450 TestCase::Duration::QUICK);
451 AddTestCase(new TwoVectorsConstructorTestCase(Vector(1, 1, -std::sqrt(2)),
452 Vector(0, 0, 0),
453 Angles(M_PI_4, 3 * M_PI_4)),
454 TestCase::Duration::QUICK);
455 AddTestCase(new TwoVectorsConstructorTestCase(Vector(1, -1, std::sqrt(2)),
456 Vector(0, 0, 0),
457 Angles(-M_PI_4, M_PI_4)),
458 TestCase::Duration::QUICK);
459 AddTestCase(new TwoVectorsConstructorTestCase(Vector(-1, 1, std::sqrt(2)),
460 Vector(0, 0, 0),
461 Angles(3 * M_PI_4, M_PI_4)),
462 TestCase::Duration::QUICK);
463
465 new TwoVectorsConstructorTestCase(Vector(3, 2, 2), Vector(2, 2, 2), Angles(0, M_PI_2)),
466 TestCase::Duration::QUICK);
468 new TwoVectorsConstructorTestCase(Vector(1, 2, 2), Vector(2, 2, 2), Angles(M_PI, M_PI_2)),
469 TestCase::Duration::QUICK);
471 new TwoVectorsConstructorTestCase(Vector(2, 3, 2), Vector(2, 2, 2), Angles(M_PI_2, M_PI_2)),
472 TestCase::Duration::QUICK);
473 AddTestCase(new TwoVectorsConstructorTestCase(Vector(-1, 2, 2),
474 Vector(-1, 3, 2),
475 Angles(-M_PI_2, M_PI_2)),
476 TestCase::Duration::QUICK);
477 AddTestCase(new TwoVectorsConstructorTestCase(Vector(4, -2, 7), Vector(4, -2, 6), Angles(0, 0)),
478 TestCase::Duration::QUICK);
480 new TwoVectorsConstructorTestCase(Vector(0, -5, -1), Vector(0, -5, 0), Angles(0, M_PI)),
481 TestCase::Duration::QUICK);
482
484 new TwoVectorsConstructorTestCase(Vector(-2, 2, -1), Vector(-4, 2, -1), Angles(0, M_PI_2)),
485 TestCase::Duration::QUICK);
487 new TwoVectorsConstructorTestCase(Vector(2, 2, 0), Vector(4, 2, 0), Angles(M_PI, M_PI_2)),
488 TestCase::Duration::QUICK);
489
491 new TwoVectorsConstructorTestCase(Vector(-1, 4, 4), Vector(-2, 4, 3), Angles(0, M_PI_4)),
492 TestCase::Duration::QUICK);
493 AddTestCase(new TwoVectorsConstructorTestCase(Vector(0, -2, -6),
494 Vector(-1, -2, -5),
495 Angles(0, 3 * M_PI_4)),
496 TestCase::Duration::QUICK);
497 AddTestCase(new TwoVectorsConstructorTestCase(Vector(77, 3, 43),
498 Vector(78, 2, 43),
499 Angles(3 * M_PI_4, M_PI_2)),
500 TestCase::Duration::QUICK);
501
502 AddTestCase(new TwoVectorsConstructorTestCase(Vector(24, -2, -6 - std::sqrt(2)),
503 Vector(23, -3, -6),
504 Angles(M_PI_4, 3 * M_PI_4)),
505 TestCase::Duration::QUICK);
506 AddTestCase(new TwoVectorsConstructorTestCase(Vector(0.5, 11.45, std::sqrt(2) - 1),
507 Vector(-0.5, 12.45, -1),
508 Angles(-M_PI_4, M_PI_4)),
509 TestCase::Duration::QUICK);
510 AddTestCase(new WrapToRangeTestCase(WrapTo180, -180, 180), TestCase::Duration::QUICK);
511 AddTestCase(new WrapToRangeTestCase(WrapToPi, -M_PI, M_PI), TestCase::Duration::QUICK);
512 AddTestCase(new WrapToRangeTestCase(WrapTo360, 0, 360), TestCase::Duration::QUICK);
513 AddTestCase(new WrapToRangeTestCase(WrapTo2Pi, 0, 2 * M_PI), TestCase::Duration::QUICK);
515 TestCase::Duration::QUICK);
517 TestCase::Duration::QUICK);
518 AddTestCase(new WrapToRangeFunctionalTestCase(WrapTo180, 181, -179), TestCase::Duration::QUICK);
520 TestCase::Duration::QUICK);
522 TestCase::Duration::QUICK);
523 AddTestCase(new WrapToRangeFunctionalTestCase(WrapTo360, -179, 181), TestCase::Duration::QUICK);
524 AddTestCase(new WrapToRangeFunctionalTestCase(WrapTo360, 181, 181), TestCase::Duration::QUICK);
526 TestCase::Duration::QUICK);
527}
528
529/// Static variable for test initialization
Angles TestSuite.
Definition: test-angles.cc:293
Angles Test using one vector for initialization.
Definition: test-angles.cc:37
void DoRun() override
Implementation to actually run this TestCase.
Definition: test-angles.cc:75
OneVectorConstructorTestCase(Vector v, Angles a)
Constructor.
Definition: test-angles.cc:67
Angles m_a
expected angle
Definition: test-angles.cc:56
static std::string BuildNameString(Vector v)
Build the test name.
Definition: test-angles.cc:60
Angles Test using two vectors for initialization.
Definition: test-angles.cc:88
TwoVectorsConstructorTestCase(Vector v, Vector o, Angles a)
Constructor.
Definition: test-angles.cc:121
void DoRun() override
Implementation to actually run this TestCase.
Definition: test-angles.cc:130
Angles m_a
expected angle
Definition: test-angles.cc:110
static std::string BuildNameString(Vector v, Vector o)
Build the test name.
Definition: test-angles.cc:114
Test the output for WrapToRangeFunction.
Definition: test-angles.cc:234
WrapToRangeFunctionalTestCase(WrapToRangeFunction wrapper, double angle, double wrappedAngle)
Constructor.
Definition: test-angles.cc:267
double m_angle
the input angle
Definition: test-angles.cc:255
double m_wrappedAngle
the expected wrapper angle
Definition: test-angles.cc:256
static std::string BuildNameString(double angle, double wrappedAngle)
Build the test name.
Definition: test-angles.cc:260
void DoRun() override
Implementation to actually run this TestCase.
Definition: test-angles.cc:278
WrapToRangeFunction m_wrapper
the wrapper function
Definition: test-angles.cc:254
Test bounds for various WrapTo... methods (WrapTo180, WrapTo360, WrapToPi, and WrapTo2Pi) by using a ...
Definition: test-angles.cc:146
void CheckWrappingPoint(double wrapPoint)
The given wrapper shall wrap an angle into the expected range.
Definition: test-angles.cc:204
double m_lowerBound
the corresponding lower bound
Definition: test-angles.cc:174
WrapToRangeFunction m_wrapper
the wrapper function
Definition: test-angles.cc:173
WrapToRangeTestCase(WrapToRangeFunction wrapper, double lowerBound, double upperBound)
Constructor.
Definition: test-angles.cc:186
void DoRun() override
Implementation to actually run this TestCase.
Definition: test-angles.cc:197
static std::string BuildNameString(double lowerBound, double upperBound)
Build the test name.
Definition: test-angles.cc:179
double m_upperBound
the corresponding upper bound
Definition: test-angles.cc:175
Class holding the azimuth and inclination angles of spherical coordinates.
Definition: angles.h:118
double GetInclination() const
Getter for inclination angle.
Definition: angles.cc:246
double GetAzimuth() const
Getter for azimuth angle.
Definition: angles.cc:240
encapsulates test code
Definition: test.h:1061
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:301
A suite of tests to run.
Definition: test.h:1268
Type
Type of test.
Definition: test.h:1275
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition: test.h:252
#define NS_TEST_EXPECT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report if ...
Definition: test.h:511
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double WrapToPi(double a)
Wrap angle in [-M_PI, M_PI)
Definition: angles.cc:138
double WrapTo180(double a)
Wrap angle in [-180, 180)
Definition: angles.cc:96
double WrapTo360(double a)
Wrap angle in [0, 360)
Definition: angles.cc:75
double WrapTo2Pi(double a)
Wrap angle in [0, 2*M_PI)
Definition: angles.cc:117
std::string dir
static AnglesTestSuite g_staticAnglesTestSuiteInstance
Static variable for test initialization.
Definition: test-angles.cc:530
std::function< double(double)> WrapToRangeFunction
Definition: test-angles.cc:137