A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
examples-as-tests-test-suite.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2020 Lawrence Livermore National Laboratory
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: Peter D. Barnes, Jr. <pdbarnes@llnl.gov>
19
*/
20
21
#include "ns3/example-as-test.h"
22
#include "ns3/system-path.h"
23
24
#include <vector>
25
26
using namespace
ns3
;
27
40
namespace
ns3
{
41
42
namespace
tests
{
43
48
class
CommandLineExampleTestCase
:
public
ExampleAsTestCase
49
{
50
public
:
54
CommandLineExampleTestCase
();
55
59
virtual
~CommandLineExampleTestCase
();
60
69
virtual
std::string
GetPostProcessingCommand
(
void
)
const
;
70
};
71
72
CommandLineExampleTestCase::CommandLineExampleTestCase
()
73
:
ExampleAsTestCase
(
"core-example-command-line"
,
74
"command-line-example"
,
75
NS_TEST_SOURCEDIR)
76
{}
77
78
CommandLineExampleTestCase::~CommandLineExampleTestCase
()
79
{}
80
81
std::string
82
CommandLineExampleTestCase::GetPostProcessingCommand
(
void
)
const
83
{
84
//Delete the line that starts with Program Version:
85
return
std::string(R
"__(| sed -e "/^Program Version:.*$/d")__");
86
}
87
92
class
ExamplesAsTestsTestSuite
:
public
TestSuite
93
{
94
public
:
95
ExamplesAsTestsTestSuite
();
96
};
97
98
99
ExamplesAsTestsTestSuite::ExamplesAsTestsTestSuite
()
100
:
TestSuite
(
"examples-as-tests-test-suite"
, UNIT)
101
{
102
AddTestCase
(
new
ExampleAsTestCase
(
"core-example-simulator"
,
"sample-simulator"
, NS_TEST_SOURCEDIR));
103
104
AddTestCase
(
new
ExampleAsTestCase
(
"core-example-sample-random-variable"
,
"sample-random-variable"
, NS_TEST_SOURCEDIR));
105
106
AddTestCase
(
new
CommandLineExampleTestCase
());
107
}
108
114
static
ExamplesAsTestsTestSuite
g_examplesAsTestsTestSuite
;
115
123
static
ExampleAsTestSuite
g_exampleCommandLineTest
(
"core-example-simulator"
,
"sample-simulator"
, NS_TEST_SOURCEDIR);
124
125
}
// namespace tests
126
127
}
// namespace ns3
128
129
130
131
132
ns3::ExampleAsTestCase
Execute an example program as a test, by comparing the output to a reference file.
Definition:
example-as-test.h:50
ns3::ExampleAsTestSuite
Execute an example program as a test suite.
Definition:
example-as-test.h:197
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition:
test.cc:299
ns3::TestSuite
A suite of tests to run.
Definition:
test.h:1188
ns3::tests::CommandLineExampleTestCase
Run command line example as a test case.
Definition:
examples-as-tests-test-suite.cc:49
ns3::tests::CommandLineExampleTestCase::CommandLineExampleTestCase
CommandLineExampleTestCase()
Default constructor.
Definition:
examples-as-tests-test-suite.cc:72
ns3::tests::CommandLineExampleTestCase::~CommandLineExampleTestCase
virtual ~CommandLineExampleTestCase()
Destructor.
Definition:
examples-as-tests-test-suite.cc:78
ns3::tests::CommandLineExampleTestCase::GetPostProcessingCommand
virtual std::string GetPostProcessingCommand(void) const
Override this function to filter the version string from the command-line-example output.
Definition:
examples-as-tests-test-suite.cc:82
ns3::tests::ExamplesAsTestsTestSuite
Run examples as tests, checking stdout for regressions.
Definition:
examples-as-tests-test-suite.cc:93
ns3::tests::ExamplesAsTestsTestSuite::ExamplesAsTestsTestSuite
ExamplesAsTestsTestSuite()
Definition:
examples-as-tests-test-suite.cc:99
ns3::tests::g_examplesAsTestsTestSuite
static ExamplesAsTestsTestSuite g_examplesAsTestsTestSuite
ExampleAsTestsTestSuite instance variable.
Definition:
examples-as-tests-test-suite.cc:114
ns3::tests::g_exampleCommandLineTest
static ExampleAsTestSuite g_exampleCommandLineTest("core-example-simulator", "sample-simulator", NS_TEST_SOURCEDIR)
ExampleTestSuite instance variables.
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
test-ns3.tests
tests
Definition:
test-ns3.py:2134
src
core
test
examples-as-tests-test-suite.cc
Generated on Tue Feb 6 2024 19:21:17 for ns-3 by
1.9.1