tests.h File Reference
`#include <string>`
`#include <sstream>`
`#include <wibble/tests/tut.h>`
`#include <wibble/tests/tut_reporter.h>`
Include dependency graph for tests.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes

class | wibble::tests::Location
struct | wibble::tests::LocationInfo
struct | wibble::tests::TestBool< A >
struct | wibble::tests::TestEquals< A, E >
struct | wibble::tests::TestIsLt< A, E >
struct | wibble::tests::TestIsLte< A, E >
struct | wibble::tests::TestIsGt< A, E >
struct | wibble::tests::TestIsGte< A, E >
struct | wibble::tests::TestStartsWith
struct | wibble::tests::TestEndsWith
struct | wibble::tests::TestContains
struct | wibble::tests::TestRegexp
struct | wibble::tests::TestFileExists
struct | wibble::tests::Actual< A >
struct | wibble::tests::ActualString

## Namespaces

| wibble
| wibble::tests

## Macros

#define | TESTGRP(name)
#define | WIBBLE_TESTS_ALWAYS_THROWS __attribute__ ((noreturn))
#define | WIBBLE_TEST_LOCPRM wibble::tests::Location wibble_test_location
#define | WIBBLE_TEST_INFO(name)
| Use this to declare a local variable with the given name that will be picked up by tests as extra local info. More...
#define | ensure(x) wibble::tests::impl_ensure(wibble::tests::Location(__FILE__, __LINE__, #x), (x))
#define | inner_ensure(x) wibble::tests::impl_ensure(wibble::tests::Location(loc, __FILE__, __LINE__, #x), (x))
#define | ensure_equals(x, y) wibble::tests::impl_ensure_equals(wibble::tests::Location(__FILE__, __LINE__, #x " == " #y), (x), (y))
#define | inner_ensure_equals(x, y) wibble::tests::impl_ensure_equals(wibble::tests::Location(loc, __FILE__, __LINE__, #x " == " #y), (x), (y))
#define | ensure_similar(x, y, prec) wibble::tests::impl_ensure_similar(wibble::tests::Location(__FILE__, __LINE__, #x " == " #y), (x), (y), (prec))
#define | inner_ensure_similar(x, y, prec) wibble::tests::impl_ensure_similar(wibble::tests::Location(loc, __FILE__, __LINE__, #x " == " #y), (x), (y), (prec))
#define | ensure_contains(x, y) wibble::tests::impl_ensure_contains(wibble::tests::Location(__FILE__, __LINE__, #x " == " #y), (x), (y))
#define | inner_ensure_contains(x, y) wibblwibblempl_ensure_contains(wibble::tests::Location(loc, __FILE__, __LINE__, #x " == " #y), (x), (y))
#define | ensure_not_contains(x, y) wibble::tests::impl_ensure_not_contains(wibble::tests::Location(__FILE__, __LINE__, #x " == " #y), (x), (y))
#define | inner_ensure_not_contains(x, y) wibble::tests::impl_ensure_not_contains(wibble::tests::Location(loc, __FILE__, __LINE__, #x " == " #y), (x), (y))
#define | wibble_test_runner(loc, func, ...)
#define | wrunchecked(func)
#define | wruntest(test, ...) wibble_test_runner(wibble_test_location.nest(wibble_test_location_info, __FILE__, __LINE__, "function: " #test "(" #__VA_ARGS__ ")"), test, ##__VA_ARGS__)
#define | wassert(...) wibble_test_runner(wibble_test_location.nest(wibble_test_location_info, __FILE__, __LINE__, #__VA_ARGS__), _wassert, ##__VA_ARGS__)

## Functions

void | wibble::tests::impl_ensure (const Location &loc, bool res)
template<class Actual , class Expected >
void | wibble::tests::impl_ensure_equals (const Location &loc, const Actual &actual, const Expected &expected)
template<class Actual , class Expected , class Precision >
void | wibble::tests::impl_ensure_similar (const Location &loc, const Actual &actual, const Expected &expected, const Precision &precision)
void | wibble::tests::impl_ensure_contains (const wibble::tests::Location &loc, const std::string &haystack, const std::string &needle)
void | wibble::tests::impl_ensure_not_contains (const wibble::tests::Location &loc, const std::string &haystack, const std::string &needle)
template<typename A >
Actual< A > | wibble::tests::actual (const A &actual)
ActualString | wibble::tests::actual (const std::string &actual)
ActualString | wibble::tests::actual (const char *actual)
ActualString | wibble::tests::actual (char *actual)

## Variables

const wibble::tests::Location | wibble_test_location
const wibble::tests::LocationInfo | wibble_test_location_info

## Macro Definition Documentation

## ensure

#define ensure | ( |  | x | ) | wibble::tests::impl_ensure(wibble::tests::Location(__FILE__, __LINE__, #x), (x))

## ensure_contains

#define ensure_contains | ( |  | x,
|  |  | y
| ) |  | wibble::tests::impl_ensure_contains(wibble::tests::Location(__FILE__, __LINE__, #x " == " #y), (x), (y))

## ensure_equals

#define ensure_equals | ( |  | x,
|  |  | y
| ) |  | wibble::tests::impl_ensure_equals(wibble::tests::Location(__FILE__, __LINE__, #x " == " #y), (x), (y))

## ensure_not_contains

#define ensure_not_contains | ( |  | x,
|  |  | y
| ) |  | wibble::tests::impl_ensure_not_contains(wibble::tests::Location(__FILE__, __LINE__, #x " == " #y), (x), (y))

## ensure_similar

#define ensure_similar | ( |  | x,
|  |  | y,
|  |  | prec
| ) |  | wibble::tests::impl_ensure_similar(wibble::tests::Location(__FILE__, __LINE__, #x " == " #y), (x), (y), (prec))

## inner_ensure

#define inner_ensure | ( |  | x | ) | wibble::tests::impl_ensure(wibble::tests::Location(loc, __FILE__, __LINE__, #x), (x))

## inner_ensure_contains

#define inner_ensure_contains | ( |  | x,
|  |  | y
| ) |  | wibblwibblempl_ensure_contains(wibble::tests::Location(loc, __FILE__, __LINE__, #x " == " #y), (x), (y))

## inner_ensure_equals

#define inner_ensure_equals | ( |  | x,
|  |  | y
| ) |  | wibble::tests::impl_ensure_equals(wibble::tests::Location(loc, __FILE__, __LINE__, #x " == " #y), (x), (y))

## inner_ensure_not_contains

#define inner_ensure_not_contains | ( |  | x,
|  |  | y
| ) |  | wibble::tests::impl_ensure_not_contains(wibble::tests::Location(loc, __FILE__, __LINE__, #x " == " #y), (x), (y))

## inner_ensure_similar

#define inner_ensure_similar | ( |  | x,
|  |  | y,
|  |  | prec
| ) |  | wibble::tests::impl_ensure_similar(wibble::tests::Location(loc, __FILE__, __LINE__, #x " == " #y), (x), (y), (prec))

## TESTGRP

#define TESTGRP | ( |  | name | ) |

Value:
typedef test_group<name ## _shar> tg; \
typedef tg::object to; \
tg name ## _tg (#name);

## wassert

#define wassert | ( |  | ... | ) | wibble_test_runner(wibble_test_location.nest(wibble_test_location_info, __FILE__, __LINE__, #__VA_ARGS__), _wassert, ##__VA_ARGS__)

## WIBBLE_TEST_INFO

#define WIBBLE_TEST_INFO | ( |  | name | ) |

Value:
wibble::tests::LocationInfo wibble_test_location_info; \
wibble::tests::LocationInfo& name = wibble_test_location_info
wibble::tests::LocationInfo
Definition: tests.h:73
wibble_test_location_info
const wibble::tests::LocationInfo wibble_test_location_info
Definition: tests.cpp:17

Use this to declare a local variable with the given name that will be picked up by tests as extra local info.

## WIBBLE_TEST_LOCPRM

#define WIBBLE_TEST_LOCPRM wibble::tests::Location wibble_test_location

## wibble_test_runner

#define wibble_test_runner | ( |  | loc,
|  |  | func,
|  |  | ...
| ) |  |

Value:
do { try { \
func(loc, ##__VA_ARGS__); \
} catch (tut::failure) { \
throw; \
} catch (std::exception& e) { \
loc.fail_test(e.what()); \
} } while(0)
tut::failure
Exception to be throwed when ensure() fails or fail() called.
Definition: tut.h:76

## WIBBLE_TESTS_ALWAYS_THROWS

#define WIBBLE_TESTS_ALWAYS_THROWS __attribute__ ((noreturn))

## wrunchecked

#define wrunchecked | ( |  | func | ) |

Value:
do { try { \
func; \
} catch (tut::failure) { \
throw; \
} catch (std::exception& e) { \
wibble_test_location.fail_test(wibble_test_location_info, __FILE__, __LINE__, #func, e.what()); \
} } while(0)

## wruntest

#define wruntest | ( |  | test,
|  |  | ...
| ) |  | wibble_test_runner(wibble_test_location.nest(wibble_test_location_info, __FILE__, __LINE__, "function: " #test "(" #__VA_ARGS__ ")"), test, ##__VA_ARGS__)

## Variable Documentation

## wibble_test_location

const wibble::tests::Location wibble_test_location

extern

Referenced by wibble::tests::TestBool< A >::check(), wibble::tests::TestEquals< A, E >::check(), wibble::tests::TestIsLt< A, E >::check(), wibble::tests::TestIsLte< A, E >::check(), wibble::tests::TestIsGt< A, E >::check(), wibble::tests::TestIsGte< A, E >::check(), wibble::tests::TestStartsWith::check(), wibble::tests::TestEndsWith::check(), wibble::tests::TestContains::check(), wibble::tests::TestRegexp::check(), wibble::tests::TestFileExists::check(), wibble::tests::test_assert_contains(), wibble::tests::test_assert_endswith(), wibble::tests::test_assert_file_exists(), wibble::tests::test_assert_istrue(), wibble::tests::test_assert_not_file_exists(), wibble::tests::test_assert_re_match(), and wibble::tests::test_assert_startswith().

## wibble_test_location_info

const wibble::tests::LocationInfo wibble_test_location_info

extern