Make the output of the constraints tests readable
[alexxy/gromacs.git] / src / gromacs / mdlib / tests / constr.cpp
index a0922b45009318350d2c66fae31e1b17e46657fc..fbca1b6d340b0ad1a2acbca0d7ef594375705cd1 100644 (file)
 #include "constrtestdata.h"
 #include "constrtestrunners.h"
 
+//! Helper function to convert t_pbc into string and make test failure messages readable
+static void PrintTo(const t_pbc& pbc, std::ostream* os)
+{
+    *os << "PBC: " << c_pbcTypeNames[pbc.pbcType];
+}
+
+
 namespace gmx
 {
+
 namespace test
 {
 namespace
@@ -91,7 +99,6 @@ const std::vector<t_pbc> c_pbcs = [] {
     return pbcs;
 }();
 
-
 struct ConstraintsTestSystem
 {
     //! Human-friendly name of the system.
@@ -147,6 +154,12 @@ struct ConstraintsTestSystem
     FloatingPointTolerance virialTolerance = absoluteTolerance(0.0001);
 };
 
+//! Helper function to convert ConstraintsTestSystem into string and make test failure messages readable
+void PrintTo(const ConstraintsTestSystem& constraintsTestSystem, std::ostream* os)
+{
+    *os << constraintsTestSystem.title << " - " << constraintsTestSystem.numAtoms << " atoms";
+}
+
 const std::vector<ConstraintsTestSystem> c_constraintsTestSystemList = [] {
     std::vector<ConstraintsTestSystem> constraintsTestSystemList;
     {