Improve testutils infrastructure
[alexxy/gromacs.git] / src / testutils / cmdlinetest.cpp
index bbea96a5a8a3659ae01c6a5a094290e79ff10614..786245e7ddc1399c08b3f90f9550b766565a979f 100644 (file)
@@ -374,6 +374,31 @@ void CommandLineTestHelper::setOutputFile(CommandLine*                args,
     impl_->outputFiles_.emplace_back(option, fullFilename, matcher.createFileMatcher());
 }
 
+void CommandLineTestHelper::setOutputFileWithGeneratedName(const char* filename,
+                                                           const ITextBlockMatcherSettings& matcher)
+{
+    setOutputFileWithGeneratedName(std::string(filename), TextFileMatch(matcher));
+}
+
+void CommandLineTestHelper::setOutputFileWithGeneratedName(std::string&& filename,
+                                                           const ITextBlockMatcherSettings& matcher)
+{
+    setOutputFileWithGeneratedName(std::move(filename), TextFileMatch(matcher));
+}
+
+void CommandLineTestHelper::setOutputFileWithGeneratedName(const char*                 filename,
+                                                           const IFileMatcherSettings& matcher)
+{
+    setOutputFileWithGeneratedName(std::string(filename), matcher);
+}
+
+void CommandLineTestHelper::setOutputFileWithGeneratedName(std::string&&               filename,
+                                                           const IFileMatcherSettings& matcher)
+{
+    impl_->outputFiles_.emplace_back(filename.c_str(), filename, matcher.createFileMatcher());
+    impl_->fileManager_.manageGeneratedOutputFile(std::move(filename));
+}
+
 void CommandLineTestHelper::checkOutputFiles(TestReferenceChecker checker) const
 {
     if (!impl_->outputFiles_.empty())
@@ -461,6 +486,30 @@ void CommandLineTestBase::setOutputFile(const char*                 option,
     impl_->helper_.setOutputFile(&impl_->cmdline_, option, filename, matcher);
 }
 
+void CommandLineTestBase::setOutputFileWithGeneratedName(const char*                      filename,
+                                                         const ITextBlockMatcherSettings& matcher)
+{
+    impl_->helper_.setOutputFileWithGeneratedName(std::string(filename), matcher);
+}
+
+void CommandLineTestBase::setOutputFileWithGeneratedName(std::string&&                    filename,
+                                                         const ITextBlockMatcherSettings& matcher)
+{
+    impl_->helper_.setOutputFileWithGeneratedName(std::move(filename), matcher);
+}
+
+void CommandLineTestBase::setOutputFileWithGeneratedName(const char*                 filename,
+                                                         const IFileMatcherSettings& matcher)
+{
+    impl_->helper_.setOutputFileWithGeneratedName(std::string(filename), matcher);
+}
+
+void CommandLineTestBase::setOutputFileWithGeneratedName(std::string&&               filename,
+                                                         const IFileMatcherSettings& matcher)
+{
+    impl_->helper_.setOutputFileWithGeneratedName(std::move(filename), matcher);
+}
+
 void CommandLineTestBase::setInputAndOutputFile(const char*                      option,
                                                 const char*                      filename,
                                                 const ITextBlockMatcherSettings& matcher)