diff --git a/src/core/test/core-example-command-line.reflog b/src/core/test/core-example-command-line.reflog index 7b1e8a962..7d53b54a2 100644 --- a/src/core/test/core-example-command-line.reflog +++ b/src/core/test/core-example-command-line.reflog @@ -1,5 +1,6 @@ -command-line-example +command-line-example: + Initial values: intArg: 1 boolArg: false diff --git a/src/core/test/examples-as-tests-test-suite.cc b/src/core/test/examples-as-tests-test-suite.cc index 8752f4523..b487d0d96 100644 --- a/src/core/test/examples-as-tests-test-suite.cc +++ b/src/core/test/examples-as-tests-test-suite.cc @@ -41,6 +41,50 @@ using namespace ns3; namespace ns3 { namespace tests { + +/** + * \ingroup examples-as-tests + * Run command line example as a test case + */ +class CommandLineExampleTestCase : public ExampleAsTestCase +{ +public: + /** + * Default constructor + */ + CommandLineExampleTestCase(); + + /** + * Destructor + */ + virtual ~CommandLineExampleTestCase(); + + //Inherited function + virtual std::string GetPostProcessingCommand (void) const; +}; + +CommandLineExampleTestCase::CommandLineExampleTestCase () + : ExampleAsTestCase ("core-example-command-line", + "command-line-example", + NS_TEST_SOURCEDIR) +{} + +CommandLineExampleTestCase::~CommandLineExampleTestCase () +{} + +/** + * Override this function to filter the version string from + * the command-line-example output. + * Since the version changes each time a commit is made it shouldn't + * be tested as part of the command-line-example output + */ +std::string +CommandLineExampleTestCase::GetPostProcessingCommand (void) const +{ + //Delete the line that starts with Program Version: + return std::string(R"__(| sed -e "/^Program Version:.*$/d")__"); +} + /** * \ingroup examples-as-tests * Run examples as tests, checking stdout for regressions. @@ -59,7 +103,7 @@ ExamplesAsTestsTestSuite::ExamplesAsTestsTestSuite () AddTestCase (new ExampleAsTestCase ("core-example-sample-random-variable", "sample-random-variable", NS_TEST_SOURCEDIR)); - AddTestCase (new ExampleAsTestCase ("core-example-command-line", "command-line-example", NS_TEST_SOURCEDIR)); + AddTestCase (new CommandLineExampleTestCase ()); } /** @@ -76,7 +120,7 @@ static ExamplesAsTestsTestSuite g_examplesAsTestsTestSuite; * Tests ExampleTestSuite which runs a single example as test suite as specified in constructor arguments. */ -static ExampleAsTestSuite g_exampleCommandLineTest ("core-example-command-line", "command-line-example", NS_TEST_SOURCEDIR); +static ExampleAsTestSuite g_exampleCommandLineTest ("core-example-simulator", "sample-simulator", NS_TEST_SOURCEDIR); } // namespace tests