A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
example-as-test.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2020 Lawrence Livermore National Laboratory
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: Peter D. Barnes, Jr. <pdbarnes@llnl.gov>
18
*/
19
20
#ifndef NS3_EXAMPLE_AS_TEST_SUITE_H
21
#define NS3_EXAMPLE_AS_TEST_SUITE_H
22
23
#include "
test.h
"
24
25
#include <string>
26
34
namespace
ns3
35
{
36
48
class
ExampleAsTestCase
:
public
TestCase
49
{
50
public
:
73
ExampleAsTestCase
(
const
std::string name,
74
const
std::string program,
75
const
std::string dataDir,
76
const
std::string
args
=
""
,
77
const
bool
shouldNotErr =
true
);
78
80
~ExampleAsTestCase
()
override
;
81
88
virtual
std::string
GetCommandTemplate
()
const
;
89
105
virtual
std::string
GetPostProcessingCommand
()
const
;
106
107
// Inherited
108
void
DoRun
()
override
;
109
110
protected
:
111
std::string
m_program
;
112
std::string
m_dataDir
;
113
std::string
m_args
;
114
bool
m_shouldNotErr
;
116
};
// class ExampleAsTestCase
117
209
class
ExampleAsTestSuite
:
public
TestSuite
210
{
211
public
:
217
ExampleAsTestSuite
(
const
std::string name,
218
const
std::string program,
219
const
std::string dataDir,
220
const
std::string
args
=
""
,
221
const
TestDuration
duration =
QUICK
,
222
const
bool
shouldNotErr =
true
);
223
};
// class ExampleAsTestSuite
224
225
}
// namespace ns3
226
227
#endif
/* NS3_EXAMPLE_TEST_SUITE_H */
ns3::ExampleAsTestCase
Execute an example program as a test, by comparing the output to a reference file.
Definition:
example-as-test.h:49
ns3::ExampleAsTestCase::m_shouldNotErr
bool m_shouldNotErr
Whether error return status is a test failure.
Definition:
example-as-test.h:114
ns3::ExampleAsTestCase::DoRun
void DoRun() override
Implementation to actually run this TestCase.
ns3::ExampleAsTestCase::GetPostProcessingCommand
virtual std::string GetPostProcessingCommand() const
Customization point for tests requiring post-processing of stdout.
ns3::ExampleAsTestCase::ExampleAsTestCase
ExampleAsTestCase(const std::string name, const std::string program, const std::string dataDir, const std::string args="", const bool shouldNotErr=true)
Constructor.
ns3::ExampleAsTestCase::m_args
std::string m_args
Any additional arguments to the program.
Definition:
example-as-test.h:113
ns3::ExampleAsTestCase::m_dataDir
std::string m_dataDir
The source directory for the test.
Definition:
example-as-test.h:112
ns3::ExampleAsTestCase::GetCommandTemplate
virtual std::string GetCommandTemplate() const
Customization point for more complicated patterns to invoke the example program.
ns3::ExampleAsTestCase::m_program
std::string m_program
The program to run.
Definition:
example-as-test.h:111
ns3::ExampleAsTestCase::~ExampleAsTestCase
~ExampleAsTestCase() override
Destructor.
ns3::ExampleAsTestSuite
Execute an example program as a test suite.
Definition:
example-as-test.h:210
ns3::ExampleAsTestSuite::ExampleAsTestSuite
ExampleAsTestSuite(const std::string name, const std::string program, const std::string dataDir, const std::string args="", const TestDuration duration=QUICK, const bool shouldNotErr=true)
Constructor.
ns3::TestCase
encapsulates test code
Definition:
test.h:1060
ns3::TestCase::TestDuration
TestDuration
How long the test takes to execute.
Definition:
test.h:1064
ns3::TestCase::QUICK
@ QUICK
Fast test.
Definition:
test.h:1065
ns3::TestSuite
A suite of tests to run.
Definition:
test.h:1256
check-style-clang-format.args
args
Definition:
check-style-clang-format.py:754
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
test.h
ns3::TestCase, ns3::TestSuite, ns3::TestRunner declarations, and NS_TEST_ASSERT macro definitions.
src
core
model
example-as-test.h
Generated on Sun Mar 3 2024 17:10:55 for ns-3 by
1.9.1