OLD | NEW |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) | 3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 #include "ns3/test.h" | 23 #include "ns3/test.h" |
24 #include "ns3/log.h" | 24 #include "ns3/log.h" |
25 | 25 |
26 #include "ns3/lte-spectrum-value-helper.h" | 26 #include "ns3/lte-spectrum-value-helper.h" |
27 | 27 |
28 using namespace ns3; | 28 using namespace ns3; |
29 | 29 |
30 NS_LOG_COMPONENT_DEFINE ("LteTestEarfcn"); | 30 NS_LOG_COMPONENT_DEFINE ("LteTestEarfcn"); |
31 | 31 |
| 32 /** |
| 33 * \ingroup lte-test |
| 34 * \ingroup tests |
| 35 * |
| 36 * \brief Lte Earfcn Test Case· |
| 37 */ |
| 38 |
32 class LteEarfcnTestCase : public TestCase | 39 class LteEarfcnTestCase : public TestCase |
33 { | 40 { |
34 public: | 41 public: |
| 42 /** |
| 43 * Constructor |
| 44 * |
| 45 * \param str referene name |
| 46 * \param earfcn EARFCN |
| 47 * \param f frequency |
| 48 */ |
35 LteEarfcnTestCase (const char* str, uint16_t earfcn, double f); | 49 LteEarfcnTestCase (const char* str, uint16_t earfcn, double f); |
36 virtual ~LteEarfcnTestCase (); | 50 virtual ~LteEarfcnTestCase (); |
37 | 51 |
38 protected: | 52 protected: |
39 uint16_t m_earfcn; | 53 uint16_t m_earfcn; ///< the EARFCN |
40 double m_f; | 54 double m_f; ///< the frequency |
41 | 55 |
42 private: | 56 private: |
43 virtual void DoRun (void); | 57 virtual void DoRun (void); |
44 }; | 58 }; |
45 | 59 |
46 LteEarfcnTestCase::LteEarfcnTestCase (const char* str, uint16_t earfcn, double f
) | 60 LteEarfcnTestCase::LteEarfcnTestCase (const char* str, uint16_t earfcn, double f
) |
47 : TestCase (str), | 61 : TestCase (str), |
48 m_earfcn (earfcn), | 62 m_earfcn (earfcn), |
49 m_f (f) | 63 m_f (f) |
50 { | 64 { |
51 NS_LOG_FUNCTION (this << str << earfcn << f); | 65 NS_LOG_FUNCTION (this << str << earfcn << f); |
52 } | 66 } |
53 | 67 |
54 LteEarfcnTestCase::~LteEarfcnTestCase () | 68 LteEarfcnTestCase::~LteEarfcnTestCase () |
55 { | 69 { |
56 } | 70 } |
57 | 71 |
58 void· | 72 void· |
59 LteEarfcnTestCase::DoRun (void) | 73 LteEarfcnTestCase::DoRun (void) |
60 { | 74 { |
61 double f = LteSpectrumValueHelper::GetCarrierFrequency (m_earfcn); | 75 double f = LteSpectrumValueHelper::GetCarrierFrequency (m_earfcn); |
62 NS_TEST_ASSERT_MSG_EQ_TOL (f, m_f, 0.0000001, "wrong frequency"); | 76 NS_TEST_ASSERT_MSG_EQ_TOL (f, m_f, 0.0000001, "wrong frequency"); |
63 } | 77 } |
64 | 78 |
| 79 /** |
| 80 * \ingroup lte-test |
| 81 * \ingroup tests |
| 82 * |
| 83 * \brief Lte Earfcn DL Test Case· |
| 84 */ |
| 85 |
65 class LteEarfcnDlTestCase : public LteEarfcnTestCase | 86 class LteEarfcnDlTestCase : public LteEarfcnTestCase |
66 { | 87 { |
67 public: | 88 public: |
| 89 /** |
| 90 * Constructor |
| 91 * |
| 92 * \param str referene name |
| 93 * \param earfcn EARFCN |
| 94 * \param f frequency |
| 95 */ |
68 LteEarfcnDlTestCase (const char* str, uint16_t earfcn, double f); | 96 LteEarfcnDlTestCase (const char* str, uint16_t earfcn, double f); |
69 | 97 |
70 private: | 98 private: |
71 virtual void DoRun (void); | 99 virtual void DoRun (void); |
72 }; | 100 }; |
73 | 101 |
74 LteEarfcnDlTestCase::LteEarfcnDlTestCase (const char* str, uint16_t earfcn, doub
le f) | 102 LteEarfcnDlTestCase::LteEarfcnDlTestCase (const char* str, uint16_t earfcn, doub
le f) |
75 : LteEarfcnTestCase (str, earfcn, f) | 103 : LteEarfcnTestCase (str, earfcn, f) |
76 { | 104 { |
77 } | 105 } |
78 | 106 |
79 void· | 107 void· |
80 LteEarfcnDlTestCase::DoRun (void) | 108 LteEarfcnDlTestCase::DoRun (void) |
81 { | 109 { |
82 // LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVE
L_ALL); | 110 // LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVE
L_ALL); |
83 // LogComponentEnable ("LteSpectrumValueHelper", logLevel); | 111 // LogComponentEnable ("LteSpectrumValueHelper", logLevel); |
84 // LogComponentEnable ("LteTestEarfcn", logLevel); | 112 // LogComponentEnable ("LteTestEarfcn", logLevel); |
85 | 113 |
86 double f = LteSpectrumValueHelper::GetDownlinkCarrierFrequency (m_earfcn); | 114 double f = LteSpectrumValueHelper::GetDownlinkCarrierFrequency (m_earfcn); |
87 NS_TEST_ASSERT_MSG_EQ_TOL (f, m_f, 0.0000001, "wrong frequency"); | 115 NS_TEST_ASSERT_MSG_EQ_TOL (f, m_f, 0.0000001, "wrong frequency"); |
88 } | 116 } |
89 | 117 |
90 | 118 |
| 119 /** |
| 120 * \ingroup lte-test |
| 121 * \ingroup tests |
| 122 * |
| 123 * \brief Lte Earfcn UL Test Case· |
| 124 */ |
| 125 |
91 class LteEarfcnUlTestCase : public LteEarfcnTestCase | 126 class LteEarfcnUlTestCase : public LteEarfcnTestCase |
92 { | 127 { |
93 public: | 128 public: |
| 129 /** |
| 130 * Constructor |
| 131 * |
| 132 * \param str referene name |
| 133 * \param earfcn EARFCN |
| 134 * \param f frequency |
| 135 */ |
94 LteEarfcnUlTestCase (const char* str, uint16_t earfcn, double f); | 136 LteEarfcnUlTestCase (const char* str, uint16_t earfcn, double f); |
95 | 137 |
96 private: | 138 private: |
97 virtual void DoRun (void); | 139 virtual void DoRun (void); |
98 }; | 140 }; |
99 | 141 |
100 LteEarfcnUlTestCase::LteEarfcnUlTestCase (const char* str, uint16_t earfcn, doub
le f) | 142 LteEarfcnUlTestCase::LteEarfcnUlTestCase (const char* str, uint16_t earfcn, doub
le f) |
101 : LteEarfcnTestCase (str, earfcn, f) | 143 : LteEarfcnTestCase (str, earfcn, f) |
102 { | 144 { |
103 } | 145 } |
104 | 146 |
105 void· | 147 void· |
106 LteEarfcnUlTestCase::DoRun (void) | 148 LteEarfcnUlTestCase::DoRun (void) |
107 { | 149 { |
108 double f = LteSpectrumValueHelper::GetUplinkCarrierFrequency (m_earfcn); | 150 double f = LteSpectrumValueHelper::GetUplinkCarrierFrequency (m_earfcn); |
109 NS_TEST_ASSERT_MSG_EQ_TOL (f, m_f, 0.0000001, "wrong frequency"); | 151 NS_TEST_ASSERT_MSG_EQ_TOL (f, m_f, 0.0000001, "wrong frequency"); |
110 } | 152 } |
111 | 153 |
112 | 154 |
113 /** | 155 /** |
114 * Test the calculation of carrier frequency based on EARFCN | 156 * \ingroup lte-test |
| 157 * \ingroup tests |
| 158 * |
| 159 * \brief Test the calculation of carrier frequency based on EARFCN |
115 */ | 160 */ |
116 class LteEarfcnTestSuite : public TestSuite | 161 class LteEarfcnTestSuite : public TestSuite |
117 { | 162 { |
118 public: | 163 public: |
119 LteEarfcnTestSuite (); | 164 LteEarfcnTestSuite (); |
120 }; | 165 }; |
121 | 166 |
122 static LteEarfcnTestSuite g_lteEarfcnTestSuite; | 167 static LteEarfcnTestSuite g_lteEarfcnTestSuite; |
123 | 168 |
124 LteEarfcnTestSuite::LteEarfcnTestSuite () | 169 LteEarfcnTestSuite::LteEarfcnTestSuite () |
(...skipping 18 matching lines...) Expand all Loading... |
143 AddTestCase (new LteEarfcnTestCase ("EARFCN=500", 500, 2160e6), TestCase::QUIC
K); | 188 AddTestCase (new LteEarfcnTestCase ("EARFCN=500", 500, 2160e6), TestCase::QUIC
K); |
144 AddTestCase (new LteEarfcnTestCase ("EARFCN=1000", 1000, 1970e6), TestCase::QU
ICK); | 189 AddTestCase (new LteEarfcnTestCase ("EARFCN=1000", 1000, 1970e6), TestCase::QU
ICK); |
145 AddTestCase (new LteEarfcnTestCase ("EARFCN=1301", 1301, 1815.1e6), TestCase::
QUICK); | 190 AddTestCase (new LteEarfcnTestCase ("EARFCN=1301", 1301, 1815.1e6), TestCase::
QUICK); |
146 AddTestCase (new LteEarfcnTestCase ("EARFCN=8000", 8000, 0.0), TestCase::QUICK
); | 191 AddTestCase (new LteEarfcnTestCase ("EARFCN=8000", 8000, 0.0), TestCase::QUICK
); |
147 AddTestCase (new LteEarfcnTestCase ("EARFCN=50000", 50000, 0.0), TestCase::QUI
CK); | 192 AddTestCase (new LteEarfcnTestCase ("EARFCN=50000", 50000, 0.0), TestCase::QUI
CK); |
148 AddTestCase (new LteEarfcnTestCase ("EARFCN=18100", 18100, 1930e6), TestCase::
QUICK); | 193 AddTestCase (new LteEarfcnTestCase ("EARFCN=18100", 18100, 1930e6), TestCase::
QUICK); |
149 AddTestCase (new LteEarfcnTestCase ("EARFCN=19000", 19000, 1890e6), TestCase::
QUICK); | 194 AddTestCase (new LteEarfcnTestCase ("EARFCN=19000", 19000, 1890e6), TestCase::
QUICK); |
150 AddTestCase (new LteEarfcnTestCase ("EARFCN=19400", 19400, 1730e6), TestCase::
QUICK); | 195 AddTestCase (new LteEarfcnTestCase ("EARFCN=19400", 19400, 1730e6), TestCase::
QUICK); |
151 AddTestCase (new LteEarfcnTestCase ("EARFCN=50000", 50000, 0.0), TestCase::QUI
CK); | 196 AddTestCase (new LteEarfcnTestCase ("EARFCN=50000", 50000, 0.0), TestCase::QUI
CK); |
152 } | 197 } |
OLD | NEW |