35 std::cout << __FILE__ << " " << __LINE__ << ": " << msg << std::endl
46#define ASSERT(expr, msg) \
47 m_assert(expr, #expr, __METHOD_NAME__, __FILE__, __LINE__, msg)
52#define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__)
92void m_assert(
bool expr, std::string expr_str, std::string func,
93 std::string file,
int line, std::string msg);
106bool close_to(arma::vec &a, arma::vec &b,
double tol = 1e-8);
118static inline std::string methodName(
const std::string &pretty_function)
120 size_t colons = pretty_function.find(
"::");
121 size_t begin = pretty_function.substr(0, colons).rfind(
" ") + 1;
122 size_t end = pretty_function.rfind(
"(") - begin;
124 return pretty_function.substr(begin, end) +
"()";
137bool mkpath(std::string path,
int mode = 0777);
void m_assert(bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)
Test an expression, confirm that test is ok, or abort execution.
bool mkpath(std::string path, int mode=0777)
Make path given.
bool close_to(arma::vec &a, arma::vec &b, double tol=1e-8)
Test if two armadillo vectors are close to each other.
std::string scientific_format(double d, int width=20, int prec=10)
Turns a double into a string written in scientific format.