22 #include <ns3/spectrum-value.h>
45 #define NS_TEST_ASSERT_MSG_SPECTRUM_MODEL_EQ_TOL(actual, expected, tol, msg) \
48 Bands::const_iterator i = (actual).Begin(); \
49 Bands::const_iterator j = (expected).Begin(); \
51 while (i != (actual).End() && j != (expected).End()) \
53 if ((i->fl > j->fl + (tol)) || (i->fl < j->fl - (tol)) || (i->fc > j->fc + (tol)) || \
54 (i->fc < j->fc - (tol)) || (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() + \
66 " == " + std::string(#expected) + indexStream.str(), \
68 expectedStream.str(), \
72 CONTINUE_ON_FAILURE; \
78 if (i != (actual).End() || j != (expected).End()) \
80 std::ostringstream msgStream; \
82 std::ostringstream actualStream; \
83 actualStream << (i != (actual).End()); \
84 std::ostringstream expectedStream; \
85 expectedStream << (j != (expected).End()); \
86 ReportTestFailure("Bands::iterator == End ()", \
88 expectedStream.str(), \
110 #define NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(actual, expected, tol, msg) \
113 Values::const_iterator i = (actual).ConstValuesBegin(); \
114 Values::const_iterator j = (expected).ConstValuesBegin(); \
116 while (i != (actual).ConstValuesEnd() && j != (expected).ConstValuesEnd()) \
118 if ((*i) > (*j) + (tol) || (*i) < (*j) - (tol)) \
121 std::ostringstream indexStream; \
122 indexStream << "[" << k << "]"; \
123 std::ostringstream msgStream; \
125 std::ostringstream actualStream; \
126 actualStream << actual; \
127 std::ostringstream expectedStream; \
128 expectedStream << expected; \
129 ReportTestFailure(std::string(#actual) + indexStream.str() + \
130 " == " + std::string(#expected) + indexStream.str(), \
131 actualStream.str(), \
132 expectedStream.str(), \
136 CONTINUE_ON_FAILURE; \
142 if (i != (actual).ConstValuesEnd() || j != (expected).ConstValuesEnd()) \
144 std::ostringstream msgStream; \
145 msgStream << (msg); \
146 std::ostringstream actualStream; \
147 actualStream << (i != (actual).ConstValuesEnd()); \
148 std::ostringstream expectedStream; \
149 expectedStream << (j != (expected).ConstValuesEnd()); \
150 ReportTestFailure("Values::const_iterator == ConstValuesEnd ()", \
151 actualStream.str(), \
152 expectedStream.str(), \