#include <assert.h>
#include <rpa/configuration.h>
#include <iterator>
#include <vector>
#include <rpa/architectures/posix.h>
#include <iostream>
#include <typeinfo>
Namespaces | |
namespace | rpa |
Classes | |
struct | rpa::__assert_le< IterCat > |
Used to check whether an interval iterator is shorter or equal a given size. More... | |
struct | rpa::__assert_le< std::output_iterator_tag > |
If the iterator is an output_iterator, we cannot check anything. More... | |
struct | rpa::probe_aux< Iter, IterCat > |
struct | rpa::probe_aux< Iter, std::output_iterator_tag > |
Testing the content of an output iterator is meaningless. More... | |
struct | rpa::probe_aux< Iter, std::input_iterator_tag > |
struct | rpa::probe_range_aux< Iter, IterCat > |
Does the same as 'probe', but repetitively on a range of iterators. More... | |
struct | rpa::probe_range_aux< Iter, std::output_iterator_tag > |
struct | rpa::probe_range_aux< Iter, std::input_iterator_tag > |
class | rpa::bound_check< Iterator > |
class | rpa::profiler |
Created by testing programs to have the same output, and do monitorings. More... | |
Defines | |
#define | numberof(arr) ( sizeof(arr)/sizeof(arr[0]) ) |
#define | asrt(a) assert(a) |
'abort' does nto work properly on Cygwin so we use 'assert'. | |
#define | assert_declare(t, n) t n |
#define | assert_exec(f) f |
#define | assert_ctor(n, v) ,n(v) |
#define | assert_stub(a) { abort(); return a ; } |
#define | assert_le(a, b, c) assert_le_aux(a,b,c) |
#define | assert_check_container(C) asrt((size_t)std::distance((C).begin(),(C).end())==(C).size()) |
#define | bugchk(a) (a)->check() |
#define | runchk(a) (a)->check() |
#define | RPA_WITH_LOG |
#define | LOG(a) rpa::stream_log(__FILE__,__LINE__)<<a<<'\n' |
#define | LOG_THIS(a) rpa::stream_log_this(typeid(*this),this,__FILE__,__LINE__)<<a<<'\n' |
#define | LOG_THIS_OBJECT(a) rpa::log_this_object(typeid(*this),this,__FILE__,__LINE__).stream()<<a<<'\n' |
#define | THIS_NAME typeid(*this).name() |
#define | NAME(a) typeid(a).name() |
#define | UNDEFINED_DISTANCE 87654321 |
#define | RPA_INT_STR 10 |
#define | TST_RATIO 1 |
Typedefs | |
typedef thread_crea | rpa::testing_thread |
typedef mutex_void | rpa::testing_mutex |
typedef char | rpa::SampleStr [RPA_INT_STR] |
Functions | |
void | rpa::Asrt (bool aCond) |
template<class Iter> | |
void | rpa::assert_le_aux (Iter Beg, Iter End, size_t aN) |
std::ostream & | rpa::stream_log (const char *aFileName, int aLine) |
This implementation is based on the pthread library. | |
std::ostream & | rpa::stream_log_this (const std::type_info &aTypeInfo, const void *aThis, const char *aFileName, int aLine) |
template<class Iter> | |
void | rpa::probe (const Iter &anIt) |
This checks whether the input iterator is dereferenceable. | |
template<class Iter> | |
void | rpa::probe_range (const Iter &aBeg, const Iter &aEnd) |
This helper function is there to choose the right template. | |
template<class Iter> | |
void | rpa::probe_range (const Iter &aBeg, size_t aDist) |
This other function will test 'aDist' elements after the 'gebin'. | |
template<class Iter> | |
ptrdiff_t | rpa::__distance_safe (Iter aBeg, Iter aEnd, std::random_access_iterator_tag) |
template<class Iter> | |
ptrdiff_t | rpa::__distance_safe (Iter aBeg, Iter aEnd, std::forward_iterator_tag) |
As expected, this specialization runs in linear time. | |
template<class Iter> | |
ptrdiff_t | rpa::__distance_safe (Iter aBeg, Iter aEnd, std::bidirectional_iterator_tag) |
Same implementation as for a forward_iterator. | |
template<class Iter> | |
ptrdiff_t | rpa::__distance_safe (Iter aBeg, Iter aEnd, std::input_iterator_tag) |
This cannot return any significant value. | |
template<class Iter> | |
ptrdiff_t | rpa::distance_safe (Iter aBeg, Iter aEnd) |
template<class Iter> | |
void | rpa::check_distance_if (Iter aBeg, Iter aEnd, ptrdiff_t aSz) |
template<class Iterator> | |
bound_check< Iterator > | rpa::bound_checker (Iterator anIt, size_t aN) |
Helper for creating a bound_check object. | |
template<class Container> | |
static void | rpa::Display (const Container &aCont, const char *aMsg="", bool mustCrash=true) |
void | rpa::SampleBuild (SampleStr *aStr, char **aPtr, size_t aNb) |
For creating input samples. | |
template<class Cont> | |
void | rpa::SampleCmp (size_t aArgC, const char *const *aArgV, const Cont &aVecStr) |
void | rpa::stream_check (const std::basic_ios< char > &aIStr) |
Simply checks the internal state of a stream. |
#define asrt | ( | a | ) | assert(a) |
'abort' does nto work properly on Cygwin so we use 'assert'.
These three macros have to be used in conjuntion with 'asrt()'. They allow to declare or construct variables, and execute statements, for exclusive use of 'asrt()' statements.
#define assert_check_container | ( | C | ) | asrt((size_t)std::distance((C).begin(),(C).end())==(C).size()) |
Checks the internal consistency of a container. It is possible to extend this check, based on the container type.
#define assert_ctor | ( | n, | |||
v | ) | ,n(v) |
#define assert_declare | ( | t, | |||
n | ) | t n |
#define assert_exec | ( | f | ) | f |
#define assert_le | ( | a, | |||
b, | |||||
c | ) | assert_le_aux(a,b,c) |
#define assert_stub | ( | a | ) | { abort(); return a ; } |
#define bugchk | ( | a | ) | (a)->check() |
In optimized mode, we are sure that no call is made to check, even if the compiler is not very efficient.
#define LOG | ( | a | ) | rpa::stream_log(__FILE__,__LINE__)<<a<<'\n' |
#define LOG_THIS | ( | a | ) | rpa::stream_log_this(typeid(*this),this,__FILE__,__LINE__)<<a<<'\n' |
#define LOG_THIS_OBJECT | ( | a | ) | rpa::log_this_object(typeid(*this),this,__FILE__,__LINE__).stream()<<a<<'\n' |
#define NAME | ( | a | ) | typeid(a).name() |
#define numberof | ( | arr | ) | ( sizeof(arr)/sizeof(arr[0]) ) |
#define RPA_INT_STR 10 |
#define RPA_WITH_LOG |
#define runchk | ( | a | ) | (a)->check() |
In debug mode, this does the same as bugchk. In release mode, it only does the checks of the method check(), which are still there in the release version. Aimed at run-time checks.
#define THIS_NAME typeid(*this).name() |
#define TST_RATIO 1 |
It multiplies the number of samples processed by testing programs. It allows to increase or decrease the tests durations. Specifically, it allows to make a quick complete test.
#define UNDEFINED_DISTANCE 87654321 |