A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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 "ns3/test.h"
24
25#include <string>
26
34namespace ns3
35{
36
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
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;
116}; // class ExampleAsTestCase
117
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 */
Execute an example program as a test, by comparing the output to a reference file.
bool m_shouldNotErr
Whether error return status is a test failure.
void DoRun() override
Implementation to actually run this TestCase.
virtual std::string GetPostProcessingCommand() const
Customization point for tests requiring post-processing of stdout.
ExampleAsTestCase(const std::string name, const std::string program, const std::string dataDir, const std::string args="", const bool shouldNotErr=true)
Constructor.
std::string m_args
Any additional arguments to the program.
std::string m_dataDir
The source directory for the test.
virtual std::string GetCommandTemplate() const
Customization point for more complicated patterns to invoke the example program.
std::string m_program
The program to run.
~ExampleAsTestCase() override
Destructor.
Execute an example program as a test suite.
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.
encapsulates test code
Definition: test.h:1060
TestDuration
How long the test takes to execute.
Definition: test.h:1064
@ QUICK
Fast test.
Definition: test.h:1065
A suite of tests to run.
Definition: test.h:1256
Every class exported by the ns3 library is enclosed in the ns3 namespace.