24 #include <ns3/spectrum-value.h>
40 #define NS_TEST_ASSERT_MSG_SPECTRUM_MODEL_EQ_TOL(actual, expected, tol, msg) \
41 NS_TEST_ASSERT_MSG_SPECTRUM_MODEL_EQ_TOL_INTERNAL (actual, expected, tol, msg, __FILE__, __LINE__)
44 #define NS_TEST_ASSERT_MSG_SPECTRUM_MODEL_EQ_TOL_INTERNAL(actual, expected, tol, msg, file, line) \
47 Bands::const_iterator i = (actual).Begin (); \
48 Bands::const_iterator j = (expected).Begin (); \
50 while (i != (actual).End () && j != (expected).End ()) \
52 if ((i->fl > j->fl + (tol)) || (i->fl < j->fl - (tol)) \
53 || (i->fc > j->fc + (tol)) || (i->fc < j->fc - (tol)) \
54 || (i->fh > j->fh + (tol)) || (i->fh < j->fh - (tol))) \
57 std::ostringstream indexStream; \
58 indexStream << "[" << k << "]"; \
59 std::ostringstream msgStream; \
61 std::ostringstream actualStream; \
62 actualStream << i->fl << " <-- " << i->fc << " --> " << i->fh; \
63 std::ostringstream expectedStream; \
64 expectedStream << j->fl << " <-- " << j->fc << " --> " << j->fh; \
65 ReportTestFailure (std::string (# actual) + indexStream.str () + " == " + std::string (# expected) + indexStream.str (), \
66 actualStream.str (), expectedStream.str (), msgStream.str (), (file), (line)); \
67 CONTINUE_ON_FAILURE; \
73 if (i != (actual).End () || j != (expected).End ()) \
75 std::ostringstream msgStream; \
77 std::ostringstream actualStream; \
78 actualStream << (i != (actual).End ()); \
79 std::ostringstream expectedStream; \
80 expectedStream << (j != (expected).End ()); \
81 ReportTestFailure ("Bands::iterator == End ()", \
82 actualStream.str (), expectedStream.str (), msgStream.str (), (file), (line)); \
101 #define NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(actual, expected, tol, msg) \
102 NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL_INTERNAL (actual, expected, tol, msg, __FILE__, __LINE__)
105 #define NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL_INTERNAL(actual, expected, tol, msg, file, line) \
108 Values::const_iterator i = (actual).ConstValuesBegin (); \
109 Values::const_iterator j = (expected).ConstValuesBegin (); \
111 while (i != (actual).ConstValuesEnd () && j != (expected).ConstValuesEnd ()) \
113 if ((*i) > (*j) + (tol) || (*i) < (*j) - (tol)) \
116 std::ostringstream indexStream; \
117 indexStream << "[" << k << "]"; \
118 std::ostringstream msgStream; \
120 std::ostringstream actualStream; \
121 actualStream << actual; \
122 std::ostringstream expectedStream; \
123 expectedStream << expected; \
124 ReportTestFailure (std::string (# actual) + indexStream.str () + " == " + std::string (# expected) + indexStream.str (), \
125 actualStream.str (), expectedStream.str (), msgStream.str (), file, line); \
126 CONTINUE_ON_FAILURE; \
132 if (i != (actual).ConstValuesEnd () || j != (expected).ConstValuesEnd ()) \
134 std::ostringstream msgStream; \
135 msgStream << (msg); \
136 std::ostringstream actualStream; \
137 actualStream << (i != (actual).ConstValuesEnd ()); \
138 std::ostringstream expectedStream; \
139 expectedStream << (j != (expected).ConstValuesEnd ()); \
140 ReportTestFailure ("Values::const_iterator == ConstValuesEnd ()", \
141 actualStream.str (), expectedStream.str (), msgStream.str (), (file), (line)); \