17#include "../system_tests/system_tester.h"
18#include "../utils/basic_structs.h"
95bool nearlyEqualDbl(
double const &a,
double const &b,
double &absoluteDiff, int64_t &ulpsDiff,
96 double const &fixedEpsilon = 1E-14, int64_t
const &ulpsEpsilon = 4);
99void wrapperEqual(
int i,
int j,
int k, std::string
const &dataSetName,
double test_value,
double fid_value,
100 double fixedEpsilon);
105 double amplitude,
double kx,
double ky,
double kz,
double phase,
double tolerance);
123template <
int checkType = 0>
124void Check_Results(
double fiducialNumber,
double testNumber, std::string
const &outString,
double fixedEpsilon = -999,
125 int64_t ulpsEpsilon = -999)
132 if ((fixedEpsilon < 0) and (ulpsEpsilon < 0)) {
134 }
else if ((fixedEpsilon > 0) and (ulpsEpsilon < 0)) {
141 std::stringstream outputMessage;
142 outputMessage << std::setprecision(std::numeric_limits<double>::max_digits10) <<
"Difference in " << outString
144 <<
"The fiducial value is: " << fiducialNumber << std::endl
145 <<
"The test value is: " << testNumber << std::endl
146 <<
"The absolute difference is: " << absoluteDiff << std::endl
147 <<
"The ULP difference is: " << ulpsDiff << std::endl;
149 if (checkType == 0) {
150 EXPECT_TRUE(areEqual) << outputMessage.str();
151 }
else if (checkType == 1) {
152 ASSERT_TRUE(areEqual) << outputMessage.str();
154 throw std::runtime_error(
155 "Incorrect template argument passed to "
156 "Check_Results. Options are 0 and 1 but " +
157 std::to_string(checkType) +
" was passed");
181 void init(std::string
const &inputPath) { _string = inputPath; };
204 std::string
const message =
"Direction " + std::to_string(direction);
231extern bool globalRunCholla;
232extern bool globalCompareSystemTestResults;
Definition system_tester.h:97
Holds a single std::string that's intended to be read only and global. Use for storing the path of th...
Definition testing_utilities.h:169
std::string getString()
Get the String object.
Definition testing_utilities.h:188
void init(std::string const &inputPath)
Initializes the _path member variable. Should only be called once in main.
Definition testing_utilities.h:181
testing_utilities::GlobalString globalChollaRoot
This is the global variable to store the path to the root of Cholla.
Definition main_tests.cpp:21
A namespace for various testing related utility functions. Many of those functions will likely use th...
Definition testing_utilities.cpp:22
bool nearlyEqualDbl(double const &a, double const &b, double &absoluteDiff, int64_t &ulpsDiff, double const &fixedEpsilon, int64_t const &ulpsEpsilon)
Check if two doubles are nearly equal.
Definition testing_utilities.cpp:64
int64_t ulpsDistanceDbl(double const &a, double const &b)
Compute the Units in the Last Place (ULP) difference between two doubles.
Definition testing_utilities.cpp:24
void Check_Results(double fiducialNumber, double testNumber, std::string const &outString, double fixedEpsilon=-999, int64_t ulpsEpsilon=-999)
A simple function to compare two doubles with the nearlyEqualDbl function, perform a GTest assert on ...
Definition testing_utilities.h:124
void Check_Interface(reconstruction::InterfaceState const &test_data, reconstruction::InterfaceState const &fiducial_data, size_t const direction)
Function for checking if every member in a reconstruction::InterfaceState struct matches the fiducial...
Definition testing_utilities.h:201
__device__ __host__ T & x() noexcept
Directly access the x, y, and z elements. Const version is needed if the object instance is declared ...
Definition basic_structs.h:68
Definition basic_structs.h:165
Real pressure
Note that pressure here is the gas pressure not the total pressure which would include the magnetic c...
Definition basic_structs.h:169