unit_test.hpp File Reference

Contains the unit_test class an global unit defines. More...

#include "unit/unit_exception.hpp"
#include "tools/enable_if.hpp"
#include <tr1/functional>
#include <map>
#include <cstring>
#include <string>
#include <sstream>
#include <type_traits>

Classes

class  oos::unit_test
 A unit_test consists of serveral tests. More...
 

Namespaces

 oos
 The Open Object Store namespace.
 

Macros

#define UNIT_ASSERT_EQUAL(a, b, msg)   assert_equal(a, b, msg, __LINE__, __FILE__)
 Checks if a is equal b. More...
 
#define UNIT_ASSERT_NOT_EQUAL(a, b, msg)   assert_not_equal(a, b, msg, __LINE__, __FILE__)
 Checks if a is not equal b. More...
 
#define UNIT_ASSERT_GREATER(a, b, msg)   assert_greater(a, b, msg, __LINE__, __FILE__)
 Checks if a is greater b. More...
 
#define UNIT_ASSERT_LESS(a, b, msg)   assert_less(a, b, msg, __LINE__, __FILE__)
 Checks if a is greater b. More...
 
#define UNIT_ASSERT_FALSE(a, msg)   assert_false(a, msg, __LINE__, __FILE__)
 Checks if a evaluates to false. More...
 
#define UNIT_ASSERT_TRUE(a, msg)   assert_true(a, msg, __LINE__, __FILE__)
 Checks if a evaluates to true. More...
 
#define UNIT_ASSERT_NULL(o, msg)   assert_null(o, msg, __LINE__, __FILE__)
 Checks if o is NULL. More...
 
#define UNIT_ASSERT_NOT_NULL(o, msg)   assert_not_null(o, msg, __LINE__, __FILE__)
 Checks if o is not NULL. More...
 
#define UNIT_FAIL(msg)
 Throws an error. More...
 
#define UNIT_WARN(msg)
 Displays a warning. More...
 
#define UNIT_INFO(msg)   info(msg)
 Displays an informatkon. More...
 

Detailed Description

Contains the unit_test class an global unit defines.

This file contains the declaration of the unit_test class and the global unit assert defines.

Macro Definition Documentation

#define UNIT_ASSERT_EQUAL (   a,
  b,
  msg 
)    assert_equal(a, b, msg, __LINE__, __FILE__)

Checks if a is equal b.

If a is not equal b the test method throws a unit_exception with the given message. The exception is caught by the test_suite the message is displayed

#define UNIT_ASSERT_FALSE (   a,
  msg 
)    assert_false(a, msg, __LINE__, __FILE__)

Checks if a evaluates to false.

If a doesn't evaluates to false the test method throws a unit_exception with the given message. The exception is caught by the test_suite the message is displayed

#define UNIT_ASSERT_GREATER (   a,
  b,
  msg 
)    assert_greater(a, b, msg, __LINE__, __FILE__)

Checks if a is greater b.

If a is not greater b the test method throws a unit_exception with the given message. The exception is caught by the test_suite the message is displayed

#define UNIT_ASSERT_LESS (   a,
  b,
  msg 
)    assert_less(a, b, msg, __LINE__, __FILE__)

Checks if a is greater b.

If a is not greater b the test method throws a unit_exception with the given message. The exception is caught by the test_suite the message is displayed

#define UNIT_ASSERT_NOT_EQUAL (   a,
  b,
  msg 
)    assert_not_equal(a, b, msg, __LINE__, __FILE__)

Checks if a is not equal b.

If a is equal b the test method throws a unit_exception with the given message. The exception is caught by the test_suite the message is displayed

#define UNIT_ASSERT_NOT_NULL (   o,
  msg 
)    assert_not_null(o, msg, __LINE__, __FILE__)

Checks if o is not NULL.

If o is NULL the test method throws a unit_exception with the given message. The exception is caught by the test_suite the message is displayed

#define UNIT_ASSERT_NULL (   o,
  msg 
)    assert_null(o, msg, __LINE__, __FILE__)

Checks if o is NULL.

If o isn't NULL the test method throws a unit_exception with the given message. The exception is caught by the test_suite the message is displayed

#define UNIT_ASSERT_TRUE (   a,
  msg 
)    assert_true(a, msg, __LINE__, __FILE__)

Checks if a evaluates to true.

If a doesn't evaluates to true the test method throws a unit_exception with the given message. The exception is caught by the test_suite the message is displayed

#define UNIT_FAIL (   msg)
Value:
do { \
std::stringstream fail_stream; \
fail_stream << msg; \
error(fail_stream.str(), __LINE__, __FILE__);\
} while (false)

Throws an error.

The test method throws an exception with the given error message and the current file and line number information.

#define UNIT_INFO (   msg)    info(msg)

Displays an informatkon.

The test method displays an information with the given message.

#define UNIT_WARN (   msg)
Value:
do { \
std::stringstream warn_stream; \
warn_stream << msg; \
warn(warn_stream.str(), __LINE__, __FILE__); \
} while (false)

Displays a warning.

The test method displays a warning with the given message and the current file and line number information.