A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
network-scheduler-test-suite.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018 University of Padova
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Davide Magrin <magrinda@dei.unipd.it>
18
*/
19
20
// Include headers of classes to test
21
#include "ns3/log.h"
22
#include "ns3/network-scheduler.h"
23
24
// An essential include is test.h
25
#include "ns3/test.h"
26
27
using namespace
ns3
;
28
using namespace
lorawan;
29
30
NS_LOG_COMPONENT_DEFINE
(
"NetworkSchedulerTestSuite"
);
31
32
/**
33
* \ingroup lorawan
34
*
35
* It tests the correct functionality of the NetworkScheduler component class of the network server
36
*/
37
class
NetworkSchedulerTest
:
public
TestCase
38
{
39
public
:
40
NetworkSchedulerTest
();
//!< Default constructor
41
~NetworkSchedulerTest
()
override
;
//!< Destructor
42
43
private
:
44
void
DoRun
()
override
;
45
};
46
47
// Add some help text to this case to describe what it is intended to test
48
NetworkSchedulerTest::NetworkSchedulerTest
()
49
:
TestCase
(
"Verify correct behavior of the NetworkScheduler object"
)
50
{
51
}
52
53
// Reminder that the test case should clean up after itself
54
NetworkSchedulerTest::~NetworkSchedulerTest
()
55
{
56
}
57
58
// This method is the pure virtual method from class TestCase that every
59
// TestCase must implement
60
void
61
NetworkSchedulerTest::DoRun
()
62
{
63
NS_LOG_DEBUG
(
"NetworkSchedulerTest"
);
64
65
// If a packet is received at the network server, a reply event should be
66
// scheduled to happen 1 second after the reception.
67
}
68
69
/**
70
* \ingroup lorawan
71
*
72
* The TestSuite class names the TestSuite, identifies what type of TestSuite, and enables the
73
* TestCases to be run. Typically, only the constructor for this class must be defined
74
*/
75
class
NetworkSchedulerTestSuite
:
public
TestSuite
76
{
77
public
:
78
NetworkSchedulerTestSuite
();
//!< Default constructor
79
};
80
81
NetworkSchedulerTestSuite::NetworkSchedulerTestSuite
()
82
:
TestSuite
(
"network-scheduler"
,
Type
::UNIT)
83
{
84
LogComponentEnable
(
"NetworkSchedulerTestSuite"
,
LOG_LEVEL_DEBUG
);
85
// TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER
86
AddTestCase
(
new
NetworkSchedulerTest
,
Duration::QUICK
);
87
}
88
89
// Do not forget to allocate an instance of this TestSuite
90
static
NetworkSchedulerTestSuite
lorawanTestSuite
;
NetworkSchedulerTest
It tests the correct functionality of the NetworkScheduler component class of the network server.
Definition:
network-scheduler-test-suite.cc:38
NetworkSchedulerTest::~NetworkSchedulerTest
~NetworkSchedulerTest() override
Destructor.
Definition:
network-scheduler-test-suite.cc:54
NetworkSchedulerTest::NetworkSchedulerTest
NetworkSchedulerTest()
Default constructor.
Definition:
network-scheduler-test-suite.cc:48
NetworkSchedulerTest::DoRun
void DoRun() override
Implementation to actually run this TestCase.
Definition:
network-scheduler-test-suite.cc:61
NetworkSchedulerTestSuite
The TestSuite class names the TestSuite, identifies what type of TestSuite, and enables the TestCases...
Definition:
network-scheduler-test-suite.cc:76
NetworkSchedulerTestSuite::NetworkSchedulerTestSuite
NetworkSchedulerTestSuite()
Default constructor.
Definition:
network-scheduler-test-suite.cc:81
ns3::TestCase
encapsulates test code
Definition:
test.h:1061
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition:
test.cc:302
ns3::TestCase::Duration::QUICK
@ QUICK
Fast test.
ns3::TestSuite
A suite of tests to run.
Definition:
test.h:1273
ns3::TestSuite::Type
Type
Type of test.
Definition:
test.h:1280
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition:
log.h:268
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::LogComponentEnable
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
Definition:
log.cc:302
ns3::LOG_LEVEL_DEBUG
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
Definition:
log.h:113
lorawanTestSuite
static NetworkSchedulerTestSuite lorawanTestSuite
Definition:
network-scheduler-test-suite.cc:90
src
lorawan
test
network-scheduler-test-suite.cc
Generated on Mon Aug 12 2024 11:16:15 for ns-3 by
1.9.6