HOPS
HOPS class reference
Macros
MHO_TestAssertions.hh File Reference
#include "MHO_Message.hh"
#include <sstream>
#include <stdexcept>
#include <string>

Go to the source code of this file.

Macros

#define HOPS_ASSERT_EQUAL(a, b)
 
#define HOPS_ASSERT_FLOAT_LESS_THAN(a, b)
 
#define HOPS_ASSERT_THROW(test_cond)
 
#define HOPS_THROW
 

Macro Definition Documentation

◆ HOPS_ASSERT_EQUAL

#define HOPS_ASSERT_EQUAL (   a,
 
)
Value:
{ \
if((a) != (b)) \
{ \
throw std::runtime_error(std::string(__FILE__) + std::string(":") + std::to_string(__LINE__) + \
std::string(" in ") + std::string(__PRETTY_FUNCTION__) + std::string(": ") + \
std::to_string((a)) + std::string(" != ") + std::to_string((b))); \
} \
}

◆ HOPS_ASSERT_FLOAT_LESS_THAN

#define HOPS_ASSERT_FLOAT_LESS_THAN (   a,
 
)
Value:
{ \
std::stringstream ssa; \
ssa << a; \
std::stringstream ssb; \
ssb << b; \
if((a) > (b)) \
{ \
throw std::runtime_error(std::string(__FILE__) + std::string(":") + std::to_string(__LINE__) + \
std::string(" in ") + std::string(__PRETTY_FUNCTION__) + std::string(": ") + ssa.str() + \
std::string(" !< ") + ssb.str()); \
} \
}

◆ HOPS_ASSERT_THROW

#define HOPS_ASSERT_THROW (   test_cond)
Value:
{ \
if(!(test_cond)) \
{ \
throw std::runtime_error(std::string(__FILE__) + std::string(":") + std::to_string(__LINE__) + \
std::string(" in ") + std::string(__PRETTY_FUNCTION__)); \
} \
}

◆ HOPS_THROW

#define HOPS_THROW
Value:
{ \
throw std::runtime_error(std::string(__FILE__) + std::string(":") + std::to_string(__LINE__) + std::string(" in ") + \
std::string(__PRETTY_FUNCTION__)); \
}