A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
examples-as-tests-test-suite.cc
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#include "ns3/example-as-test.h"
21#include "ns3/system-path.h"
22
23#include <vector>
24
25using namespace ns3;
26
39namespace ns3
40{
41
42namespace tests
43{
44
50{
51 public:
56
61
70 std::string GetPostProcessingCommand() const override;
71};
72
74 : ExampleAsTestCase("core-example-command-line",
75 "command-line-example",
76 NS_TEST_SOURCEDIR,
77 "--intArg=2 --boolArg --strArg=deadbeef --anti=t "
78 "--cbArg=beefstew --charbuf=stewmeat 3 4 extraOne extraTwo")
79{
80}
81
83{
84}
85
86std::string
88{
89 // Delete the line that starts with Program Version:
90 return std::string(R"__(| sed -e "/^Program Version:.*$/d")__");
91}
92
98{
99 public:
101};
102
104 : TestSuite("examples-as-tests-test-suite", UNIT)
105{
107 new ExampleAsTestCase("core-example-simulator", "sample-simulator", NS_TEST_SOURCEDIR));
108
109 AddTestCase(new ExampleAsTestCase("core-example-sample-random-variable",
110 "sample-random-variable",
111 NS_TEST_SOURCEDIR));
112
114}
115
122
131static ExampleAsTestSuite g_exampleCommandLineTest("core-example-simulator",
132 "sample-simulator",
133 NS_TEST_SOURCEDIR);
134
135} // namespace tests
136
137} // namespace ns3
Execute an example program as a test, by comparing the output to a reference file.
Execute an example program as a test suite.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:301
A suite of tests to run.
Definition: test.h:1256
Run command line example as a test case.
std::string GetPostProcessingCommand() const override
Override this function to filter the version string from the command-line-example output.
Run examples as tests, checking stdout for regressions.
static ExamplesAsTestsTestSuite g_examplesAsTestsTestSuite
ExampleAsTestsTestSuite instance variable.
static ExampleAsTestSuite g_exampleCommandLineTest("core-example-simulator", "sample-simulator", NS_TEST_SOURCEDIR)
ExampleTestSuite instance variables.
Every class exported by the ns3 library is enclosed in the ns3 namespace.