wibble  1.1
Classes | Namespaces | Macros | Typedefs | Functions
test.h File Reference
#include <wibble/string.h>
#include <iostream>
#include <cstdlib>
Include dependency graph for test.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wibble::Location
 
struct  wibble::AssertFailed
 
struct  wibble::ExpectFailure
 

Namespaces

 wibble
 

Macros

#define LOCATION(stmt)   ::wibble::Location( __FILE__, __LINE__, stmt )
 
#define LOCATION_I(stmt, i)   ::wibble::Location( __FILE__, __LINE__, stmt, i )
 
#define assert(x)   assert_fn( LOCATION( #x ), x )
 
#define assert_pred(p, x)
 
#define assert_eq(x, y)   assert_eq_fn( LOCATION( #x " == " #y ), x, y )
 
#define assert_leq(x, y)   assert_leq_fn( LOCATION( #x " <= " #y ), x, y )
 
#define assert_eq_l(i, x, y)   assert_eq_fn( LOCATION_I( #x " == " #y, i ), x, y )
 
#define assert_neq(x, y)   assert_neq_fn( LOCATION( #x " != " #y ), x, y )
 
#define assert_list_eq(x, y)
 
#define assert_unreachable(...)   assert_die_fn( LOCATION( wibble::str::fmtf(__VA_ARGS__) ) )
 
#define assert_unimplemented()   assert_die_fn( LOCATION( "not imlemented" ) )
 
#define assert_die()   assert_die_fn( LOCATION( "forbidden code path tripped" ) )
 

Typedefs

typedef void Test
 

Functions

template<typename X >
AssertFailed & wibble::operator<< (AssertFailed &f, X x)
 
template<typename X >
void wibble::assert_fn (Location l, X x)
 
void wibble::assert_die_fn (Location l)
 
template<typename X , typename Y >
void wibble::assert_eq_fn (Location l, X x, Y y)
 
template<typename X , typename Y >
void wibble::assert_leq_fn (Location l, X x, Y y)
 
template<typename X >
void wibble::assert_pred_fn (Location l, X x, bool p)
 
template<typename X >
void wibble::assert_list_eq_fn (Location loc, int c, X l, const typename X::Type check[])
 
template<typename X , typename Y >
void wibble::assert_neq_fn (Location l, X x, Y y)
 
void wibble::beginAssertFailure ()
 
void wibble::endAssertFailure ()
 

Macro Definition Documentation

◆ assert

#define assert (   x)    assert_fn( LOCATION( #x ), x )

◆ assert_die

#define assert_die ( )    assert_die_fn( LOCATION( "forbidden code path tripped" ) )

◆ assert_eq

#define assert_eq (   x,
 
)    assert_eq_fn( LOCATION( #x " == " #y ), x, y )

◆ assert_eq_l

#define assert_eq_l (   i,
  x,
 
)    assert_eq_fn( LOCATION_I( #x " == " #y, i ), x, y )

◆ assert_leq

#define assert_leq (   x,
 
)    assert_leq_fn( LOCATION( #x " <= " #y ), x, y )

◆ assert_list_eq

#define assert_list_eq (   x,
 
)
Value:
assert_list_eq_fn( LOCATION( #x " == " #y ), \
sizeof( y ) / sizeof( y[0] ), x, y )
void assert_list_eq_fn(Location loc, int c, X l, const typename X::Type check[])
Definition: test.h:127
#define LOCATION(stmt)
Definition: test.h:23

◆ assert_neq

#define assert_neq (   x,
 
)    assert_neq_fn( LOCATION( #x " != " #y ), x, y )

◆ assert_pred

#define assert_pred (   p,
 
)
Value:
LOCATION( #p "( " #x " )" ), x, p( x ) )
void assert_pred_fn(Location l, X x, bool p)
Definition: test.h:118

◆ assert_unimplemented

#define assert_unimplemented ( )    assert_die_fn( LOCATION( "not imlemented" ) )

◆ assert_unreachable

#define assert_unreachable (   ...)    assert_die_fn( LOCATION( wibble::str::fmtf(__VA_ARGS__) ) )

◆ LOCATION

#define LOCATION (   stmt)    ::wibble::Location( __FILE__, __LINE__, stmt )

◆ LOCATION_I

#define LOCATION_I (   stmt,
 
)    ::wibble::Location( __FILE__, __LINE__, stmt, i )

Typedef Documentation

◆ Test

typedef void Test