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  Location
struct  AssertFailed
struct  ExpectFailure

Defines

#define LOCATION(stmt)   Location( __FILE__, __LINE__, stmt )
#define LOCATION_I(stmt, i)   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_die()   assert_die_fn( LOCATION( "forbidden code path tripped" ) )

Typedefs

typedef void Test

Functions

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

Variables

int assertFailure

Define Documentation

#define assert (  )     assert_fn( LOCATION( #x ), x )
 
#define assert_die (  )     assert_die_fn( LOCATION( "forbidden code path tripped" ) )
#define assert_eq ( x,
 )     assert_eq_fn( LOCATION( #x " == " #y ), x, y )
#define assert_eq_l ( i,
x,
 )     assert_eq_fn( LOCATION_I( #x " == " #y, i ), x, y )
#define assert_leq ( x,
 )     assert_leq_fn( LOCATION( #x " <= " #y ), x, y )
#define assert_list_eq ( x,
 ) 
Value:
assert_list_eq_fn( LOCATION( #x " == " #y ), \
                       sizeof( y ) / sizeof( y[0] ), x, y )
#define assert_neq ( x,
 )     assert_neq_fn( LOCATION( #x " != " #y ), x, y )
#define assert_pred ( p,
 ) 
Value:
assert_pred_fn( \
        LOCATION( #p "( " #x " )" ), x, p( x ) )
#define LOCATION ( stmt   )     Location( __FILE__, __LINE__, stmt )
#define LOCATION_I ( stmt,
 )     Location( __FILE__, __LINE__, stmt, i )

Typedef Documentation

typedef void Test

Function Documentation

void assert_die_fn ( Location  l  ) 
template<typename X , typename Y >
void assert_eq_fn ( Location  l,
x,
y 
) [inline]
template<typename X >
void assert_fn ( Location  l,
x 
) [inline]
template<typename X , typename Y >
void assert_leq_fn ( Location  l,
x,
y 
) [inline]
template<typename X >
void assert_list_eq_fn ( Location  loc,
int  c,
l,
const typename X::Type  check[] 
) [inline]

References wibble::str::fmt().

template<typename X , typename Y >
void assert_neq_fn ( Location  l,
x,
y 
) [inline]
template<typename X >
void assert_pred_fn ( Location  l,
x,
bool  p 
) [inline]
void beginAssertFailure (  )  [inline]

References assertFailure.

Referenced by ExpectFailure::ExpectFailure().

void endAssertFailure (  )  [inline]

References assert, and assertFailure.

Referenced by ExpectFailure::~ExpectFailure().

template<typename X >
AssertFailed& operator<< ( AssertFailed f,
x 
) [inline]

References AssertFailed::str.


Variable Documentation

Generated on Wed May 12 00:53:32 2010 for wibble by  doxygen 1.6.3