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) 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 |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include <fstream> | 23 #include <fstream> |
24 #include <sstream> | 24 #include <sstream> |
25 #include <string> | 25 #include <string> |
26 #include <vector> | 26 #include <vector> |
27 #include <list> | 27 #include <list> |
28 #include <limits> | 28 #include <limits> |
29 #include <stdint.h> | 29 #include <stdint.h> |
30 | 30 |
31 #include "non-copyable.h" | 31 #include "non-copyable.h" |
32 #include "system-wall-clock-ms.h" | 32 #include "system-wall-clock-ms.h" |
| 33 |
| 34 #include "ns3/ns3-module.h" |
| 35 #define NS3_MODULE NS3_CORE_MODULE |
| 36 #include "ns3/ns3-export.h" |
33 | 37 |
34 /** | 38 /** |
35 * \file | 39 * \file |
36 * \ingroup testing | 40 * \ingroup testing |
37 * \brief ns3::TestCase, ns3::TestSuite, ns3::TestRunner declarations, | 41 * \brief ns3::TestCase, ns3::TestSuite, ns3::TestRunner declarations, |
38 * and \c NS_TEST_ASSERT macro definitions. | 42 * and \c NS_TEST_ASSERT macro definitions. |
39 */ | 43 */ |
40 | 44 |
41 /** | 45 /** |
42 * \ingroup core | 46 * \ingroup core |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 * gsl_fcmp. | 1133 * gsl_fcmp. |
1130 *· | 1134 *· |
1131 * \param [in] a The first of double precision floating point | 1135 * \param [in] a The first of double precision floating point |
1132 * numbers to compare | 1136 * numbers to compare |
1133 * \param [in] b The second of double precision floating point | 1137 * \param [in] b The second of double precision floating point |
1134 * numbers to compare | 1138 * numbers to compare |
1135 * \param [in] epsilon The tolerance to use in the comparison. | 1139 * \param [in] epsilon The tolerance to use in the comparison. |
1136 * \returns Returns \c true if the doubles are equal to a precision | 1140 * \returns Returns \c true if the doubles are equal to a precision |
1137 * defined by epsilon | 1141 * defined by epsilon |
1138 */ | 1142 */ |
1139 bool TestDoubleIsEqual (const double a, const double b, | 1143 NS3_EXPORT bool TestDoubleIsEqual (const double a, const double b, |
1140 const double epsilon = std::numeric_limits<double>::epsi
lon ()); | 1144 const double epsilon = std::numeric_limits<double>::epsi
lon ()); |
1141 | 1145 |
1142 class TestRunnerImpl; | 1146 class TestRunnerImpl; |
1143 | 1147 |
1144 /** | 1148 /** |
1145 * \ingroup testing | 1149 * \ingroup testing |
1146 * | 1150 * |
1147 * \brief encapsulates test code | 1151 * \brief encapsulates test code |
1148 * | 1152 * |
1149 * To allow a new test to be run within the ns-3 test framework, users | 1153 * To allow a new test to be run within the ns-3 test framework, users |
1150 * need to create subclasses of this base class, override the DoRun | 1154 * need to create subclasses of this base class, override the DoRun |
1151 * method, and use the NS_TEST_* macros within DoRun. | 1155 * method, and use the NS_TEST_* macros within DoRun. |
1152 * | 1156 * |
1153 * \see sample-test-suite.cc | 1157 * \see sample-test-suite.cc |
1154 */ | 1158 */ |
1155 class TestCase : private NonCopyable | 1159 class NS3_EXPORT TestCase : private NonCopyable |
1156 { | 1160 { |
1157 public: | 1161 public: |
1158 /** \brief How long the test takes to execute. */ | 1162 /** \brief How long the test takes to execute. */ |
1159 enum TestDuration { | 1163 enum TestDuration { |
1160 QUICK = 1, //!< Fast test. | 1164 QUICK = 1, //!< Fast test. |
1161 EXTENSIVE = 2, //!< Medium length test. | 1165 EXTENSIVE = 2, //!< Medium length test. |
1162 TAKES_FOREVER = 3 //!< Very long running test. | 1166 TAKES_FOREVER = 3 //!< Very long running test. |
1163 }; | 1167 }; |
1164 | 1168 |
1165 /** | 1169 /** |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 * If the TestRunner is invoked with "--update-data", this will be | 1277 * If the TestRunner is invoked with "--update-data", this will be |
1274 * the data directory instead. | 1278 * the data directory instead. |
1275 * | 1279 * |
1276 * \param [in] filename The bare (no path) file name | 1280 * \param [in] filename The bare (no path) file name |
1277 * \return The full path to \p filename in the temporary directory. | 1281 * \return The full path to \p filename in the temporary directory. |
1278 */ | 1282 */ |
1279 std::string CreateTempDirFilename (std::string filename); | 1283 std::string CreateTempDirFilename (std::string filename); |
1280 /**@}*/ | 1284 /**@}*/ |
1281 ·· | 1285 ·· |
1282 private: | 1286 private: |
1283 friend class TestRunnerImpl; | 1287 friend class NS3_EXPORT TestRunnerImpl; |
1284 | 1288 |
1285 /** | 1289 /** |
1286 * \brief Implementation to do any local setup required for this | 1290 * \brief Implementation to do any local setup required for this |
1287 * TestCase. | 1291 * TestCase. |
1288 * | 1292 * |
1289 * Subclasses should override this method to perform any costly | 1293 * Subclasses should override this method to perform any costly |
1290 * per-test setup before DoRun is invoked. | 1294 * per-test setup before DoRun is invoked. |
1291 */ | 1295 */ |
1292 virtual void DoSetup (void); | 1296 virtual void DoSetup (void); |
1293 | 1297 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 enum TestDuration m_duration; //!< TestCase duration | 1336 enum TestDuration m_duration; //!< TestCase duration |
1333 }; | 1337 }; |
1334 | 1338 |
1335 /** | 1339 /** |
1336 * \ingroup testing | 1340 * \ingroup testing |
1337 * | 1341 * |
1338 * \brief A suite of tests to run. | 1342 * \brief A suite of tests to run. |
1339 * | 1343 * |
1340 * \see sample-test-suite.cc | 1344 * \see sample-test-suite.cc |
1341 */ | 1345 */ |
1342 class TestSuite : public TestCase | 1346 class NS3_EXPORT TestSuite : public TestCase |
1343 { | 1347 { |
1344 public: | 1348 public: |
1345 /** | 1349 /** |
1346 * \enum Type | 1350 * \enum Type |
1347 * \brief Type of test. | 1351 * \brief Type of test. |
1348 */ | 1352 */ |
1349 enum Type { | 1353 enum Type { |
1350 ALL = 0, //!< | 1354 ALL = 0, //!< |
1351 BVT = 1, //!< This test suite implements a Build Verification Test | 1355 BVT = 1, //!< This test suite implements a Build Verification Test |
1352 UNIT, //!< This test suite implements a Unit Test | 1356 UNIT, //!< This test suite implements a Unit Test |
(...skipping 22 matching lines...) Expand all Loading... |
1375 virtual void DoRun (void); | 1379 virtual void DoRun (void); |
1376 | 1380 |
1377 TestSuite::Type m_type; //!< Type of this TestSuite | 1381 TestSuite::Type m_type; //!< Type of this TestSuite |
1378 }; | 1382 }; |
1379 | 1383 |
1380 /** | 1384 /** |
1381 * \ingroup testingimpl | 1385 * \ingroup testingimpl |
1382 * | 1386 * |
1383 * \brief A runner to execute tests. | 1387 * \brief A runner to execute tests. |
1384 */ | 1388 */ |
1385 class TestRunner | 1389 class NS3_EXPORT TestRunner |
1386 { | 1390 { |
1387 public: | 1391 public: |
1388 /** | 1392 /** |
1389 * Run the requested suite of tests, | 1393 * Run the requested suite of tests, |
1390 * according to the given command line arguments. | 1394 * according to the given command line arguments. |
1391 * | 1395 * |
1392 * \param [in] argc The number of elements in \pname{argv} | 1396 * \param [in] argc The number of elements in \pname{argv} |
1393 * \param [in] argv The vector of command line arguments | 1397 * \param [in] argv The vector of command line arguments |
1394 * \returns Success status | 1398 * \returns Success status |
1395 */ | 1399 */ |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1483 T | 1487 T |
1484 TestVectors<T>::Get (std::size_t i) const | 1488 TestVectors<T>::Get (std::size_t i) const |
1485 { | 1489 { |
1486 NS_ABORT_MSG_UNLESS (m_vectors.size () > i, "TestVectors::Get(): Bad index"); | 1490 NS_ABORT_MSG_UNLESS (m_vectors.size () > i, "TestVectors::Get(): Bad index"); |
1487 return m_vectors[i]; | 1491 return m_vectors[i]; |
1488 } | 1492 } |
1489 | 1493 |
1490 } // namespace ns3· | 1494 } // namespace ns3· |
1491 | 1495 |
1492 #endif /* NS3_TEST_H */ | 1496 #endif /* NS3_TEST_H */ |
LEFT | RIGHT |