24 #include <ns3/spectrum-value.h>
48 #define NS_TEST_ASSERT_MSG_SPECTRUM_MODEL_EQ_TOL(actual, expected, tol, msg) \
51 Bands::const_iterator i = (actual).Begin (); \
52 Bands::const_iterator j = (expected).Begin (); \
54 while (i != (actual).End () && j != (expected).End ()) \
56 if ((i->fl > j->fl + (tol)) || (i->fl < j->fl - (tol)) \
57 || (i->fc > j->fc + (tol)) || (i->fc < j->fc - (tol)) \
58 || (i->fh > j->fh + (tol)) || (i->fh < j->fh - (tol))) \
61 std::ostringstream indexStream; \
62 indexStream << "[" << k << "]"; \
63 std::ostringstream msgStream; \
65 std::ostringstream actualStream; \
66 actualStream << i->fl << " <-- " << i->fc << " --> " << i->fh; \
67 std::ostringstream expectedStream; \
68 expectedStream << j->fl << " <-- " << j->fc << " --> " << j->fh; \
69 ReportTestFailure (std::string (# actual) + indexStream.str () + " == " + std::string (# expected) + indexStream.str (), \
70 actualStream.str (), expectedStream.str (), msgStream.str (), ( __FILE__), ( __LINE__)); \
71 CONTINUE_ON_FAILURE; \
77 if (i != (actual).End () || j != (expected).End ()) \
79 std::ostringstream msgStream; \
81 std::ostringstream actualStream; \
82 actualStream << (i != (actual).End ()); \
83 std::ostringstream expectedStream; \
84 expectedStream << (j != (expected).End ()); \
85 ReportTestFailure ("Bands::iterator == End ()", \
86 actualStream.str (), expectedStream.str (), msgStream.str (), ( __FILE__), ( __LINE__)); \
107 #define NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(actual, expected, tol, msg) \
110 Values::const_iterator i = (actual).ConstValuesBegin (); \
111 Values::const_iterator j = (expected).ConstValuesBegin (); \
113 while (i != (actual).ConstValuesEnd () && j != (expected).ConstValuesEnd ()) \
115 if ((*i) > (*j) + (tol) || (*i) < (*j) - (tol)) \
118 std::ostringstream indexStream; \
119 indexStream << "[" << k << "]"; \
120 std::ostringstream msgStream; \
122 std::ostringstream actualStream; \
123 actualStream << actual; \
124 std::ostringstream expectedStream; \
125 expectedStream << expected; \
126 ReportTestFailure (std::string (# actual) + indexStream.str () + " == " + std::string (# expected) + indexStream.str (), \
127 actualStream.str (), expectedStream.str (), msgStream.str (), __FILE__, __LINE__); \
128 CONTINUE_ON_FAILURE; \
134 if (i != (actual).ConstValuesEnd () || j != (expected).ConstValuesEnd ()) \
136 std::ostringstream msgStream; \
137 msgStream << (msg); \
138 std::ostringstream actualStream; \
139 actualStream << (i != (actual).ConstValuesEnd ()); \
140 std::ostringstream expectedStream; \
141 expectedStream << (j != (expected).ConstValuesEnd ()); \
142 ReportTestFailure ("Values::const_iterator == ConstValuesEnd ()", \
143 actualStream.str (), expectedStream.str (), msgStream.str (), ( __FILE__), ( __LINE__)); \