A Discrete-Event Network Simulator
API
test.h
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 #ifndef NS3_TEST_H
20 #define NS3_TEST_H
21 
22 #include <iostream>
23 #include <fstream>
24 #include <sstream>
25 #include <string>
26 #include <vector>
27 #include <list>
28 #include <limits>
29 #include <stdint.h>
30 
31 #include "non-copyable.h"
32 #include "system-wall-clock-ms.h"
33 
56 namespace ns3 {
57 
59  namespace tests {
60 
61  } // namespace tests
62 
63 //
64 // Note on below macros:
65 //
66 // When multiple statements are used in a macro, they should be bound
67 // together in a loop syntactically, so the macro can appear safely
68 // inside if clauses or other places that expect a single statement or
69 // a statement block. The "strange" do while construct is a generally
70 // expected best practice for defining a robust macro.
71 //
72 
77 #define ASSERT_ON_FAILURE \
78  do { \
79  if (MustAssertOnFailure ()) \
80  { \
81  *(volatile int *)0 = 0; \
82  } \
83  } while (false)
84 
89 #define CONTINUE_ON_FAILURE \
90  do { \
91  if (!MustContinueOnFailure ()) \
92  { \
93  return; \
94  } \
95  } while (false)
96 
101 #define CONTINUE_ON_FAILURE_RETURNS_BOOL \
102  do { \
103  if (!MustContinueOnFailure ()) \
104  { \
105  return IsStatusFailure (); \
106  } \
107  } while (false)
108 
109 
110 
111 // ===========================================================================
112 // Test for equality (generic version)
113 // ===========================================================================
114 
120 #define NS_TEST_ASSERT_MSG_EQ_INTERNAL(actual, limit, msg, file, line) \
121  do { \
122  if (!((actual) == (limit))) \
123  { \
124  ASSERT_ON_FAILURE; \
125  std::ostringstream msgStream; \
126  msgStream << msg; \
127  std::ostringstream actualStream; \
128  actualStream << actual; \
129  std::ostringstream limitStream; \
130  limitStream << limit; \
131  ReportTestFailure (std::string (#actual) + " (actual) == " + \
132  std::string (#limit) + " (limit)", \
133  actualStream.str (), limitStream.str (), \
134  msgStream.str (), file, line); \
135  CONTINUE_ON_FAILURE; \
136  } \
137  } while (false)
138 
168 #define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg) \
169  NS_TEST_ASSERT_MSG_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
170 
176 #define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line) \
177  do { \
178  if (!((actual) == (limit))) \
179  { \
180  ASSERT_ON_FAILURE; \
181  std::ostringstream msgStream; \
182  msgStream << msg; \
183  std::ostringstream actualStream; \
184  actualStream << actual; \
185  std::ostringstream limitStream; \
186  limitStream << limit; \
187  ReportTestFailure (std::string (#actual) + " (actual) == " + \
188  std::string (#limit) + " (limit)", \
189  actualStream.str (), limitStream.str (), \
190  msgStream.str (), file, line); \
191  CONTINUE_ON_FAILURE_RETURNS_BOOL; \
192  } \
193  } while (false)
194 
227 #define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL(actual, limit, msg) \
228  NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
229 
238 #define NS_TEST_EXPECT_MSG_EQ_INTERNAL(actual, limit, msg, file, line) \
239  do { \
240  if (!((actual) == (limit))) \
241  { \
242  ASSERT_ON_FAILURE; \
243  std::ostringstream msgStream; \
244  msgStream << msg; \
245  std::ostringstream actualStream; \
246  actualStream << actual; \
247  std::ostringstream limitStream; \
248  limitStream << limit; \
249  ReportTestFailure (std::string (#actual) + " (actual) == " + \
250  std::string (#limit) + " (limit)", \
251  actualStream.str (), limitStream.str (), \
252  msgStream.str (), file, line); \
253  } \
254  } while (false)
255 
285 #define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg) \
286  NS_TEST_EXPECT_MSG_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
287 
288 // ===========================================================================
289 // Test for equality with a provided tolerance (use for floating point
290 // comparisons -- both float and double)
291 // ===========================================================================
292 
298 #define NS_TEST_ASSERT_MSG_EQ_TOL_INTERNAL(actual, limit, tol, msg, file, line) \
299  do { \
300  if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \
301  { \
302  ASSERT_ON_FAILURE; \
303  std::ostringstream msgStream; \
304  msgStream << msg; \
305  std::ostringstream actualStream; \
306  actualStream << actual; \
307  std::ostringstream limitStream; \
308  limitStream << limit << " +- " << tol; \
309  std::ostringstream condStream; \
310  condStream << #actual << " (actual) < " << #limit \
311  << " (limit) + " << #tol << " (tol) && " \
312  << #actual << " (actual) > " << #limit \
313  << " (limit) - " << #tol << " (tol)"; \
314  ReportTestFailure (condStream.str (), actualStream.str (), \
315  limitStream.str (), msgStream.str (), \
316  file, line); \
317  CONTINUE_ON_FAILURE; \
318  } \
319  } while (false)
320 
380 #define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg) \
381  NS_TEST_ASSERT_MSG_EQ_TOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__)
382 
388 #define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL(actual, limit, tol, msg, file, line) \
389  do { \
390  if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \
391  { \
392  ASSERT_ON_FAILURE; \
393  std::ostringstream msgStream; \
394  msgStream << msg; \
395  std::ostringstream actualStream; \
396  actualStream << actual; \
397  std::ostringstream limitStream; \
398  limitStream << limit << " +- " << tol; \
399  std::ostringstream condStream; \
400  condStream << #actual << " (actual) < " << #limit \
401  << " (limit) + " << #tol << " (tol) && " \
402  << #actual << " (actual) > " << #limit \
403  << " (limit) - " << #tol << " (tol)"; \
404  ReportTestFailure (condStream.str (), actualStream.str (), \
405  limitStream.str (), msgStream.str (), \
406  file, line); \
407  CONTINUE_ON_FAILURE_RETURNS_BOOL; \
408  } \
409  } while (false)
410 
473 #define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL(actual, limit, tol, msg) \
474  NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__)
475 
484 #define NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL(actual, limit, tol, msg, file, line) \
485  do { \
486  if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \
487  { \
488  ASSERT_ON_FAILURE; \
489  std::ostringstream msgStream; \
490  msgStream << msg; \
491  std::ostringstream actualStream; \
492  actualStream << actual; \
493  std::ostringstream limitStream; \
494  limitStream << limit << " +- " << tol; \
495  std::ostringstream condStream; \
496  condStream << #actual << " (actual) < " << #limit \
497  << " (limit) + " << #tol << " (tol) && " \
498  << #actual << " (actual) > " << #limit \
499  << " (limit) - " << #tol << " (tol)"; \
500  ReportTestFailure (condStream.str (), actualStream.str (), \
501  limitStream.str (), msgStream.str (), \
502  file, line); \
503  } \
504  } while (false)
505 
565 #define NS_TEST_EXPECT_MSG_EQ_TOL(actual, limit, tol, msg) \
566  NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__)
567 
568 // ===========================================================================
569 // Test for inequality
570 // ===========================================================================
571 
577 #define NS_TEST_ASSERT_MSG_NE_INTERNAL(actual, limit, msg, file, line) \
578  do { \
579  if (!((actual) != (limit))) \
580  { \
581  ASSERT_ON_FAILURE; \
582  std::ostringstream msgStream; \
583  msgStream << msg; \
584  std::ostringstream actualStream; \
585  actualStream << actual; \
586  std::ostringstream limitStream; \
587  limitStream << limit; \
588  ReportTestFailure (std::string (#actual) + " (actual) != " + \
589  std::string (#limit) + " (limit)", \
590  actualStream.str (), limitStream.str (), \
591  msgStream.str (), file, line); \
592  CONTINUE_ON_FAILURE; \
593  } \
594  } while (false)
595 
624 #define NS_TEST_ASSERT_MSG_NE(actual, limit, msg) \
625  NS_TEST_ASSERT_MSG_NE_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
626 
632 #define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line) \
633  do { \
634  if (!((actual) != (limit))) \
635  { \
636  ASSERT_ON_FAILURE; \
637  std::ostringstream msgStream; \
638  msgStream << msg; \
639  std::ostringstream actualStream; \
640  actualStream << actual; \
641  std::ostringstream limitStream; \
642  limitStream << limit; \
643  ReportTestFailure (std::string (#actual) + " (actual) != " + \
644  std::string (#limit) + " (limit)", \
645  actualStream.str (), limitStream.str (), \
646  msgStream.str (), file, line); \
647  CONTINUE_ON_FAILURE_RETURNS_BOOL; \
648  } \
649  } while (false)
650 
682 #define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL(actual, limit, msg) \
683  NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
684 
693 #define NS_TEST_EXPECT_MSG_NE_INTERNAL(actual, limit, msg, file, line) \
694  do { \
695  if (!((actual) != (limit))) \
696  { \
697  ASSERT_ON_FAILURE; \
698  std::ostringstream msgStream; \
699  msgStream << msg; \
700  std::ostringstream actualStream; \
701  actualStream << actual; \
702  std::ostringstream limitStream; \
703  limitStream << limit; \
704  ReportTestFailure (std::string (#actual) + " (actual) != " + \
705  std::string (#limit) + " (limit)", \
706  actualStream.str (), limitStream.str (), \
707  msgStream.str (), file, line); \
708  } \
709  } while (false)
710 
739 #define NS_TEST_EXPECT_MSG_NE(actual, limit, msg) \
740  NS_TEST_EXPECT_MSG_NE_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
741 
742 // ===========================================================================
743 // Test for less than relation
744 // ===========================================================================
745 
751 #define NS_TEST_ASSERT_MSG_LT_INTERNAL(actual, limit, msg, file, line) \
752  do { \
753  if (!((actual) < (limit))) \
754  { \
755  ASSERT_ON_FAILURE; \
756  std::ostringstream msgStream; \
757  msgStream << msg; \
758  std::ostringstream actualStream; \
759  actualStream << actual; \
760  std::ostringstream limitStream; \
761  limitStream << limit; \
762  ReportTestFailure (std::string (#actual) + " (actual) < " + \
763  std::string (#limit) + " (limit)", \
764  actualStream.str (), limitStream.str (), \
765  msgStream.str (), file, line); \
766  CONTINUE_ON_FAILURE; \
767  } \
768  } while (false)
769 
775 #define NS_TEST_ASSERT_MSG_LT_OR_EQ_INTERNAL(actual, limit, msg, file, line) \
776  do { \
777  if (!((actual) <= (limit))) \
778  { \
779  ASSERT_ON_FAILURE; \
780  std::ostringstream msgStream; \
781  msgStream << msg; \
782  std::ostringstream actualStream; \
783  actualStream << actual; \
784  std::ostringstream limitStream; \
785  limitStream << limit; \
786  ReportTestFailure (std::string (#actual) + " (actual) < " + \
787  std::string (#limit) + " (limit)", \
788  actualStream.str (), limitStream.str (), \
789  msgStream.str (), file, line); \
790  CONTINUE_ON_FAILURE; \
791  } \
792  } while (false)
793 
811 #define NS_TEST_ASSERT_MSG_LT(actual, limit, msg) \
812  NS_TEST_ASSERT_MSG_LT_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
813 
832 #define NS_TEST_ASSERT_MSG_LT_OR_EQ(actual, limit, msg) \
833  NS_TEST_ASSERT_MSG_LT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
834 
842 #define NS_TEST_EXPECT_MSG_LT_INTERNAL(actual, limit, msg, file, line) \
843  do { \
844  if (!((actual) < (limit))) \
845  { \
846  ASSERT_ON_FAILURE; \
847  std::ostringstream msgStream; \
848  msgStream << msg; \
849  std::ostringstream actualStream; \
850  actualStream << actual; \
851  std::ostringstream limitStream; \
852  limitStream << limit; \
853  ReportTestFailure (std::string (#actual) + " (actual) < " + \
854  std::string (#limit) + " (limit)", \
855  actualStream.str (), limitStream.str (), \
856  msgStream.str (), file, line); \
857  } \
858  } while (false)
859 
868 #define NS_TEST_EXPECT_MSG_LT_OR_EQ_INTERNAL(actual, limit, msg, file, line) \
869  do { \
870  if (!((actual) <= (limit))) \
871  { \
872  ASSERT_ON_FAILURE; \
873  std::ostringstream msgStream; \
874  msgStream << msg; \
875  std::ostringstream actualStream; \
876  actualStream << actual; \
877  std::ostringstream limitStream; \
878  limitStream << limit; \
879  ReportTestFailure (std::string (#actual) + " (actual) < " + \
880  std::string (#limit) + " (limit)", \
881  actualStream.str (), limitStream.str (), \
882  msgStream.str (), file, line); \
883  } \
884  } while (false)
885 
903 #define NS_TEST_EXPECT_MSG_LT(actual, limit, msg) \
904  NS_TEST_EXPECT_MSG_LT_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
905 
924 #define NS_TEST_EXPECT_MSG_LT_OR_EQ(actual, limit, msg) \
925  NS_TEST_EXPECT_MSG_LT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
926 
927 // ===========================================================================
928 // Test for greater than relation
929 // ===========================================================================
930 
936 #define NS_TEST_ASSERT_MSG_GT_INTERNAL(actual, limit, msg, file, line) \
937  do { \
938  if (!((actual) > (limit))) \
939  { \
940  ASSERT_ON_FAILURE; \
941  std::ostringstream msgStream; \
942  msgStream << msg; \
943  std::ostringstream actualStream; \
944  actualStream << actual; \
945  std::ostringstream limitStream; \
946  limitStream << limit; \
947  ReportTestFailure (std::string (#actual) + " (actual) > " + \
948  std::string (#limit) + " (limit)", \
949  actualStream.str (), limitStream.str (), \
950  msgStream.str (), file, line); \
951  CONTINUE_ON_FAILURE; \
952  } \
953  } while (false)
954 
960 #define NS_TEST_ASSERT_MSG_GT_OR_EQ_INTERNAL(actual, limit, msg, file, line) \
961  do { \
962  if (!((actual) >= (limit))) \
963  { \
964  ASSERT_ON_FAILURE; \
965  std::ostringstream msgStream; \
966  msgStream << msg; \
967  std::ostringstream actualStream; \
968  actualStream << actual; \
969  std::ostringstream limitStream; \
970  limitStream << limit; \
971  ReportTestFailure (std::string (#actual) + " (actual) > " + \
972  std::string (#limit) + " (limit)", \
973  actualStream.str (), limitStream.str (), \
974  msgStream.str (), file, line); \
975  CONTINUE_ON_FAILURE; \
976  } \
977  } while (false)
978 
997 #define NS_TEST_ASSERT_MSG_GT(actual, limit, msg) \
998  NS_TEST_ASSERT_MSG_GT_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
999 
1018 #define NS_TEST_ASSERT_MSG_GT_OR_EQ(actual, limit, msg) \
1019  NS_TEST_ASSERT_MSG_GT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
1020 
1028 #define NS_TEST_EXPECT_MSG_GT_INTERNAL(actual, limit, msg, file, line) \
1029  do { \
1030  if (!((actual) > (limit))) \
1031  { \
1032  ASSERT_ON_FAILURE; \
1033  std::ostringstream msgStream; \
1034  msgStream << msg; \
1035  std::ostringstream actualStream; \
1036  actualStream << actual; \
1037  std::ostringstream limitStream; \
1038  limitStream << limit; \
1039  ReportTestFailure (std::string (#actual) + " (actual) > " + \
1040  std::string (#limit) + " (limit)", \
1041  actualStream.str (), limitStream.str (), \
1042  msgStream.str (), file, line); \
1043  } \
1044  } while (false)
1045 
1054 #define NS_TEST_EXPECT_MSG_GT_OR_EQ_INTERNAL(actual, limit, msg, file, line) \
1055  do { \
1056  if (!((actual) >= (limit))) \
1057  { \
1058  ASSERT_ON_FAILURE; \
1059  std::ostringstream msgStream; \
1060  msgStream << msg; \
1061  std::ostringstream actualStream; \
1062  actualStream << actual; \
1063  std::ostringstream limitStream; \
1064  limitStream << limit; \
1065  ReportTestFailure (std::string (#actual) + " (actual) > " + \
1066  std::string (#limit) + " (limit)", \
1067  actualStream.str (), limitStream.str (), \
1068  msgStream.str (), file, line); \
1069  } \
1070  } while (false)
1071 
1090 #define NS_TEST_EXPECT_MSG_GT(actual, limit, msg) \
1091  NS_TEST_EXPECT_MSG_GT_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
1092 
1111 #define NS_TEST_EXPECT_MSG_GT_OR_EQ(actual, limit, msg) \
1112  NS_TEST_EXPECT_MSG_GT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
1113 
1114 
1139 bool TestDoubleIsEqual (const double a, const double b,
1140  const double epsilon = std::numeric_limits<double>::epsilon ());
1141 
1142 class TestRunnerImpl;
1143 
1155 class TestCase : private NonCopyable
1156 {
1157 public:
1160  QUICK = 1,
1161  EXTENSIVE = 2,
1162  TAKES_FOREVER = 3
1163  };
1164 
1168  virtual ~TestCase ();
1169 
1173  std::string GetName (void) const;
1174 
1175 protected:
1181  TestCase (std::string name);
1182 
1190  void AddTestCase (TestCase *testCase, TestDuration duration = QUICK);
1191 
1208  void SetDataDir (std::string directory);
1209 
1215  bool IsStatusFailure (void) const;
1221  bool IsStatusSuccess (void) const;
1222 
1228  TestCase * GetParent () const;
1229 
1246  void ReportTestFailure (std::string cond, std::string actual,
1247  std::string limit, std::string message,
1248  std::string file, int32_t line);
1254  bool MustAssertOnFailure (void) const;
1260  bool MustContinueOnFailure (void) const;
1269  std::string CreateDataDirFilename (std::string filename);
1279  std::string CreateTempDirFilename (std::string filename);
1282 private:
1283  friend class TestRunnerImpl;
1284 
1292  virtual void DoSetup (void);
1293 
1299  virtual void DoRun (void) = 0;
1300 
1308  virtual void DoTeardown (void);
1309 
1310  // methods called by TestRunnerImpl
1316  void Run (TestRunnerImpl *runner);
1318  bool IsFailed (void) const;
1319 
1324  struct Result;
1325 
1326  TestCase *m_parent;
1327  std::vector<TestCase *> m_children;
1328  std::string m_dataDir;
1330  struct Result *m_result;
1331  std::string m_name;
1332  enum TestDuration m_duration;
1333 };
1334 
1342 class TestSuite : public TestCase
1343 {
1344 public:
1349  enum Type {
1350  ALL = 0,
1351  BVT = 1,
1355  PERFORMANCE
1356  };
1357 
1364  TestSuite (std::string name, Type type = UNIT);
1365 
1371  TestSuite::Type GetTestType (void);
1372 
1373 private:
1374  // Inherited
1375  virtual void DoRun (void);
1376 
1378 };
1379 
1386 {
1387 public:
1396  static int Run (int argc, char *argv[]);
1397 };
1398 
1404 template <typename T>
1405 class TestVectors : private NonCopyable
1406 {
1407 public:
1411  TestVectors ();
1415  virtual ~TestVectors ();
1416 
1422  void Reserve (uint32_t reserve);
1423 
1429  std::size_t Add (T vector);
1430 
1435  std::size_t GetN (void) const;
1441  T Get (std::size_t i) const;
1442 
1443 private:
1444  typedef std::vector<T> TestVector;
1445  TestVector m_vectors;
1446 };
1447 
1448 template <typename T>
1450  : m_vectors ()
1451 {
1452 }
1453 
1454 template <typename T>
1455 void
1456 TestVectors<T>::Reserve (uint32_t reserve)
1457 {
1458  m_vectors.reserve (reserve);
1459 }
1460 
1461 template <typename T>
1463 {
1464 }
1465 
1466 template <typename T>
1467 std::size_t
1469 {
1470  std::size_t index = m_vectors.size ();
1471  m_vectors.push_back (vector);
1472  return index;
1473 }
1474 
1475 template <typename T>
1476 std::size_t
1478 {
1479  return m_vectors.size ();
1480 }
1481 
1482 template <typename T>
1483 T
1484 TestVectors<T>::Get (std::size_t i) const
1485 {
1486  NS_ABORT_MSG_UNLESS (m_vectors.size () > i, "TestVectors::Get(): Bad index");
1487  return m_vectors[i];
1488 }
1489 
1490 } // namespace ns3
1491 
1492 #endif /* NS3_TEST_H */
This test suite implements a System Test.
Definition: test.h:1353
Container for all tests.
Definition: test.cc:138
A base class for (non-Singleton) objects which shouldn&#39;t be copied.
Definition: non-copyable.h:54
virtual ~TestVectors()
Virtual destructor.
Definition: test.h:1462
A suite of tests to run.
Definition: test.h:1342
A runner to execute tests.
Definition: test.h:1385
void Reserve(uint32_t reserve)
Set the expected length of this vector.
Definition: test.h:1456
Container for results from a TestCase.
Definition: test.cc:120
Type
Type of test.
Definition: test.h:1349
std::vector< T > TestVector
Container type.
Definition: test.h:1444
encapsulates test code
Definition: test.h:1155
ns3::NonCopyable declaration.
A simple way to store test vectors (for stimulus or from responses)
Definition: test.h:1405
TestVectors()
Constructor.
Definition: test.h:1449
TestCase * m_parent
Pointer to my parent TestCase.
Definition: test.h:1324
TestRunnerImpl * m_runner
Pointer to the TestRunner.
Definition: test.h:1329
ns3::SystemWallClockMs declaration.
bool TestDoubleIsEqual(const double x1, const double x2, const double epsilon)
Compare two double precision floating point numbers and declare them equal if they are within some ep...
Definition: test.cc:44
TestSuite::Type m_type
Type of this TestSuite.
Definition: test.h:1377
TestDuration
How long the test takes to execute.
Definition: test.h:1159
Every class exported by the ns3 library is enclosed in the ns3 namespace.
struct Result * m_result
Results data.
Definition: test.h:1330
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
Definition: abort.h:144
TestVector m_vectors
The list of test vectors.
Definition: test.h:1445
std::vector< TestCase * > m_children
Vector of my children.
Definition: test.h:1327
This test suite implements an Example Test.
Definition: test.h:1354
std::size_t Add(T vector)
Definition: test.h:1468
This test suite implements a Unit Test.
Definition: test.h:1352
std::size_t GetN(void) const
Get the total number of test vectors.
Definition: test.h:1477
std::string m_name
TestCase name.
Definition: test.h:1331
T Get(std::size_t i) const
Get the i&#39;th test vector.
Definition: test.h:1484
std::string m_dataDir
My data directory.
Definition: test.h:1328