A Discrete-Event Network Simulator
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 
41 namespace ns3 {
42 
43 namespace tests {
44 
50 {
51 public:
56 
61 
62  //Inherited function
63  virtual std::string GetPostProcessingCommand (void) const;
64 };
65 
67  : ExampleAsTestCase ("core-example-command-line",
68  "command-line-example",
69  NS_TEST_SOURCEDIR)
70 {}
71 
73 {}
74 
81 std::string
83 {
84  //Delete the line that starts with Program Version:
85  return std::string(R"__(| sed -e "/^Program Version:.*$/d")__");
86 }
87 
93 {
94 public:
96 };
97 
98 
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 
107 }
108 
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 
A suite of tests to run.
Definition: test.h:1343
static ExamplesAsTestsTestSuite g_examplesAsTestsTestSuite
ExampleAsTestsTestSuite instance variable.
Execute an example program as a test suite.
Run examples as tests, checking stdout for regressions.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
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.
Execute an example program as a test, by comparing the output to a reference file.
virtual std::string GetPostProcessingCommand(void) const
Override this function to filter the version string from the command-line-example output...
Run command line example as a test case.