Sort includes outside src/gromacs
[alexxy/gromacs.git] / src / testutils / testfilemanager.cpp
index 3d6f251975ce593ded162aa801f6b8b7b85816a6..0a2eb0f9e38b05839fad9df8d928b4092ce314a2 100644 (file)
@@ -39,6 +39,8 @@
  * \author Teemu Murtola <teemu.murtola@gmail.com>
  * \ingroup module_testutils
  */
+#include "gmxpre.h"
+
 #include "testfilemanager.h"
 
 #include <cstdio>
 
 #include <gtest/gtest.h>
 
+#include "gromacs/options/basicoptions.h"
+#include "gromacs/options/options.h"
 #include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/path.h"
-#include "gromacs/options/options.h"
-#include "gromacs/options/basicoptions.h"
+
 #include "testutils/testoptions.h"
 
 namespace gmx
@@ -164,18 +167,29 @@ std::string TestFileManager::getTemporaryFilePath(const char *suffix)
     return filename;
 }
 
-std::string TestFileManager::getTestSpecificFileName(const char *suffix)
+std::string TestFileManager::getTemporaryFilePath(const std::string &suffix)
+{
+    return getTemporaryFilePath(suffix.c_str());
+}
+
+std::string TestFileManager::getTestSpecificFileNameRoot()
 {
     const ::testing::TestInfo *test_info =
             ::testing::UnitTest::GetInstance()->current_test_info();
-    std::string                filename = std::string(test_info->test_case_name())
+    std::string                filenameRoot = std::string(test_info->test_case_name())
         + "_" + test_info->name();
+    std::replace(filenameRoot.begin(), filenameRoot.end(), '/', '_');
+    return filenameRoot;
+}
+
+std::string TestFileManager::getTestSpecificFileName(const char *suffix)
+{
+    std::string filename = getTestSpecificFileNameRoot();
     if (suffix[0] != '.')
     {
         filename.append("_");
     }
     filename.append(suffix);
-    std::replace(filename.begin(), filename.end(), '/', '_');
     return filename;
 }