MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
testing_macros.hpp File Reference
#include <sstream>
#include <exception>
#include <iostream>
#include <stdexcept>
#include <limits>
#include <cmath>
#include "current_function.hpp"
#include "print_function.hpp"
+ Include dependency graph for testing_macros.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ASSERT_DOUBLE_EQ(token, a, b)
 
#define ASSERT_EQ(a, b, token)
 
#define ASSERT_FALSE(condition, msg)
 
#define ASSERT_LT(a, b, msg)
 
#define ASSERT_NEQ(a, b, token)
 
#define ASSERT_TRUE(condition, msg)
 
#define EXPECT_EQ(a, b, token)
 
#define EXPECT_FALSE(condition, msg)
 
#define EXPECT_GT(a, b, token)
 
#define EXPECT_GTE(a, b, token)
 
#define EXPECT_LT(a, b, token)
 
#define EXPECT_LTE(a, b, token)
 
#define EXPECT_NEQ(a, b, token)
 
#define EXPECT_TRUE(condition, msg)
 
#define LOCATION(ss)
 

Functions

bool doubleEq (double a, double b)
 

Variables

static ostringstream assertStream
 

Macro Definition Documentation

#define ASSERT_DOUBLE_EQ (   token,
  a,
 
)
Value:
if(! doubleEq(a, b) ) { \
assertStream.str(""); \
assertStream << "Expected " << std::fixed << b << ", received " << a << endl; \
assertStream << token; \
throw std::runtime_error( "float equality test failed" ); \
}
static ostringstream assertStream
bool doubleEq(double a, double b)
void __dump__(string msg, serverity_level_ type=debug, bool autoFormat=true)
#define LOCATION(ss)

Definition at line 149 of file testing_macros.hpp.

Referenced by test_normal_dist().

#define ASSERT_EQ (   a,
  b,
  token 
)
Value:
if( ! doubleEq((a), (b)) ) { \
assertStream.str(""); \
assertStream.precision( 9 ); \
assertStream << "Expected " << a << ", received " << b << endl; \
assertStream << token << endl; \
throw std::runtime_error(assertStream.str()); \
}
static ostringstream assertStream
bool doubleEq(double a, double b)
#define LOCATION(ss)

Definition at line 139 of file testing_macros.hpp.

#define ASSERT_FALSE (   condition,
  msg 
)
Value:
if( (condition) ) {\
assertStream.str(""); \
assertStream.precision( 9 ); \
assertStream << msg << endl; \
throw std::runtime_error(assertStream.str()); \
}
static ostringstream assertStream

Definition at line 124 of file testing_macros.hpp.

#define ASSERT_LT (   a,
  b,
  msg 
)
Value:
EXPECT_LT(a, b, msg); \
assertStream.str(""); \
assertStream.precision( 9 ); \
assertStream << msg; \
throw std::runtime_error( assertStream.str() ); \
static ostringstream assertStream
#define EXPECT_LT(a, b, token)

Definition at line 132 of file testing_macros.hpp.

#define ASSERT_NEQ (   a,
  b,
  token 
)
Value:
if( (a) == (b)) { \
assertStream.str(""); \
assertStream << "Not expected " << a << endl; \
assertStream << token << endl; \
throw std::runtime_error(assertStream.str()); \
}
static ostringstream assertStream
#define LOCATION(ss)

Definition at line 159 of file testing_macros.hpp.

#define ASSERT_TRUE (   condition,
  msg 
)
Value:
if( !(condition) ) {\
assertStream.str(""); \
assertStream << msg << endl; \
throw std::runtime_error( assertStream.str() );\
}
static ostringstream assertStream

Definition at line 117 of file testing_macros.hpp.

#define EXPECT_EQ (   a,
  b,
  token 
)
Value:
if( (a) != (b)) { \
assertStream.str(""); \
assertStream << "Expected " << b << ", received " << a ; \
assertStream << token; \
}
static ostringstream assertStream
void __dump__(string msg, serverity_level_ type=debug, bool autoFormat=true)
#define LOCATION(ss)

Definition at line 61 of file testing_macros.hpp.

#define EXPECT_FALSE (   condition,
  msg 
)
Value:
if( (condition) ) {\
assertStream.str(""); \
assertStream << msg << endl; \
}
static ostringstream assertStream
void __dump__(string msg, serverity_level_ type=debug, bool autoFormat=true)
#define LOCATION(ss)

Definition at line 53 of file testing_macros.hpp.

#define EXPECT_GT (   a,
  b,
  token 
)
Value:
if( (a) <= (b)) { \
assertStream.str(""); \
assertStream << "Expected greater than " << a << ", received " << b << endl; \
assertStream << token << endl; \
}
static ostringstream assertStream
void __dump__(string msg, serverity_level_ type=debug, bool autoFormat=true)
#define LOCATION(ss)

Definition at line 79 of file testing_macros.hpp.

#define EXPECT_GTE (   a,
  b,
  token 
)
Value:
if( (a) < (b)) { \
assertStream.str(""); \
assertStream << "Expected greater than or equal to " << a \
<< ", received " << b << endl; \
assertStream << token << endl; \
}
static ostringstream assertStream
void __dump__(string msg, serverity_level_ type=debug, bool autoFormat=true)
#define LOCATION(ss)

Definition at line 88 of file testing_macros.hpp.

#define EXPECT_LT (   a,
  b,
  token 
)
Value:
if( (a) >= (b)) { \
assertStream.str(""); \
assertStream << "Expected less than " << a << ", received " << b << endl; \
assertStream << token << endl; \
}
static ostringstream assertStream
void __dump__(string msg, serverity_level_ type=debug, bool autoFormat=true)
#define LOCATION(ss)

Definition at line 98 of file testing_macros.hpp.

#define EXPECT_LTE (   a,
  b,
  token 
)
Value:
if( (a) < (b)) { \
assertStream.str(""); \
assertStream << "Expected less than or equal to " << a \
<< ", received " << b << endl; \
assertStream << token << endl; \
}
static ostringstream assertStream
void __dump__(string msg, serverity_level_ type=debug, bool autoFormat=true)
#define LOCATION(ss)

Definition at line 107 of file testing_macros.hpp.

#define EXPECT_NEQ (   a,
  b,
  token 
)
Value:
if( (a) == (b)) { \
assertStream.str(""); \
assertStream << "Not expected " << a << endl; \
assertStream << token << endl; \
}
static ostringstream assertStream
void __dump__(string msg, serverity_level_ type=debug, bool autoFormat=true)
#define LOCATION(ss)

Definition at line 70 of file testing_macros.hpp.

#define EXPECT_TRUE (   condition,
  msg 
)
Value:
if( !(condition) ) {\
assertStream.str(""); \
assertStream << msg << endl; \
}
static ostringstream assertStream
void __dump__(string msg, serverity_level_ type=debug, bool autoFormat=true)
#define LOCATION(ss)

Definition at line 45 of file testing_macros.hpp.

#define LOCATION (   ss)
Value:
ss << "In function: " << SIMPLE_CURRENT_FUNCTION; \
ss << " file: " << __FILE__ << ":" << __LINE__ << endl;
#define SIMPLE_CURRENT_FUNCTION

Definition at line 41 of file testing_macros.hpp.

Function Documentation

bool doubleEq ( double  a,
double  b 
)
inline

Definition at line 34 of file testing_macros.hpp.

References EPS1, and EPS2.

35 {
36  return std::fabs(a-b) < 1e-7;
37 }

Variable Documentation

ostringstream assertStream
static

Definition at line 39 of file testing_macros.hpp.