8 #ifndef __UNITTEST_COMMON_H 9 #define __UNITTEST_COMMON_H 11 #include "../Evolve/StopInformation.h" 12 #include "../Core/AstronomicalConstants.h" 22 bool check_diff(
double x,
double y,
double frac_tolerance,
23 double abs_tolerance);
28 bool check_diff(std::valarray<double> x, std::valarray<double> y,
29 std::valarray<double> frac_tolerance,
30 std::valarray<double> abs_tolerance);
33 bool isEqual(
double a,
double b);
36 double getError(
double predicted,
double actual);
39 bool approxEqual(
double predicted,
double actual,
double thres=0.02);
83 const std::valarray< std::valarray<double> > &poly_coef
93 void rand_poly_coef(std::valarray< std::valarray<double> > &poly_coef,
97 std::valarray< std::valarray<double> >
rand_poly_coef(
double max_mass=-1);
101 std::valarray< std::valarray<double> >
offset_age(
102 const std::valarray< std::valarray<double> > &poly_coef,
107 std::valarray< std::valarray<double> >
offset_age(
108 const std::valarray< std::valarray<double> > &poly_coef,
const double MIN_AGE
Most tests start at this age in Gyr.
bool approxEqual(double predicted, double actual, double thres=0.02)
const double MAX_LOW_MASS
The boundary between high and low mass stars in .
double lag_from_lgQ(double lgQ)
Converts lg(Q) to a tidal phase lag.
double getError(double predicted, double actual)
const double MAX_PLANET_MASS
The upper limit of the mass of random planets.
double rand_value(double min, double max)
A uniform random real value in the given range.
const double MAX_AGE
Most tests end at this age in Gyr.
void rand_poly_coef(std::valarray< std::valarray< double > > &poly_coef, double max_mass=-1)
Fills the given valarray with a random set of polynomial coefficients.
const double MIN_PLANET_RADIUS
The lower limit of the radius of random planets.
double orbital_angmom_from_freq(double m1, double m2, double freq, double e)
The orbital angular momentum corresponding to the given frequency.
bool check_diff(double x, double y, double frac_tolerance, double abs_tolerance)
Returns true iff .
double uniform_rand(double min, double max)
Generates a uniformly distributed random number.
bool isEqual(double a, double b)
const double MAX_STELLAR_MASS
The highest stellar mass to use in tests in .
unsigned next_binom_coef(unsigned n, unsigned m, unsigned nCm)
Given n, m and (n)C(m) returns (n)C(m+1)
const double MIN_PLANET_MASS
The lower limit of the mass of random planets.
std::valarray< std::valarray< double > > offset_age(const std::valarray< std::valarray< double > > &poly_coef, double age_offset)
Returns new polynomial coefficienst such that output polynomial(mass, age+age_offset)=input polynomia...
const double MAX_PLANET_RADIUS
The upper limit of the radius of random planets.
std::ostream & operator<<(std::ostream &os, const std::valarray< std::valarray< double > > &poly_coef)
Create a string with a description of the given stop info.
const double MIN_STELLAR_MASS
The lowest stellar mass to use in tests in .