A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
lte-test-earfcn.cc
Go to the documentation of this file.
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4
*
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
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Nicola Baldo <nbaldo@cttc.es>
19
*/
20
21
22
23
#include "ns3/test.h"
24
#include "ns3/log.h"
25
26
#include "ns3/lte-spectrum-value-helper.h"
27
28
NS_LOG_COMPONENT_DEFINE
(
"LteTestEarfcn"
);
29
30
namespace
ns3 {
31
32
class
LteEarfcnTestCase
:
public
TestCase
33
{
34
public
:
35
LteEarfcnTestCase
(
const
char
* str, uint16_t earfcn,
double
f);
36
virtual
~LteEarfcnTestCase
();
37
38
protected
:
39
uint16_t
m_earfcn
;
40
double
m_f
;
41
42
private
:
43
virtual
void
DoRun
(
void
);
44
};
45
46
LteEarfcnTestCase::LteEarfcnTestCase
(
const
char
* str, uint16_t earfcn,
double
f)
47
:
TestCase
(str),
48
m_earfcn (earfcn),
49
m_f (f)
50
{
51
NS_LOG_FUNCTION
(
this
<< str << earfcn << f);
52
}
53
54
LteEarfcnTestCase::~LteEarfcnTestCase
()
55
{
56
}
57
58
void
59
LteEarfcnTestCase::DoRun
(
void
)
60
{
61
double
f =
LteSpectrumValueHelper::GetCarrierFrequency
(
m_earfcn
);
62
NS_TEST_ASSERT_MSG_EQ_TOL
(f,
m_f
, 0.0000001,
"wrong frequency"
);
63
}
64
65
class
LteEarfcnDlTestCase
:
public
LteEarfcnTestCase
66
{
67
public
:
68
LteEarfcnDlTestCase
(
const
char
* str, uint16_t earfcn,
double
f);
69
70
private
:
71
virtual
void
DoRun
(
void
);
72
};
73
74
LteEarfcnDlTestCase::LteEarfcnDlTestCase
(
const
char
* str, uint16_t earfcn,
double
f)
75
:
LteEarfcnTestCase
(str, earfcn, f)
76
{
77
}
78
79
void
80
LteEarfcnDlTestCase::DoRun
(
void
)
81
{
82
// LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
83
// LogComponentEnable ("LteSpectrumValueHelper", logLevel);
84
// LogComponentEnable ("LteTestEarfcn", logLevel);
85
86
double
f =
LteSpectrumValueHelper::GetDownlinkCarrierFrequency
(
m_earfcn
);
87
NS_TEST_ASSERT_MSG_EQ_TOL
(f,
m_f
, 0.0000001,
"wrong frequency"
);
88
}
89
90
91
class
LteEarfcnUlTestCase
:
public
LteEarfcnTestCase
92
{
93
public
:
94
LteEarfcnUlTestCase
(
const
char
* str, uint16_t earfcn,
double
f);
95
96
private
:
97
virtual
void
DoRun
(
void
);
98
};
99
100
LteEarfcnUlTestCase::LteEarfcnUlTestCase
(
const
char
* str, uint16_t earfcn,
double
f)
101
:
LteEarfcnTestCase
(str, earfcn, f)
102
{
103
}
104
105
void
106
LteEarfcnUlTestCase::DoRun
(
void
)
107
{
108
double
f =
LteSpectrumValueHelper::GetUplinkCarrierFrequency
(
m_earfcn
);
109
NS_TEST_ASSERT_MSG_EQ_TOL
(f,
m_f
, 0.0000001,
"wrong frequency"
);
110
}
111
112
116
class
LteEarfcnTestSuite
:
public
TestSuite
117
{
118
public
:
119
LteEarfcnTestSuite
();
120
};
121
122
static
LteEarfcnTestSuite
g_lteEarfcnTestSuite
;
123
124
LteEarfcnTestSuite::LteEarfcnTestSuite
()
125
:
TestSuite
(
"lte-earfcn"
, UNIT)
126
{
127
NS_LOG_FUNCTION
(
this
);
128
129
AddTestCase
(
new
LteEarfcnDlTestCase
(
"DL EARFCN=500"
, 500, 2160e6),
TestCase::QUICK
);
130
AddTestCase
(
new
LteEarfcnDlTestCase
(
"DL EARFCN=1000"
, 1000, 1970e6),
TestCase::QUICK
);
131
AddTestCase
(
new
LteEarfcnDlTestCase
(
"DL EARFCN=1301"
, 1301, 1815.1e6),
TestCase::QUICK
);
132
AddTestCase
(
new
LteEarfcnDlTestCase
(
"DL EARFCN=7000"
, 7000, 0.0),
TestCase::QUICK
);
133
AddTestCase
(
new
LteEarfcnDlTestCase
(
"DL EARFCN=20000"
, 20000, 0.0),
TestCase::QUICK
);
134
AddTestCase
(
new
LteEarfcnDlTestCase
(
"DL EARFCN=50000"
, 50000, 0.0),
TestCase::QUICK
);
135
136
AddTestCase
(
new
LteEarfcnUlTestCase
(
"UL EARFCN=18100"
, 18100, 1930e6),
TestCase::QUICK
);
137
AddTestCase
(
new
LteEarfcnUlTestCase
(
"UL EARFCN=19000"
, 19000, 1890e6),
TestCase::QUICK
);
138
AddTestCase
(
new
LteEarfcnUlTestCase
(
"UL EARFCN=19400"
, 19400, 1730e6),
TestCase::QUICK
);
139
AddTestCase
(
new
LteEarfcnUlTestCase
(
"UL EARFCN=10"
, 10, 0.0),
TestCase::QUICK
);
140
AddTestCase
(
new
LteEarfcnUlTestCase
(
"UL EARFCN=1000"
, 1000, 0.0),
TestCase::QUICK
);
141
AddTestCase
(
new
LteEarfcnUlTestCase
(
"UL EARFCN=50000"
, 50000, 0.0),
TestCase::QUICK
);
142
143
AddTestCase
(
new
LteEarfcnTestCase
(
"EARFCN=500"
, 500, 2160e6),
TestCase::QUICK
);
144
AddTestCase
(
new
LteEarfcnTestCase
(
"EARFCN=1000"
, 1000, 1970e6),
TestCase::QUICK
);
145
AddTestCase
(
new
LteEarfcnTestCase
(
"EARFCN=1301"
, 1301, 1815.1e6),
TestCase::QUICK
);
146
AddTestCase
(
new
LteEarfcnTestCase
(
"EARFCN=8000"
, 8000, 0.0),
TestCase::QUICK
);
147
AddTestCase
(
new
LteEarfcnTestCase
(
"EARFCN=50000"
, 50000, 0.0),
TestCase::QUICK
);
148
AddTestCase
(
new
LteEarfcnTestCase
(
"EARFCN=18100"
, 18100, 1930e6),
TestCase::QUICK
);
149
AddTestCase
(
new
LteEarfcnTestCase
(
"EARFCN=19000"
, 19000, 1890e6),
TestCase::QUICK
);
150
AddTestCase
(
new
LteEarfcnTestCase
(
"EARFCN=19400"
, 19400, 1730e6),
TestCase::QUICK
);
151
AddTestCase
(
new
LteEarfcnTestCase
(
"EARFCN=50000"
, 50000, 0.0),
TestCase::QUICK
);
152
}
153
154
155
}
// namespace ns3
NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("LteTestEarfcn")
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
Definition:
log.h:345
ns3::LteEarfcnTestCase::~LteEarfcnTestCase
virtual ~LteEarfcnTestCase()
Definition:
lte-test-earfcn.cc:54
ns3::LteEarfcnTestCase::LteEarfcnTestCase
LteEarfcnTestCase(const char *str, uint16_t earfcn, double f)
Definition:
lte-test-earfcn.cc:46
NS_TEST_ASSERT_MSG_EQ_TOL
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Definition:
test.h:326
ns3::TestSuite
A suite of tests to run.
Definition:
test.h:1025
ns3::g_lteEarfcnTestSuite
static LteEarfcnTestSuite g_lteEarfcnTestSuite
Definition:
lte-test-earfcn.cc:122
ns3::LteEarfcnTestCase
Definition:
lte-test-earfcn.cc:32
ns3::LteEarfcnTestCase::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition:
lte-test-earfcn.cc:59
ns3::TestCase
encapsulates test code
Definition:
test.h:849
ns3::LteEarfcnDlTestCase
Definition:
lte-test-earfcn.cc:65
ns3::LteEarfcnDlTestCase::LteEarfcnDlTestCase
LteEarfcnDlTestCase(const char *str, uint16_t earfcn, double f)
Definition:
lte-test-earfcn.cc:74
ns3::LteEarfcnTestCase::m_f
double m_f
Definition:
lte-test-earfcn.cc:40
ns3::LteSpectrumValueHelper::GetCarrierFrequency
static double GetCarrierFrequency(uint16_t earfcn)
Calculates the carrier frequency from the E-UTRA Absolute Radio Frequency Channel Number (EARFCN) acc...
Definition:
lte-spectrum-value-helper.cc:101
ns3::LteSpectrumValueHelper::GetDownlinkCarrierFrequency
static double GetDownlinkCarrierFrequency(uint16_t earfcn)
Calculates the dowlink carrier frequency from the E-UTRA Absolute Radio Frequency Channel Number (EAR...
Definition:
lte-spectrum-value-helper.cc:117
ns3::LteSpectrumValueHelper::GetUplinkCarrierFrequency
static double GetUplinkCarrierFrequency(uint16_t earfcn)
Calculates the uplink carrier frequency from the E-UTRA Absolute Radio Frequency Channel Number (EARF...
Definition:
lte-spectrum-value-helper.cc:134
ns3::LteEarfcnUlTestCase::LteEarfcnUlTestCase
LteEarfcnUlTestCase(const char *str, uint16_t earfcn, double f)
Definition:
lte-test-earfcn.cc:100
ns3::LteEarfcnUlTestCase::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition:
lte-test-earfcn.cc:106
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
Definition:
test.cc:173
ns3::LteEarfcnTestCase::m_earfcn
uint16_t m_earfcn
Definition:
lte-test-earfcn.cc:39
ns3::TestCase::QUICK
Fast test.
Definition:
test.h:857
ns3::LteEarfcnTestSuite::LteEarfcnTestSuite
LteEarfcnTestSuite()
Definition:
lte-test-earfcn.cc:124
ns3::LteEarfcnTestSuite
Test the calculation of carrier frequency based on EARFCN.
Definition:
lte-test-earfcn.cc:116
ns3::LteEarfcnDlTestCase::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition:
lte-test-earfcn.cc:80
ns3::LteEarfcnUlTestCase
Definition:
lte-test-earfcn.cc:91
src
lte
test
lte-test-earfcn.cc
Generated on Sat Apr 19 2014 14:07:02 for ns-3 by
1.8.6