Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:13:37

0001 #ifndef TEST_HELPERS_H
0002 #define TEST_HELPERS_H
0003 
0004 #include <vector>
0005 #include <fstream>
0006 
0007 namespace TestHelpers {
0008 
0009   /// From here: https://stackoverflow.com/a/2581839
0010   void skip_lines(std::istream& pStream, size_t pLines)
0011   {
0012       std::string s;
0013       for (; pLines; --pLines)
0014           std::getline(pStream, s);
0015   }
0016 
0017   /// @brief Precalculated data with it's properties used in statistical objects tests.
0018   struct TestData {
0019     TestData() {
0020         std::ifstream infile("normalDistr.data");
0021 
0022         data.reserve(1000);
0023 
0024         skip_lines(infile, 5);
0025 
0026         infile >> meanVal;
0027         infile >> stdDevVal;
0028         infile >> varVal;
0029         infile >> RMSVal;
0030         infile >> stdErrVal;
0031 
0032         double buffer = 0;
0033 
0034         while(infile >> buffer)
0035           data.push_back(buffer);
0036     }
0037 
0038     double meanVal;
0039     double stdDevVal;
0040     double stdErrVal;
0041     double RMSVal;
0042     double varVal;
0043 
0044     std::vector<double> data;
0045   };
0046 }
0047 
0048 #endif