core: remove NS_TEST_*_INTERNAL

This commit is contained in:
Tommaso Pecorella
2021-11-23 01:26:45 +01:00
committed by Tommaso Pecorella
parent d40173fb50
commit deaec64d36
5 changed files with 260 additions and 427 deletions

View File

@@ -110,30 +110,6 @@ namespace tests {} // namespace tests
// Test for equality (generic version)
// ===========================================================================
/**
* \ingroup testingimpl
* \brief Test that an actual and expected (limit) value are equal and report
* and abort if not.
*/
#define NS_TEST_ASSERT_MSG_EQ_INTERNAL(actual, limit, msg, file, line) \
do { \
if (!((actual) == (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) == " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
CONTINUE_ON_FAILURE; \
} \
} while (false)
/**
* \ingroup testing
*
@@ -163,15 +139,7 @@ namespace tests {} // namespace tests
* numbers (float or double) as it is unlikely to do what you expect.
* Use NS_TEST_ASSERT_MSG_EQ_TOL instead.
*/
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg) \
NS_TEST_ASSERT_MSG_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
/**
* \ingroup testingimpl
* \brief Test that an actual and expected (limit) value are equal and report
* and abort if not.
*/
#define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line) \
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg) \
do { \
if (!((actual) == (limit))) \
{ \
@@ -185,8 +153,8 @@ namespace tests {} // namespace tests
ReportTestFailure (std::string (#actual) + " (actual) == " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
CONTINUE_ON_FAILURE_RETURNS_BOOL; \
msgStream.str (), __FILE__, __LINE__); \
CONTINUE_ON_FAILURE; \
} \
} while (false)
@@ -222,18 +190,7 @@ namespace tests {} // namespace tests
* This function returns a Boolean value.
*
*/
#define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL(actual, limit, msg) \
NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
/**
* \ingroup testingimpl
* \brief Test that an actual and expected (limit) value are equal and
* report if not.
*
* Required to avoid use of return statement which allows use in
* methods (esp. callbacks) returning void.
*/
#define NS_TEST_EXPECT_MSG_EQ_INTERNAL(actual, limit, msg, file, line) \
#define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL(actual, limit, msg) \
do { \
if (!((actual) == (limit))) \
{ \
@@ -247,7 +204,8 @@ namespace tests {} // namespace tests
ReportTestFailure (std::string (#actual) + " (actual) == " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
msgStream.str (), __FILE__, __LINE__); \
CONTINUE_ON_FAILURE_RETURNS_BOOL; \
} \
} while (false)
@@ -280,22 +238,9 @@ namespace tests {} // namespace tests
* numbers (float or double) as it is unlikely to do what you expect.
* Use NS_TEST_EXPECT_MSG_EQ_TOL instead.
*/
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg) \
NS_TEST_EXPECT_MSG_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
// ===========================================================================
// Test for equality with a provided tolerance (use for floating point
// comparisons -- both float and double)
// ===========================================================================
/**
* \ingroup testingimpl
* \brief Test that actual and expected (limit) values are equal to
* plus or minus some tolerance and report and abort if not.
*/
#define NS_TEST_ASSERT_MSG_EQ_TOL_INTERNAL(actual, limit, tol, msg, file, line) \
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg) \
do { \
if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \
if (!((actual) == (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
@@ -303,19 +248,20 @@ namespace tests {} // namespace tests
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit << " +- " << tol; \
std::ostringstream condStream; \
condStream << #actual << " (actual) < " << #limit \
<< " (limit) + " << #tol << " (tol) && " \
<< #actual << " (actual) > " << #limit \
<< " (limit) - " << #tol << " (tol)"; \
ReportTestFailure (condStream.str (), actualStream.str (), \
limitStream.str (), msgStream.str (), \
file, line); \
CONTINUE_ON_FAILURE; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) == " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), __FILE__, __LINE__); \
} \
} while (false)
// ===========================================================================
// Test for equality with a provided tolerance (use for floating point
// comparisons -- both float and double)
// ===========================================================================
/**
* \ingroup testing
*
@@ -375,15 +321,7 @@ namespace tests {} // namespace tests
* \param [in] tol Tolerance of the test.
* \param [in] msg Message that is output if the test does not pass.
*/
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg) \
NS_TEST_ASSERT_MSG_EQ_TOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__)
/**
* \ingroup testingimpl
* \brief Test that actual and expected (limit) values are equal to
* plus or minus some tolerance and report and abort if not.
*/
#define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL(actual, limit, tol, msg, file, line) \
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg) \
do { \
if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \
{ \
@@ -401,9 +339,9 @@ namespace tests {} // namespace tests
<< " (limit) - " << #tol << " (tol)"; \
ReportTestFailure (condStream.str (), actualStream.str (), \
limitStream.str (), msgStream.str (), \
file, line); \
CONTINUE_ON_FAILURE_RETURNS_BOOL; \
} ` \
__FILE__, __LINE__); \
CONTINUE_ON_FAILURE; \
} \
} while (false)
/**
@@ -468,18 +406,7 @@ namespace tests {} // namespace tests
* This function returns a Boolean value.
*
*/
#define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL(actual, limit, tol, msg) \
NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__)
/**
* \ingroup testingimpl
* \brief Test that actual and expected (limit) values are equal to
* plus or minus some tolerance and report if not.
*
* Required to avoid use of return statement which allows use in
* methods (esp. callbacks) returning void.
*/
#define NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL(actual, limit, tol, msg, file, line) \
#define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL(actual, limit, tol, msg) \
do { \
if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \
{ \
@@ -497,10 +424,12 @@ namespace tests {} // namespace tests
<< " (limit) - " << #tol << " (tol)"; \
ReportTestFailure (condStream.str (), actualStream.str (), \
limitStream.str (), msgStream.str (), \
file, line); \
__FILE__, __LINE__); \
CONTINUE_ON_FAILURE_RETURNS_BOOL; \
} \
} while (false)
/**
* \ingroup testing
*
@@ -560,21 +489,9 @@ namespace tests {} // namespace tests
* \param [in] tol Tolerance of the test.
* \param [in] msg Message that is output if the test does not pass.
*/
#define NS_TEST_EXPECT_MSG_EQ_TOL(actual, limit, tol, msg) \
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__)
// ===========================================================================
// Test for inequality
// ===========================================================================
/**
* \ingroup testingimpl
* \brief Test that an actual and expected (limit) value are not equal and
* report and abort if not.
*/
#define NS_TEST_ASSERT_MSG_NE_INTERNAL(actual, limit, msg, file, line) \
#define NS_TEST_EXPECT_MSG_EQ_TOL(actual, limit, tol, msg) \
do { \
if (!((actual) != (limit))) \
if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
@@ -582,15 +499,22 @@ namespace tests {} // namespace tests
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) != " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
CONTINUE_ON_FAILURE; \
limitStream << limit << " +- " << tol; \
std::ostringstream condStream; \
condStream << #actual << " (actual) < " << #limit \
<< " (limit) + " << #tol << " (tol) && " \
<< #actual << " (actual) > " << #limit \
<< " (limit) - " << #tol << " (tol)"; \
ReportTestFailure (condStream.str (), actualStream.str (), \
limitStream.str (), msgStream.str (), \
__FILE__, __LINE__); \
} \
} while (false)
// ===========================================================================
// Test for inequality
// ===========================================================================
/**
* \ingroup testing
*
@@ -615,19 +539,8 @@ namespace tests {} // namespace tests
* \param [in] actual Expression for the actual value found during the test.
* \param [in] limit Expression for the value that actual is tested against.
* \param [in] msg Message that is output if the test does not pass.
*
* \warning Do not use this macro if you are comparing floating point
* numbers (float or double). Use NS_TEST_ASSERT_MSG_FLNE instead.
*/
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg) \
NS_TEST_ASSERT_MSG_NE_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
/**
* \ingroup testingimpl
* \brief Test that an actual and expected (limit) value are not equal and
* report and abort if not.
*/
#define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line) \
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg) \
do { \
if (!((actual) != (limit))) \
{ \
@@ -641,8 +554,8 @@ namespace tests {} // namespace tests
ReportTestFailure (std::string (#actual) + " (actual) != " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
CONTINUE_ON_FAILURE_RETURNS_BOOL; \
msgStream.str (), __FILE__, __LINE__); \
CONTINUE_ON_FAILURE; \
} \
} while (false)
@@ -671,24 +584,10 @@ namespace tests {} // namespace tests
* \param [in] limit Expression for the expected value of the test.
* \param [in] msg Message that is output if the test does not pass.
*
* \warning Do not use this macro if you are comparing floating point
* numbers (float or double). Use NS_TEST_ASSERT_MSG_FLNE instead.
*
* This function returns a Boolean value.
*
*/
#define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL(actual, limit, msg) \
NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
/**
* \ingroup testingimpl
* \brief Test that an actual and expected (limit) value are not equal and
* report if not.
*
* Required to avoid use of return statement which allows use in methods
* (callbacks) returning void.
*/
#define NS_TEST_EXPECT_MSG_NE_INTERNAL(actual, limit, msg, file, line) \
#define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL(actual, limit, msg) \
do { \
if (!((actual) != (limit))) \
{ \
@@ -702,7 +601,8 @@ namespace tests {} // namespace tests
ReportTestFailure (std::string (#actual) + " (actual) != " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
msgStream.str (), __FILE__, __LINE__); \
CONTINUE_ON_FAILURE_RETURNS_BOOL; \
} \
} while (false)
@@ -735,60 +635,27 @@ namespace tests {} // namespace tests
* numbers (float or double). Use NS_TEST_EXPECT_MSG_FLNE instead.
*/
#define NS_TEST_EXPECT_MSG_NE(actual, limit, msg) \
NS_TEST_EXPECT_MSG_NE_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
do { \
if (!((actual) != (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) != " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), __FILE__, __LINE__); \
} \
} while (false)
// ===========================================================================
// Test for less than relation
// ===========================================================================
/**
* \ingroup testingimpl
* \brief Test that an actual value is less than a limit and report and abort
* if not.
*/
#define NS_TEST_ASSERT_MSG_LT_INTERNAL(actual, limit, msg, file, line) \
do { \
if (!((actual) < (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) < " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
CONTINUE_ON_FAILURE; \
} \
} while (false)
/**
* \ingroup testingimpl
* \brief Test that an actual value is less than or equal to a limit and report
* and abort if not.
*/
#define NS_TEST_ASSERT_MSG_LT_OR_EQ_INTERNAL(actual, limit, msg, file, line) \
do { \
if (!((actual) <= (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) < " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
CONTINUE_ON_FAILURE; \
} \
} while (false)
/**
* \ingroup testing
*
@@ -806,8 +673,24 @@ namespace tests {} // namespace tests
* \param [in] limit Expression for the limit value of the test.
* \param [in] msg Message that is output if the test does not pass.
*/
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg) \
NS_TEST_ASSERT_MSG_LT_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg) \
do { \
if (!((actual) < (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) < " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), __FILE__, __LINE__); \
CONTINUE_ON_FAILURE; \
} \
} while (false)
/**
* \ingroup testing
@@ -827,43 +710,7 @@ namespace tests {} // namespace tests
* \param [in] limit Expression for the limit value of the test.
* \param [in] msg Message that is output if the test does not pass.
*/
#define NS_TEST_ASSERT_MSG_LT_OR_EQ(actual, limit, msg) \
NS_TEST_ASSERT_MSG_LT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
/**
* \ingroup testingimpl
* \brief Test that an actual value is less than a limit and report if not.
*
* Required to avoid use of return statement which allows use in methods
* (callbacks) returning void.
*/
#define NS_TEST_EXPECT_MSG_LT_INTERNAL(actual, limit, msg, file, line) \
do { \
if (!((actual) < (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) < " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
/**
* \ingroup testingimpl
* \brief Test that an actual value is less than or equal to a limit
* and report if not.
*
* Required to avoid use of return statement which allows use in
* methods (callbacks) returning void.
*/
#define NS_TEST_EXPECT_MSG_LT_OR_EQ_INTERNAL(actual, limit, msg, file, line) \
#define NS_TEST_ASSERT_MSG_LT_OR_EQ(actual, limit, msg) \
do { \
if (!((actual) <= (limit))) \
{ \
@@ -877,7 +724,8 @@ namespace tests {} // namespace tests
ReportTestFailure (std::string (#actual) + " (actual) < " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
msgStream.str (), __FILE__, __LINE__); \
CONTINUE_ON_FAILURE; \
} \
} while (false)
@@ -898,8 +746,24 @@ namespace tests {} // namespace tests
* \param [in] limit Expression for the limit value of the test.
* \param [in] msg Message that is output if the test does not pass.
*/
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg) \
NS_TEST_EXPECT_MSG_LT_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg) \
do { \
if (!((actual) < (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) < " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), __FILE__, __LINE__); \
} \
} while (false)
/**
* \ingroup testing
@@ -920,60 +784,27 @@ namespace tests {} // namespace tests
* \param [in] msg Message that is output if the test does not pass.
*/
#define NS_TEST_EXPECT_MSG_LT_OR_EQ(actual, limit, msg) \
NS_TEST_EXPECT_MSG_LT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
do { \
if (!((actual) <= (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) < " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), __FILE__, __LINE__); \
} \
} while (false)
// ===========================================================================
// Test for greater than relation
// ===========================================================================
/**
* \ingroup testingimpl
* \brief Test that an actual value is greater than a limit and report and abort
* if not.
*/
#define NS_TEST_ASSERT_MSG_GT_INTERNAL(actual, limit, msg, file, line) \
do { \
if (!((actual) > (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) > " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
CONTINUE_ON_FAILURE; \
} \
} while (false)
/**
* \ingroup testingimpl
* \brief Test that an actual value is greater than or equal to a
* limit and report and abort if not.
*/
#define NS_TEST_ASSERT_MSG_GT_OR_EQ_INTERNAL(actual, limit, msg, file, line) \
do { \
if (!((actual) >= (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) > " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
CONTINUE_ON_FAILURE; \
} \
} while (false)
/**
* \ingroup testing
*
@@ -992,8 +823,24 @@ namespace tests {} // namespace tests
* \param [in] limit Expression for the limit value of the test.
* \param [in] msg Message that is output if the test does not pass.
*/
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg) \
NS_TEST_ASSERT_MSG_GT_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg) \
do { \
if (!((actual) > (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) > " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), __FILE__, __LINE__); \
CONTINUE_ON_FAILURE; \
} \
} while (false)
/**
* \ingroup testing
@@ -1013,43 +860,7 @@ namespace tests {} // namespace tests
* \param [in] limit Expression for the limit value of the test.
* \param [in] msg Message that is output if the test does not pass.
*/
#define NS_TEST_ASSERT_MSG_GT_OR_EQ(actual, limit, msg) \
NS_TEST_ASSERT_MSG_GT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
/**
* \ingroup testingimpl
* \brief Test that an actual value is greater than a limit and report if not.
*
* Required to avoid use of return statement which allows use in methods
* (callbacks) returning void.
*/
#define NS_TEST_EXPECT_MSG_GT_INTERNAL(actual, limit, msg, file, line) \
do { \
if (!((actual) > (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) > " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
} \
} while (false)
/**
* \ingroup testingimpl
* \brief Test that an actual value is greater than or equal to limit
* and report if not.
*
* Required to avoid use of return statement which allows use in
* methods (callbacks) returning void.
*/
#define NS_TEST_EXPECT_MSG_GT_OR_EQ_INTERNAL(actual, limit, msg, file, line) \
#define NS_TEST_ASSERT_MSG_GT_OR_EQ(actual, limit, msg) \
do { \
if (!((actual) >= (limit))) \
{ \
@@ -1063,7 +874,8 @@ namespace tests {} // namespace tests
ReportTestFailure (std::string (#actual) + " (actual) > " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), file, line); \
msgStream.str (), __FILE__, __LINE__); \
CONTINUE_ON_FAILURE; \
} \
} while (false)
@@ -1085,8 +897,23 @@ namespace tests {} // namespace tests
* \param [in] limit Expression for the limit value of the test.
* \param [in] msg Message that is output if the test does not pass.
*/
#define NS_TEST_EXPECT_MSG_GT(actual, limit, msg) \
NS_TEST_EXPECT_MSG_GT_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
#define NS_TEST_EXPECT_MSG_GT(actual, limit, msg) \
do { \
if (!((actual) > (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) > " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), __FILE__, __LINE__); \
} \
} while (false)
/**
* \ingroup testing
@@ -1106,9 +933,23 @@ namespace tests {} // namespace tests
* \param [in] limit Expression for the limit value of the test.
* \param [in] msg Message that is output if the test does not pass.
*/
#define NS_TEST_EXPECT_MSG_GT_OR_EQ(actual, limit, msg) \
NS_TEST_EXPECT_MSG_GT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__)
#define NS_TEST_EXPECT_MSG_GT_OR_EQ(actual, limit, msg) \
do { \
if (!((actual) >= (limit))) \
{ \
ASSERT_ON_FAILURE; \
std::ostringstream msgStream; \
msgStream << msg; \
std::ostringstream actualStream; \
actualStream << actual; \
std::ostringstream limitStream; \
limitStream << limit; \
ReportTestFailure (std::string (#actual) + " (actual) > " + \
std::string (#limit) + " (limit)", \
actualStream.str (), limitStream.str (), \
msgStream.str (), __FILE__, __LINE__); \
} \
} while (false)
/**
* \ingroup testing

View File

@@ -79,14 +79,14 @@ void
WaypointLazyNotifyFalse::TestXPosition (double expectedXPos)
{
Vector pos = m_mob->GetPosition ();
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (pos.x, expectedXPos, 0.001, "Position not equal", __FILE__, __LINE__);
NS_TEST_EXPECT_MSG_EQ_TOL (pos.x, expectedXPos, 0.001, "Position not equal");
}
void
WaypointLazyNotifyFalse::CourseChangeCallback (std::string path, Ptr<const MobilityModel> model)
{
// All waypoints (at 10 second intervals) should trigger a course change
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (m_courseChanges * 10.0, Simulator::Now ().GetSeconds (), 0.001, "Course change not notified correctly", __FILE__, __LINE__);
NS_TEST_EXPECT_MSG_EQ_TOL (m_courseChanges * 10.0, Simulator::Now ().GetSeconds (), 0.001, "Course change not notified correctly");
m_courseChanges++;
}
@@ -151,7 +151,7 @@ void
WaypointLazyNotifyTrue::TestXPosition (double expectedXPos)
{
Vector pos = m_mob->GetPosition ();
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (pos.x, expectedXPos, 0.001, "Position not equal", __FILE__, __LINE__);
NS_TEST_EXPECT_MSG_EQ_TOL (pos.x, expectedXPos, 0.001, "Position not equal");
}
void
@@ -159,7 +159,7 @@ WaypointLazyNotifyTrue::CourseChangeCallback (std::string path, Ptr<const Mobili
{
// This should trigger at time 15 only, since that is the first time that
// position is updated due to LazyNotify
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (15, Simulator::Now ().GetSeconds (), 0.001, "Course change not notified correctly", __FILE__, __LINE__);
NS_TEST_EXPECT_MSG_EQ_TOL (15, Simulator::Now ().GetSeconds (), 0.001, "Course change not notified correctly");
}
void
@@ -227,7 +227,7 @@ void
WaypointInitialPositionIsWaypoint::TestXPosition (Ptr<const WaypointMobilityModel> model, double expectedXPos)
{
Vector pos = model->GetPosition ();
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (pos.x, expectedXPos, 0.001, "Position not equal", __FILE__, __LINE__);
NS_TEST_EXPECT_MSG_EQ_TOL (pos.x, expectedXPos, 0.001, "Position not equal");
}
void
@@ -356,7 +356,7 @@ void
WaypointMobilityModelViaHelper::TestXPosition (Ptr<const WaypointMobilityModel> mob, double expectedXPos)
{
Vector pos = mob->GetPosition ();
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (pos.x, expectedXPos, 0.001, "Position not equal", __FILE__, __LINE__);
NS_TEST_EXPECT_MSG_EQ_TOL (pos.x, expectedXPos, 0.001, "Position not equal");
}
// WaypointMobilityModel tests using the helper

View File

@@ -43,10 +43,8 @@ private:
* \param b The buffer to check
* \param n The number of bytes to check
* \param array The array of bytes that should be in the buffer
* \param file The file name
* \param line The line number
*/
void EnsureWrittenBytes (Buffer b, uint32_t n, uint8_t array[], const char *file, int line);
void EnsureWrittenBytes (Buffer b, uint32_t n, uint8_t array[]);
public:
virtual void DoRun (void);
BufferTest ();
@@ -58,39 +56,39 @@ BufferTest::BufferTest ()
}
void
BufferTest::EnsureWrittenBytes (Buffer b, uint32_t n, uint8_t array[], const char *file, int line)
BufferTest::EnsureWrittenBytes (Buffer b, uint32_t n, uint8_t array[])
{
bool success = true;
uint8_t *expected = array;
uint8_t const*got;
got = b.PeekData ();
for (uint32_t j = 0; j < n; j++)
for (uint32_t j = 0; j < n; j++)
{
if (got[j] != expected[j])
if (got[j] != expected[j])
{
success = false;
}
}
if (!success)
if (!success)
{
std::ostringstream failure;
failure << "Buffer -- ";
failure << "expected: n=";
failure << n << ", ";
failure.setf (std::ios::hex, std::ios::basefield);
for (uint32_t j = 0; j < n; j++)
for (uint32_t j = 0; j < n; j++)
{
failure << (uint16_t)expected[j] << " ";
}
failure.setf (std::ios::dec, std::ios::basefield);
failure << "got: ";
failure.setf (std::ios::hex, std::ios::basefield);
for (uint32_t j = 0; j < n; j++)
for (uint32_t j = 0; j < n; j++)
{
failure << (uint16_t)got[j] << " ";
}
failure << std::endl;
NS_TEST_ASSERT_MSG_EQ_INTERNAL (true, false, failure.str (), file, line);
NS_TEST_ASSERT_MSG_EQ (true, false, failure.str ());
}
}
@@ -98,10 +96,10 @@ BufferTest::EnsureWrittenBytes (Buffer b, uint32_t n, uint8_t array[], const cha
* Works only when variadic macros are
* available which is the case for gcc.
*/
#define ENSURE_WRITTEN_BYTES(buffer, n, ...) \
{ \
uint8_t bytes[] = { __VA_ARGS__}; \
EnsureWrittenBytes (buffer, n, bytes, __FILE__, __LINE__); \
#define ENSURE_WRITTEN_BYTES(buffer, n, ...) \
{ \
uint8_t bytes[] = { __VA_ARGS__}; \
EnsureWrittenBytes (buffer, n, bytes); \
}
void

View File

@@ -61,7 +61,7 @@ private:
bool m_ok; //!< True if no error is signalled.
};
TypeId
TypeId
HistoryHeaderBase::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::HistoryHeaderBase")
@@ -132,25 +132,25 @@ HistoryHeader<N>::GetTypeId (void)
}
template <int N>
TypeId
TypeId
HistoryHeader<N>::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
template <int N>
void
void
HistoryHeader<N>::Print (std::ostream &os) const
{
NS_ASSERT (false);
}
template <int N>
uint32_t
uint32_t
HistoryHeader<N>::GetSerializedSize (void) const
{
return N;
}
template <int N>
void
void
HistoryHeader<N>::Serialize (Buffer::Iterator start) const
{
start.WriteU8 (N, N);
@@ -200,7 +200,7 @@ private:
bool m_ok; //!< True if no error is signalled.
};
TypeId
TypeId
HistoryTrailerBase::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::HistoryTrailerBase")
@@ -269,25 +269,25 @@ HistoryTrailer<N>::GetTypeId (void)
}
template <int N>
TypeId
TypeId
HistoryTrailer<N>::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
template <int N>
void
void
HistoryTrailer<N>::Print (std::ostream &os) const
{
NS_ASSERT (false);
}
template <int N>
uint32_t
uint32_t
HistoryTrailer<N>::GetSerializedSize (void) const
{
return N;
}
template <int N>
void
void
HistoryTrailer<N>::Serialize (Buffer::Iterator start) const
{
start.Prev (N);
@@ -323,12 +323,10 @@ public:
/**
* Checks the packet header and trailer history
* \param p The packet
* \param file The file name
* \param line The line number
* \param n The number of variable arguments
* \param ... The variable arguments
*/
void CheckHistory (Ptr<Packet> p, const char *file, int line, uint32_t n, ...);
void CheckHistory (Ptr<Packet> p, uint32_t n, ...);
virtual void DoRun (void);
private:
/**
@@ -349,7 +347,7 @@ PacketMetadataTest::~PacketMetadataTest ()
}
void
PacketMetadataTest::CheckHistory (Ptr<Packet> p, const char *file, int line, uint32_t n, ...)
PacketMetadataTest::CheckHistory (Ptr<Packet> p, uint32_t n, ...)
{
std::list<int> expected;
va_list ap;
@@ -420,7 +418,7 @@ PacketMetadataTest::CheckHistory (Ptr<Packet> p, const char *file, int line, uin
error:
std::ostringstream failure;
failure << "PacketMetadata error. Got:\"";
for (std::list<int>::iterator i = got.begin ();
for (std::list<int>::iterator i = got.begin ();
i != got.end (); i++)
{
failure << *i << ", ";
@@ -432,7 +430,7 @@ error:
failure << *j << ", ";
}
failure << "\"";
NS_TEST_ASSERT_MSG_EQ_INTERNAL (false, true, failure.str (), file, line);
NS_TEST_ASSERT_MSG_EQ (false, true, failure.str ());
}
#define ADD_HEADER(p, n) \
@@ -457,13 +455,13 @@ error:
}
#define CHECK_HISTORY(p, ...) \
{ \
CheckHistory (p, __FILE__, __LINE__, __VA_ARGS__); \
CheckHistory (p, __VA_ARGS__); \
uint32_t size = p->GetSerializedSize (); \
uint8_t* buffer = new uint8_t[size]; \
p->Serialize (buffer, size); \
Ptr<Packet> otherPacket = Create<Packet> (buffer, size, true); \
delete [] buffer; \
CheckHistory (otherPacket, __FILE__, __LINE__, __VA_ARGS__); \
CheckHistory (otherPacket, __VA_ARGS__); \
}
@@ -491,13 +489,13 @@ PacketMetadataTest::DoRun (void)
ADD_HEADER (p, 1);
ADD_HEADER (p, 2);
ADD_HEADER (p, 3);
CHECK_HISTORY (p, 4,
CHECK_HISTORY (p, 4,
3, 2, 1, 10);
ADD_HEADER (p, 5);
CHECK_HISTORY (p, 5,
CHECK_HISTORY (p, 5,
5, 3, 2, 1, 10);
ADD_HEADER (p, 6);
CHECK_HISTORY (p, 6,
CHECK_HISTORY (p, 6,
6, 5, 3, 2, 1, 10);
p = Create<Packet> (10);
@@ -505,7 +503,7 @@ PacketMetadataTest::DoRun (void)
ADD_HEADER (p, 2);
ADD_HEADER (p, 3);
REM_HEADER (p, 3);
CHECK_HISTORY (p, 3,
CHECK_HISTORY (p, 3,
2, 1, 10);
p = Create<Packet> (10);
@@ -514,7 +512,7 @@ PacketMetadataTest::DoRun (void)
ADD_HEADER (p, 3);
REM_HEADER (p, 3);
REM_HEADER (p, 2);
CHECK_HISTORY (p, 2,
CHECK_HISTORY (p, 2,
1, 10);
p = Create<Packet> (10);
@@ -535,46 +533,46 @@ PacketMetadataTest::DoRun (void)
REM_HEADER (p1, 2);
REM_HEADER (p1, 1);
CHECK_HISTORY (p1, 1, 10);
CHECK_HISTORY (p, 4,
CHECK_HISTORY (p, 4,
3, 2, 1, 10);
ADD_HEADER (p1, 1);
ADD_HEADER (p1, 2);
CHECK_HISTORY (p1, 3,
CHECK_HISTORY (p1, 3,
2, 1, 10);
CHECK_HISTORY (p, 4,
CHECK_HISTORY (p, 4,
3, 2, 1, 10);
ADD_HEADER (p, 3);
CHECK_HISTORY (p, 5,
CHECK_HISTORY (p, 5,
3, 3, 2, 1, 10);
ADD_TRAILER (p, 4);
CHECK_HISTORY (p, 6,
CHECK_HISTORY (p, 6,
3, 3, 2, 1, 10, 4);
ADD_TRAILER (p, 5);
CHECK_HISTORY (p, 7,
CHECK_HISTORY (p, 7,
3, 3, 2, 1, 10, 4, 5);
REM_HEADER (p, 3);
CHECK_HISTORY (p, 6,
CHECK_HISTORY (p, 6,
3, 2, 1, 10, 4, 5);
REM_TRAILER (p, 5);
CHECK_HISTORY (p, 5,
CHECK_HISTORY (p, 5,
3, 2, 1, 10, 4);
p1 = p->Copy ();
REM_TRAILER (p, 4);
CHECK_HISTORY (p, 4,
CHECK_HISTORY (p, 4,
3, 2, 1, 10);
CHECK_HISTORY (p1, 5,
CHECK_HISTORY (p1, 5,
3, 2, 1, 10, 4);
p1->RemoveAtStart (3);
CHECK_HISTORY (p1, 4,
CHECK_HISTORY (p1, 4,
2, 1, 10, 4);
p1->RemoveAtStart (1);
CHECK_HISTORY (p1, 4,
CHECK_HISTORY (p1, 4,
1, 1, 10, 4);
p1->RemoveAtStart (1);
CHECK_HISTORY (p1, 3,
CHECK_HISTORY (p1, 3,
1, 10, 4);
p1->RemoveAtEnd (4);
CHECK_HISTORY (p1, 2,
CHECK_HISTORY (p1, 2,
1, 10);
p1->RemoveAtStart (1);
CHECK_HISTORY (p1, 1, 10);

View File

@@ -422,11 +422,11 @@ struct Expected
// Check byte tags on a packet, checks name, start, end
#define CHECK(p, n, ...) \
DoCheck (p, __FILE__, __LINE__, n, __VA_ARGS__)
DoCheck (p, n, __VA_ARGS__)
// Check byte tags on a packet, checks name, start, end, data
#define CHECK_DATA(p, n, ...) \
DoCheckData (p, __FILE__, __LINE__, n, __VA_ARGS__)
DoCheckData (p, n, __VA_ARGS__)
/**
* \ingroup network-test
@@ -443,21 +443,17 @@ private:
/**
* Checks the packet
* \param p The packet
* \param file The file name
* \param line The line number
* \param n The number of variable arguments
* \param ... The variable arguments
*/
void DoCheck (Ptr<const Packet> p, const char *file, int line, uint32_t n, ...);
void DoCheck (Ptr<const Packet> p, uint32_t n, ...);
/**
* Checks the packet and its data
* \param p The packet
* \param file The file name
* \param line The line number
* \param n The number of variable arguments
* \param ... The variable arguments
*/
void DoCheckData (Ptr<const Packet> p, const char *file, int line, uint32_t n, ...);
void DoCheckData (Ptr<const Packet> p, uint32_t n, ...);
};
@@ -466,7 +462,7 @@ PacketTest::PacketTest ()
}
void
PacketTest::DoCheck (Ptr<const Packet> p, const char *file, int line, uint32_t n, ...)
PacketTest::DoCheck (Ptr<const Packet> p, uint32_t n, ...)
{
std::vector<struct Expected> expected;
va_list ap;
@@ -488,9 +484,9 @@ PacketTest::DoCheck (Ptr<const Packet> p, const char *file, int line, uint32_t n
struct Expected e = expected[j];
std::ostringstream oss;
oss << "anon::ATestTag<" << e.n << ">";
NS_TEST_EXPECT_MSG_EQ_INTERNAL (item.GetTypeId ().GetName (), oss.str (), "trivial", file, line);
NS_TEST_EXPECT_MSG_EQ_INTERNAL (item.GetStart (), e.start, "trivial", file, line);
NS_TEST_EXPECT_MSG_EQ_INTERNAL (item.GetEnd (), e.end, "trivial", file, line);
NS_TEST_EXPECT_MSG_EQ (item.GetTypeId ().GetName (), oss.str (), "trivial");
NS_TEST_EXPECT_MSG_EQ (item.GetStart (), e.start, "trivial");
NS_TEST_EXPECT_MSG_EQ (item.GetEnd (), e.end, "trivial");
ATestTagBase *tag = dynamic_cast<ATestTagBase *> (item.GetTypeId ().GetConstructor () ());
NS_TEST_EXPECT_MSG_NE (tag, 0, "trivial");
item.GetTag (*tag);
@@ -503,7 +499,7 @@ PacketTest::DoCheck (Ptr<const Packet> p, const char *file, int line, uint32_t n
}
void
PacketTest::DoCheckData (Ptr<const Packet> p, const char *file, int line, uint32_t n, ...)
PacketTest::DoCheckData (Ptr<const Packet> p, uint32_t n, ...)
{
std::vector<struct Expected> expected;
va_list ap;
@@ -526,9 +522,9 @@ PacketTest::DoCheckData (Ptr<const Packet> p, const char *file, int line, uint32
struct Expected e = expected[j];
std::ostringstream oss;
oss << "anon::ATestTag<" << e.n << ">";
NS_TEST_EXPECT_MSG_EQ_INTERNAL (item.GetTypeId ().GetName (), oss.str (), "trivial", file, line);
NS_TEST_EXPECT_MSG_EQ_INTERNAL (item.GetStart (), e.start, "trivial", file, line);
NS_TEST_EXPECT_MSG_EQ_INTERNAL (item.GetEnd (), e.end, "trivial", file, line);
NS_TEST_EXPECT_MSG_EQ (item.GetTypeId ().GetName (), oss.str (), "trivial");
NS_TEST_EXPECT_MSG_EQ (item.GetStart (), e.start, "trivial");
NS_TEST_EXPECT_MSG_EQ (item.GetEnd (), e.end, "trivial");
ATestTagBase *tag = dynamic_cast<ATestTagBase *> (item.GetTypeId ().GetConstructor () ());
NS_TEST_EXPECT_MSG_NE (tag, 0, "trivial");
item.GetTag (*tag);
@@ -601,7 +597,7 @@ PacketTest::DoRun (void)
CHECK (frag0, 3, E (1, 0, 10), E (2, 0, 10), E (3, 0, 10));
frag0->AddAtEnd (frag1);
CHECK (frag0, 9,
CHECK (frag0, 9,
E (1, 0, 10), E (2, 0, 10), E (3, 0, 10),
E (1, 10, 100), E (2, 10, 100), E (4, 10, 100),
E (1, 100, 1000), E (2, 100, 1000), E (5, 100, 1000));
@@ -724,7 +720,7 @@ PacketTest::DoRun (void)
p1->Serialize (buffer, serializedSize);
Ptr<Packet> p2 = Create<Packet> (buffer, serializedSize, true);
delete [] buffer;
ATestTag<10> a2;
@@ -758,9 +754,9 @@ PacketTest::DoRun (void)
p1->Serialize (buffer, serializedSize);
Ptr<Packet> p2 = Create<Packet> (buffer, serializedSize, true);
delete [] buffer;
CHECK_DATA (p2, 3, E_DATA (10, 0, 1000, 65), E_DATA (11, 0, 1000, 66), E_DATA (12, 0, 1000, 67));
}
@@ -858,7 +854,7 @@ PacketTest::DoRun (void)
{
Ptr<Packet> tmp = Create<Packet> (0);
ALargeTestTag a;
tmp->AddPacketTag (a);
tmp->AddPacketTag (a);
}
}
@@ -953,9 +949,9 @@ PacketTagListTest::CheckRef (const PacketTagList & ref,
ATestTag<7> t7 (1); \
const int tagLast = 7; /* length of ref PacketTagList */ \
NS_UNUSED (tagLast) /* silence warnings */
void
PacketTagListTest::CheckRefList (const PacketTagList & ptl,
const char * msg,
@@ -970,7 +966,7 @@ PacketTagListTest::CheckRefList (const PacketTagList & ptl,
CheckRef (ptl, t6, msg, miss == 6);
CheckRef (ptl, t7, msg, miss == 7);
}
int
PacketTagListTest::RemoveTime (const PacketTagList & ref,
ATestTagBase & t,
@@ -1021,7 +1017,7 @@ PacketTagListTest::DoRun (void)
std::cout << GetName () << "begin" << std::endl;
MAKE_TEST_TAGS ;
PacketTagList ref; // empty list
ref.Add (t1); // last
ref.Add (t2); // post merge
@@ -1030,7 +1026,7 @@ PacketTagListTest::DoRun (void)
ref.Add (t5); // merge precursor
ref.Add (t6); // pre-merge
ref.Add (t7); // first
{ // Peek
std::cout << GetName () << "check Peek (missing tag) returns false"
<< std::endl;
@@ -1049,7 +1045,7 @@ PacketTagListTest::DoRun (void)
CheckRefList (ptl, "assignment copy");
}
}
{ // Removal
# define RemoveCheck(n) \
{ PacketTagList p ## n = ref; \
@@ -1057,7 +1053,7 @@ PacketTagListTest::DoRun (void)
CheckRefList (ref, "remove " #n " orig"); \
CheckRefList (p ## n, "remove " #n " copy", n); \
}
{ // Remove single tags from list
std::cout << GetName () << "check removal of each tag" << std::endl;
RemoveCheck (1);
@@ -1068,7 +1064,7 @@ PacketTagListTest::DoRun (void)
RemoveCheck (6);
RemoveCheck (7);
}
{ // Remove in the presence of a merge
std::cout << GetName () << "check removal doesn't disturb merge "
<< std::endl;
@@ -1076,7 +1072,7 @@ PacketTagListTest::DoRun (void)
ptl.Remove (t7);
ptl.Remove (t6);
ptl.Remove (t5);
PacketTagList mrg = ptl; // merged list
ATestTag<8> m5 (1);
mrg.Add (m5); // ptl and mrg differ
@@ -1099,7 +1095,7 @@ PacketTagListTest::DoRun (void)
{ // Replace
std::cout << GetName () << "check replacing each tag" << std::endl;
# define ReplaceCheck(n) \
t ## n .m_data = 2; \
{ PacketTagList p ## n = ref; \
@@ -1107,7 +1103,7 @@ PacketTagListTest::DoRun (void)
CheckRefList (ref, "replace " #n " orig"); \
CheckRef (p ## n, t ## n, "replace " #n " copy"); \
}
ReplaceCheck (1);
ReplaceCheck (2);
ReplaceCheck (3);
@@ -1116,7 +1112,7 @@ PacketTagListTest::DoRun (void)
ReplaceCheck (6);
ReplaceCheck (7);
}
{ // Timing
std::cout << GetName () << "add+remove timing" << std::endl;
int flm = std::numeric_limits<int>::max ();
@@ -1128,7 +1124,7 @@ PacketTagListTest::DoRun (void)
std::cout << GetName () << "min add+remove time: "
<< std::setw (8) << flm << " ticks"
<< std::endl;
std::cout << GetName () << "remove timing" << std::endl;
// tags numbered from 1, so add one for (unused) entry at 0
std::vector <int> rmn (tagLast + 1, std::numeric_limits<int>::max ());
@@ -1144,7 +1140,7 @@ PacketTagListTest::DoRun (void)
case 2: now = RemoveTime (ref, t2); break;
case 1: now = RemoveTime (ref, t1); break;
} // switch
if (now < rmn[j]) rmn[j] = now;
} // for tag j
} // for iteration i
@@ -1155,7 +1151,7 @@ PacketTagListTest::DoRun (void)
<< std::endl;
}
} // Timing
}
/**