10#include "ns3/object.h"
11#include "ns3/spectrum-converter.h"
12#include "ns3/spectrum-test.h"
13#include "ns3/spectrum-value.h"
43 const std::string& name,
44 bool expectOrthogonal,
46 void DoRun()
override;
57 const std::string& name,
58 bool expectOrthogonal,
74 (
m_expectOrthogonal ?
"Expected orthogonal models" :
"Expected non-orthogonal models"));
78 (
m_expectAligned ?
"Expected aligned models" :
"Expected non-aligned models"));
97 void DoRun()
override;
134 *
m_b.GetSpectrumModel(),
156 std::vector<double> freqs;
158 for (
int i = 1; i <= 5; i++)
178 doubleValue = 1.12345600000000;
180 v1[0] = 0.700539792840;
181 v1[1] = -0.554277600423;
182 v1[2] = 0.750309319469;
183 v1[3] = -0.892299213192;
184 v1[4] = 0.987045234885;
186 v2[0] = 0.870441628737;
187 v2[1] = 0.271419263880;
188 v2[2] = 0.451557288312;
189 v2[3] = 0.968992859395;
190 v2[4] = -0.929186654705;
192 v3[0] = 1.570981421577;
193 v3[1] = -0.282858336543;
194 v3[2] = 1.201866607781;
195 v3[3] = 0.076693646203;
196 v3[4] = 0.057858580180;
198 v4[0] = -0.169901835897;
199 v4[1] = -0.825696864302;
200 v4[2] = 0.298752031158;
201 v4[3] = -1.861292072588;
202 v4[4] = 1.916231889590;
204 v5[0] = 0.609778998275;
205 v5[1] = -0.150441618292;
206 v5[2] = 0.338807641695;
207 v5[3] = -0.864631566028;
208 v5[4] = -0.917149259846;
210 v6[0] = 0.804809615846;
211 v6[1] = -2.042145397125;
212 v6[2] = 1.661603829438;
213 v6[3] = -0.920852207053;
214 v6[4] = -1.062267984465;
216 v7[0] = 1.823995792840;
217 v7[1] = 0.569178399577;
218 v7[2] = 1.873765319469;
219 v7[3] = 0.231156786808;
220 v7[4] = 2.110501234885;
222 v8[0] = -0.422916207160;
223 v8[1] = -1.677733600423;
224 v8[2] = -0.373146680531;
225 v8[3] = -2.015755213192;
226 v8[4] = -0.136410765115;
228 v9[0] = 0.787025633505;
229 v9[1] = -0.622706495860;
230 v9[2] = 0.842939506814;
231 v9[3] = -1.002458904856;
232 v9[4] = 1.108901891403;
234 v10[0] = 0.623557836569;
235 v10[1] = -0.493368320987;
236 v10[2] = 0.667858215604;
237 v10[3] = -0.794244913190;
238 v10[4] = 0.878579343459;
277 tv7a = v1 + doubleValue;
278 tv8a = v1 - doubleValue;
279 tv9a = v1 * doubleValue;
280 tv10a = v1 / doubleValue;
294 tv7b = doubleValue + v1;
295 tv8b = doubleValue - v1;
296 tv9b = doubleValue * v1;
297 tv10b = doubleValue / v1;
341 std::vector<double> f1;
342 for (f = 3; f <= 7; f += 2)
348 std::vector<double> f2;
349 for (f = 2; f <= 8; f += 1)
392 t21b[0] = 3 * 0.25 + 5 * 0.5 + 1 * 0.25;
393 t21b[1] = 1 * 0.25 + 2 * 0.5 + 4 * 0.25;
394 t21b[2] = 4 * 0.25 + 6 * 0.5 + 3 * 0.25;
401 std::vector<double> f3{10, 11, 12, 13, 14};
416 std::vector<double> f4{3, 4, 5, 6, 7};
420 "Check sof1 and sof4 are not orthogonal nor aligned",
437 "Check spectrum conversion with non-orthogonal and non-aligned models"),
441 std::vector<double> f5{5, 7, 9};
cairo_uint64_t x
_cairo_uint_96by64_32x64_divrem:
Spectrum Converter TestSuite.
SpectrumConverterTestSuite()
Ptr< SpectrumModel > m_a
first SpectrumModel
bool m_expectAligned
whether the two models are expected to be aligned
void DoRun() override
Implementation to actually run this TestCase.
bool m_expectOrthogonal
whether the two models are expected to be orthogonal
Ptr< SpectrumModel > m_b
second SpectrumModel
SpectrumModelTestCase(Ptr< SpectrumModel > a, Ptr< SpectrumModel > b, const std::string &name, bool expectOrthogonal, bool expectAligned)
Constructor.
bool MoreOrLessEqual(SpectrumValue x, SpectrumValue y)
Check that two SpectrumValue are equal within a tolerance.
SpectrumValue m_b
second SpectrumValue
~SpectrumValueTestCase() override
SpectrumValue m_a
first SpectrumValue
SpectrumValueTestCase(SpectrumValue a, SpectrumValue b, std::string name)
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
Spectrum Value TestSuite.
Smart pointer class similar to boost::intrusive_ptr.
Class which implements a converter between SpectrumValue which are defined over different SpectrumMod...
Ptr< SpectrumValue > Convert(Ptr< const SpectrumValue > vvf) const
Convert a particular ValueVsFreq instance to.
Set of values corresponding to a given SpectrumModel.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#define NS_TEST_ASSERT_MSG_SPECTRUM_MODEL_EQ_TOL(actual, expected, tol, msg)
Test if two SpectrumModel instances are equal within a given tolerance.
#define NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(actual, expected, tol, msg)
Test if two SpectrumValue instances are equal within a given tolerance.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double Norm(const SpectrumValue &x)
static SpectrumConverterTestSuite g_SpectrumConverterTestSuite
Static variable for test initialization.
static SpectrumValueTestSuite g_SpectrumValueTestSuite
Static variable for test initialization.