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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Davide Magrin <magrinda@dei.unipd.it>
7
*/
8
9
// Include headers of classes to test
10
#include "ns3/log.h"
11
#include "ns3/network-scheduler.h"
12
13
// An essential include is test.h
14
#include "ns3/test.h"
15
16
using namespace
ns3
;
17
using namespace
lorawan;
18
19
NS_LOG_COMPONENT_DEFINE
(
"NetworkSchedulerTestSuite"
);
20
21
/**
22
* \ingroup lorawan
23
*
24
* It tests the correct functionality of the NetworkScheduler component class of the network server
25
*/
26
class
NetworkSchedulerTest
:
public
TestCase
27
{
28
public
:
29
NetworkSchedulerTest
();
//!< Default constructor
30
~NetworkSchedulerTest
()
override
;
//!< Destructor
31
32
private
:
33
void
DoRun
()
override
;
34
};
35
36
// Add some help text to this case to describe what it is intended to test
37
NetworkSchedulerTest::NetworkSchedulerTest
()
38
:
TestCase
(
"Verify correct behavior of the NetworkScheduler object"
)
39
{
40
}
41
42
// Reminder that the test case should clean up after itself
43
NetworkSchedulerTest::~NetworkSchedulerTest
()
44
{
45
}
46
47
// This method is the pure virtual method from class TestCase that every
48
// TestCase must implement
49
void
50
NetworkSchedulerTest::DoRun
()
51
{
52
NS_LOG_DEBUG
(
"NetworkSchedulerTest"
);
53
54
// If a packet is received at the network server, a reply event should be
55
// scheduled to happen 1 second after the reception.
56
}
57
58
/**
59
* \ingroup lorawan
60
*
61
* The TestSuite class names the TestSuite, identifies what type of TestSuite, and enables the
62
* TestCases to be run. Typically, only the constructor for this class must be defined
63
*/
64
class
NetworkSchedulerTestSuite
:
public
TestSuite
65
{
66
public
:
67
NetworkSchedulerTestSuite
();
//!< Default constructor
68
};
69
70
NetworkSchedulerTestSuite::NetworkSchedulerTestSuite
()
71
:
TestSuite
(
"network-scheduler"
,
Type
::UNIT)
72
{
73
LogComponentEnable
(
"NetworkSchedulerTestSuite"
,
LOG_LEVEL_DEBUG
);
74
// TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER
75
AddTestCase
(
new
NetworkSchedulerTest
,
Duration::QUICK
);
76
}
77
78
// Do not forget to allocate an instance of this TestSuite
79
static
NetworkSchedulerTestSuite
lorawanTestSuite
;
NetworkSchedulerTest
It tests the correct functionality of the NetworkScheduler component class of the network server.
Definition
network-scheduler-test-suite.cc:27
NetworkSchedulerTest::~NetworkSchedulerTest
~NetworkSchedulerTest() override
Destructor.
Definition
network-scheduler-test-suite.cc:43
NetworkSchedulerTest::NetworkSchedulerTest
NetworkSchedulerTest()
Default constructor.
Definition
network-scheduler-test-suite.cc:37
NetworkSchedulerTest::DoRun
void DoRun() override
Implementation to actually run this TestCase.
Definition
network-scheduler-test-suite.cc:50
NetworkSchedulerTestSuite
The TestSuite class names the TestSuite, identifies what type of TestSuite, and enables the TestCases...
Definition
network-scheduler-test-suite.cc:65
NetworkSchedulerTestSuite::NetworkSchedulerTestSuite
NetworkSchedulerTestSuite()
Default constructor.
Definition
network-scheduler-test-suite.cc:70
ns3::TestCase
encapsulates test code
Definition
test.h:1050
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition
test.cc:292
ns3::TestCase::Duration::QUICK
@ QUICK
Fast test.
ns3::TestSuite
A suite of tests to run.
Definition
test.h:1267
ns3::TestSuite::Type
Type
Type of test.
Definition
test.h:1274
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition
log.h:257
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:291
ns3::LOG_LEVEL_DEBUG
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
Definition
log.h:102
lorawanTestSuite
static NetworkSchedulerTestSuite lorawanTestSuite
Definition
network-scheduler-test-suite.cc:79
src
lorawan
test
network-scheduler-test-suite.cc
Generated on Fri Nov 8 2024 13:59:02 for ns-3 by
1.11.0