Add support for reading values from refdata
[alexxy/gromacs.git] / src / testutils / refdata.h
index 61904f6b40c304978f1a7ba41f413f44ede3aada..1fd128ecdc0d3eeb1a111969b281a7415f4caebf 100644 (file)
@@ -348,6 +348,8 @@ class TestReferenceChecker
          * is easier to edit by hand to set the desired output formatting.
          */
         void checkTextBlock(const std::string &value, const char *id);
+        //! Check a single unsigned char value.
+        void checkUChar(unsigned char value, const char *id);
         //! Check a single integer value.
         void checkInteger(int value, const char *id);
         //! Check a single int64 value.
@@ -377,6 +379,29 @@ class TestReferenceChecker
         //! Checks a generic key-value tree value.
         void checkKeyValueTreeValue(const KeyValueTreeValue &value, const char *id);
 
+        /*! \name Methods to read values from reference data
+         *
+         * These methods assume that a value with the given `id` has already
+         * been created in the test with `check*()` methods, and that it has
+         * the correct type.
+         *
+         * Currently, these methods do not work correctly if the reference data
+         * file does not exist, so a test using them may fail with exceptions
+         * before the reference data has been generated.
+         * \{
+         */
+        //! Reads an unsigned char value.
+        unsigned char readUChar(const char *id);
+        //! Reads an integer value.
+        int readInteger(const char *id);
+        //! Reads a float value.
+        float readFloat(const char *id);
+        //! Reads a double value.
+        double readDouble(const char *id);
+        //! Reads a string value.
+        std::string readString(const char *id);
+        //! \}
+
         /*! \name Overloaded versions of simple checker methods
          *
          * These methods provide overloads under a single name for all the