catsfoot Namespace Reference

Main namespace for Catsfoot. More...

Namespaces

namespace  details
 

Implementation details for Catsfoot.


Classes

struct  axiom_failure
 Exception class for axiom failure. More...
struct  verified
 User type traits for validating models. More...
struct  concept_list
 List representation of several concepts. More...
struct  eval
 Predicate evaluating models and predicates. More...
struct  class_assert_concept
 Checks that a concept is. More...
struct  equality
 Check whether T is comparable to U by ==. More...
struct  printable
 Check whether U is printable on a stream T. More...
struct  is_same
 Check whether T and U are the same type. More...
struct  equivalence
 Generic concept for equivalence relation. More...
struct  equivalence_eq
 Concept for equivalence relation with operator==. More...
struct  verified< equivalence_eq< T > >
 If == is an equivalence relation to T, then T is equivalence_eq. More...
struct  verified< equivalence< T, op_eq > >
 If T is equivalence_eq, then == is an equivalence relation to T. More...
struct  congruence
 Check whether an operation sees equality as congruence relation. More...
struct  congruence_eq
 Concept for congruence relation with operator==. More...
struct  verified< congruence_eq< T, Args...> >
 When T is a congruence for ==, then T is a congruence_eq. More...
struct  verified< congruence< op_eq, T, Args...> >
 When T is a congruence_eq, then T is a congruence for ==. More...
struct  concept
 Base marker for concepts. More...
struct  auto_concept
 Base marker for auto concepts. More...
struct  is_auto_concept
 Checks if T is an auto concept model. More...
struct  is_concept
 Checks if T is a concept model. More...
struct  product
struct  simple_product
struct  verified< product< Type, constructor_wrap< Type >, Projections...> >
struct  selector
 Constructible type used to select a type for overloaded functions. More...
struct  container
struct  generator_for
 Whether T is a generator of Type. More...
struct  default_generator
 Generator that build default constructors. More...
struct  list_data_generator
 Generator using lists of data provided by the user. More...
struct  pick_functor
struct  term_generator_builder
 Builds random term generators. More...
struct  undefined_return
 Return type used in case of error for is_callable. More...
struct  is_callable
 Default case: callable without parameters? More...
struct  is_callable< T(U...)>
 Tells whether T is callable with (U...) More...
struct  is_callable< void(U...)>
 Void is a special type that may induce extra error messages. More...
struct  is_constructible
 Undefined. More...
struct  is_constructible< T(U...)>
 Tells whether T is constructible with {U...}. More...
struct  is_constructible< void(U...)>
 Void is a special type that may induce extra error messages. More...
struct  undefined_member_type
 Type used return by has_member_... in case member does not exist. More...
struct  build_comparer
 This is class is used to build an black box equality engine. More...
struct  constant
 Functor returning and integral constant. More...
struct  wrapped
 Get the return type of the wrap function. More...
struct  disamb
 Disambiguates an overloaded functions address. More...
struct  disamb_const
 Disambiguates an overloaded const member. More...
struct  constructor_wrap
 Wraps constructors. More...
struct  op_eq
 Wraps operator==. More...
struct  op_neq
 Wraps operator!=. More...
struct  op_plus
 Wraps operator+. More...
struct  op_times
 Wraps operator*. More...
struct  op_lsh
 Wraps operator<<. More...
struct  op_lt
 Wraps operator<. More...
struct  op_inc
 Wraps operator++. More...
struct  op_post_inc
 Wraps operator++(T&, int) More...
struct  op_star
 Wraps operator*. More...
struct  wrapped_constructor
 Wraps constructor T. More...

Functions

EXTERN bool check_unverified (std::ostream &s=std::cerr)
 Tells whether some conditional axioms where never reached.
template<typename T >
void assert_concept (const T &)
 Assert that the concept T holds.
template<typename Rel , typename... E, typename Index = std::integral_constant<size_t, 0>, typename = typename std::enable_if <(Index::value == sizeof...(E))>::type, typename = void>
bool tuple_rel (Rel, const std::tuple< E...> &, const std::tuple< E...> &, Index=Index())
 Check that a relation holds for all elements on a pair of tuples.
template<typename Rel , typename... E, typename Index = std::integral_constant<size_t, 0>, typename >
bool tuple_rel (Rel rel, const std::tuple< E...> &a, const std::tuple< E...> &b, Index=Index())
 Check that a relation holds for all elements on a pair of tuples.
template<typename... T>
details::generator_choose
< typename std::decay< T >
::type...> 
choose (T &&...t)
 Combines generators.Picks the left-most generator capable or generating the requested data set.
 DEF_MEMBER_WRAPPER (begin)
 DEF_MEMBER_WRAPPER (end)
 DEF_MEMBER_WRAPPER (get)
template<typename T , typename Generator >
std::function< T()> pick (Generator &g)
template<typename Generator >
details::tuple_generator
< typename std::decay
< Generator >::type > 
tuple_gen (Generator &&g)
 Builds a tuple generator from element generators.
template<typename Model , typename Generator , typename Stream = decltype(std::cerr)>
bool test_all (Generator &g, Stream &s=std::cerr)
 Tests all axioms of model Model and its sub-models.
template<typename Generator , typename... T, typename Stream = decltype(std::cerr)>
bool test (Generator &g, void f(T...), std::string name="<unknown>", Stream &s=std::cerr)
 This will call f with parameters from g.
template<typename Fun , typename... Params>
bool catch_errors (Fun f, Params &&...values)
 This will call f with the parameters and catch any axiom error.
template<typename Op , typename Tuple >
details::call_with_ret< Op,
Tuple >::type 
call_with (Op &&op, Tuple &&args)
 Calls a function with arguments from a std::tuple.
template<typename Ret , typename... Args>
std::function< Ret(Args...)> wrap (Ret(*f)(Args...))
 Wraps a function.
template<typename T >
std::function< Twrap (const std::function< T > &f)
 Forwards function.
template<typename T >
std::function< Twrap (std::function< T > &&f)
 Forwards function.
template<typename T >
std::function< Tconstructor ()
 Wraps a constructor.
template<typename T >
details::remove_side_effect_helper
< typename std::decay< T >
::type > 
remove_side_effect (T t)

Variables

std::tuple< typename
std::decay< typename
is_callable< const Functions(const
Parameter &)>::result_type >
::type...> 
call_tuple (const std::tuple< Functions...> &functions, const Parameter &param)
 Calls a tuple of functions with an argument.
std::function< Ret(T &, Args...)> wrap (Ret(T::*f)(Args...))
 Wraps a non-const member function.

Detailed Description

Main namespace for Catsfoot.


Function Documentation

template<typename T >
void catsfoot::assert_concept ( const T )

Assert that the concept T holds.

This function does not do anything. It will however raise a static assertion in case T is not a valid concept.

template<typename Op , typename Tuple >
details::call_with_ret<Op, Tuple>::type catsfoot::call_with ( Op &&  op,
Tuple &&  args 
)

Calls a function with arguments from a std::tuple.

Parameters:
opA function.
argsThe tuple of arguments
Returns:
the result of op(args...)
template<typename Fun , typename... Params>
bool catsfoot::catch_errors ( Fun  f,
Params &&...  values 
)

This will call f with the parameters and catch any axiom error.

It is a shortcut for

 try {
   f(values...);
 } catch (axiom_failure af) {
   std::cerr << /*...*/;
 }
template<typename T >
std::function<T> catsfoot::constructor ( )

Wraps a constructor.

Template Parameters:
TSignature where return type is the class.

Variable Documentation

std::tuple<typename std::decay <typename is_callable <const Functions(const Parameter&)>::result_type>::type...> catsfoot::call_tuple(const std::tuple< Functions...> &functions, const Parameter &param)

Calls a tuple of functions with an argument.

Parameters:
functionsThe functions
paramThe parameter for calling the function
Returns:
the tuple of results
std::function< Ret(const T &, Args...)> catsfoot::wrap

Wraps a non-const member function.

Wraps a const member function.

We "functionalize" the method here.