Permit tests to specify the refdata filename
[alexxy/gromacs.git] / src / testutils / include / testutils / refdata.h
index 78b0449b84035230e7e58aa75e0c9b79400b5f91..f3ae67b578582e1e243bb3cd10c5f96d39c27c0f 100644 (file)
@@ -2,7 +2,7 @@
  * This file is part of the GROMACS molecular simulation package.
  *
  * Copyright (c) 2011-2018, The GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -40,6 +40,7 @@
  * See \ref page_refdata for more details.
  *
  * \author Teemu Murtola <teemu.murtola@gmail.com>
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
  * \inlibraryapi
  * \ingroup module_testutils
  */
@@ -195,6 +196,17 @@ public:
      * Initializes the reference data in the global mode.
      */
     TestReferenceData();
+    /*! \brief Initializes the reference data in the global mode while
+     * providing the test name.
+     *
+     * Providing a name for the test, rather than using the default
+     * name generated by GoogleTest, is useful when many tests should
+     * share common reference data because e.g. they are
+     * value-parameterized over multiple equivalent implementations or
+     * run modes. The name should include a filename suffix
+     * e.g. `.xml` and refers to a file that will be found in the
+     * `refdata` subdirectory for the test case. */
+    explicit TestReferenceData(std::string testNameOverride);
     /*! \brief
      * Initializes the reference data in a specific mode.
      *
@@ -594,7 +606,7 @@ private:
      */
     explicit TestReferenceChecker(Impl* impl);
 
-    PrivateImplPointer<Impl> impl_;
+    std::unique_ptr<Impl> impl_;
 
     /*! \brief
      * Needed to expose the constructor only to TestReferenceData.