#include "CTBveri.hxx"
Public Types | |
typedef bool(* | pveriproc_t )(CTBveri &) |
Public Methods | |
CTBveri () | |
~CTBveri () | |
void | Register (CTBint i_ind, pveriproc_t p_vp, const char *c_text) |
int | Exec (int argc, char *argv[]) |
bool | Verbosity (int i_level) const |
CTBuint32 | RandomInt () |
double | Random () |
CTBint | RandomInt (CTBint i_high) |
CTBint | RandomInt (CTBint i_low, CTBint i_high) |
CTBint | RandomInt1X (CTBint i_low, CTBint i_high) |
double | Random (double d_low, double d_high) |
bool | RandomBool (double d_prob) |
void | RandomVector (CTBint i_ran[], CTBint i_size, CTBint i_high) |
void | RandomVector (CTBint i_ran[], CTBint i_size, CTBint i_low, CTBint i_high) |
void | RandomVector (bool b_ran[], CTBint i_size, double d_prob) |
void | RandomPermutation (CTBint i_perm[], CTBint i_size) |
Private Methods | |
void | RandomSeed (CTBuint32 i_seed) |
Private Attributes | |
CTBint | mi_nalloc |
pveriproc_t * | mp_vp |
const char ** | mc_text |
bool * | mb_active |
CTBuint32 | mi_seed |
CTBuint32 | mi_sx |
CTBuint32 | mi_sy |
CTBuint32 | mi_sz |
CTBuint32 | mi_sc |
CTBuint32 | mi_sn |
int | mi_verbosity |
The class CTBveri
provides all the infrastructure to implement a test and verification program. It is essentially a driver to execute a set of test routines under the control of command line options.
Definition at line 16 of file CTBveri.hxx.
|
Typedef for a `pointer to a test procedure'. Note that all test procedures have the signature bool test(CTBveri&) |
|
Constructor.
Definition at line 43 of file CTBveri.cxx. |
|
Destructor.
Definition at line 56 of file CTBveri.cxx. |
|
Register a test procedure. Registers the function p_vp as test number i_ind and associates the text c_text with this test. Note, that the test number i_ind must be >= 1. The text c_text should be a literal constant. It is displayed when the test program is called with the -? option. Definition at line 71 of file CTBveri.cxx. |
|
Execute tests. Interprets the command line arguments passed as argc and argv and executes the selected tests. It returns 0 if all selected tests passed and != 0 if one test failed. A call to Exec() is usually called in the return statement of the main program, like in int main(int argc, char* argv[]) { CTBveri vd; vd.Register( 1,test_01,"Random insert/delete, check find"); vd.Register( 2,test_02,"Random map, check Find, FindLess(Greater)Equal"); return vd.Exec(argc,argv); } Definition at line 136 of file CTBveri.cxx. |
|
Checks desired output verbosity level. Returns true if the desired output verbosity level, controlled with the -v switches, is above or equal to i_level. The default verbosity level is 0, -v sets it to 1, -vn to n (where n=1-4). It is typically used in constructs like if (vd.Verbosity(1)) cout << "--> Map range " << i_range << endl; Definition at line 245 of file CTBveri.cxx. |
|
Return a random unsigned 32bit integer. This function returns a random unsigned 32bit integer and is the basis for all other random number functions in this class. It uses a combination generator proposed in George Marsaglia and Arif Zaman, Computers in Physics, Vol. 8, 1994, p. 117 mzran13 . It combines a `subtract with borrow' generator and congruential generator and has a period of about 2**125.
Definition at line 264 of file CTBveri.cxx. Referenced by Random(), RandomPermutation(), and RandomVector().
|
|
Return a random double in the range [0,1). Returns a random double in the range [0,1), so the result can be 0. (and will be with exactly 1 in 2^32 cases) but will always be less than 1. Definition at line 290 of file CTBveri.cxx. Referenced by Random(), RandomBool(), RandomInt(), and RandomInt1X().
|
|
Return a random integer in the range [0,i_high). Return a random signed integer in the range [0,i_high). All integers between 0 and i_high - 1 will be returned with equal probability. Definition at line 301 of file CTBveri.cxx. |
|
Return a random integer in the range [i_low,i_high). Return a random signed integer in the range [i_low,i_high). All integers between i_low and i_high - 1 will be returned with equal probability. Definition at line 316 of file CTBveri.cxx. |
|
Returns a random integer with a 1/x distribution. Return a random signed integer in the range [i_low,i_high). All integers i between i_low and i_high - 1 will be returned with equal probability of 1/i. Thus small numbers are more probable than large numbers. Definition at line 332 of file CTBveri.cxx. |
|
Return a random double in the range [d_low,d_high).
Definition at line 352 of file CTBveri.cxx. |
|
Generate a random boolean.
Returns Definition at line 362 of file CTBveri.cxx. Referenced by RandomVector().
|
|
Generate vector with random integers. The vector i_ran is fill with i_size random integers in the range [0,i_high). Definition at line 373 of file CTBveri.cxx. |
|
Generate vector with random integers. The vector i_ran is fill with i_size random integers in the range [i_low,i_high). Definition at line 385 of file CTBveri.cxx. |
|
Generate vector with random booleans.
The vector b_ran is fill with i_size random booleans which have a probability of d_prob of being Definition at line 398 of file CTBveri.cxx. |
|
Generate a random permutation. The integer array i_perm of size i_size is filled with a random permutation of the numbers 0,1,..,i_size-1. Definition at line 410 of file CTBveri.cxx. |
|
Definition at line 445 of file CTBveri.cxx. Referenced by CTBveri(), and Exec().
|
|
Definition at line 56 of file CTBveri.hxx. |
|
Definition at line 57 of file CTBveri.hxx. |
|
Definition at line 58 of file CTBveri.hxx. |
|
Definition at line 59 of file CTBveri.hxx. |
|
Definition at line 60 of file CTBveri.hxx. |
|
Definition at line 61 of file CTBveri.hxx. |
|
Definition at line 62 of file CTBveri.hxx. |
|
Definition at line 63 of file CTBveri.hxx. |
|
Definition at line 64 of file CTBveri.hxx. |
|
Definition at line 65 of file CTBveri.hxx. |
|
Definition at line 66 of file CTBveri.hxx. |