|
QuickCheck++
0.0.3
Automated testing library
|
All classes, data generators and printers exported by QuickCheck++ are in the quickcheck namespace. More...
Classes | |
| class | PropertyBase |
| Generic property. More... | |
| class | Property |
| 5-argument property. More... | |
| class | Property< A, B, C, D > |
| 4-argument property. More... | |
| class | Property< A, B, C > |
| 3-argument property. More... | |
| class | Property< A, B > |
| 2-argument property. More... | |
| class | Property< A > |
| 1-argument property. More... | |
Enumerations | |
| enum | Unit { UNIT } |
| A dummy type to help simulating variadic templates. More... | |
Functions | |
| template<class A > | |
| A | generateInRange (A low, A high) |
| Generates a value in a range. | |
| template<class A , class Iter > | |
| A | oneOf (Iter first, Iter last) |
| Chooses randomly an element out of a sequence. | |
| template<class A > | |
| A | generateInteger (size_t n) |
| Generates randomly an integer value. | |
| static void | generate (size_t, bool &out) |
| Generates a boolean value randomly. | |
| static void | generate (size_t n, char &out) |
| Generates a character at random. | |
| static void | generate (size_t n, unsigned char &out) |
| Generates a character at random. | |
| static void | generate (size_t n, short &out) |
Generates a short integer in range [-n, n]. | |
| static void | generate (size_t n, unsigned short &out) |
Generates an unsigned short integer in range [0, n]. | |
| static void | generate (size_t n, int &out) |
Generates an integer in range [-n, n]. | |
| static void | generate (size_t n, unsigned int &out) |
Generates an unsigned integer in range [0, n]. | |
| static void | generate (size_t n, long &out) |
Generates a long integer in range [-n, n]. | |
| static void | generate (size_t n, unsigned long &out) |
Generates an unsigned long integer in range [0, n]. | |
| static void | generate (size_t n, float &out) |
Generates a single-precision floating point value in range [-n, n]. | |
| static void | generate (size_t n, double &out) |
Generates a double-precision floating point value in range [-n, n]. | |
| static void | generate (size_t n, long double &out) |
Generates a long double floating point value in range [-n, n]. | |
| template<class A > | |
| void | generate (size_t n, std::vector< A > &out) |
Generates a vector of 0 to n randomly-generated values of type A. | |
| template<class A > | |
| std::ostream & | operator<< (std::ostream &out, const std::vector< A > &xs) |
| Insertion operator for vectors. | |
| template<class A > | |
| void | printArgument (std::ostream &out, size_t n, const A &a) |
| Prints an argument. | |
| template<> | |
| void | printArgument (std::ostream &, size_t, const Unit &) |
Specialisation of printArgument for Unit. | |
| template<class Prop > | |
| bool | check (const char *msg, size_t n=100, size_t max=0, bool isVerbose=false, std::ostream &out=std::cout) |
| Creates and verifies a property. | |
All classes, data generators and printers exported by QuickCheck++ are in the quickcheck namespace.
| enum quickcheck::Unit |
| bool quickcheck::check | ( | const char * | msg, |
| size_t | n = 100, |
||
| size_t | max = 0, |
||
| bool | isVerbose = false, |
||
| std::ostream & | out = std::cout |
||
| ) |
Creates and verifies a property.
Prints "Checking that\c msg..." and then instantiate and verifies the property Prop.
| Prop | the property type |
| msg | the message identifying the property |
| n | the number of random tests to run |
| max | the maximum number of attempts to generate valid input (defaults to 5 * n if lower than n) |
| isVerbose | true if input should be printed before each test |
| out | the output stream to use |
true if verification succeeded and false otherwise
|
inlinestatic |
Generates a boolean value randomly.
The size hint is ignored.
| out | the reference to be set to true or false at random |
|
inlinestatic |
Generates a character at random.
For low values of n, the character is alphanumeric. For intermediate values, it is ASCII and printable. For high values of n, the generated character can have any value in its range, even if it means it is not ASCII and/or not printable.
n > 94) n > 94)| n | the size hint, influences the basicness of generated character |
| out | the reference to be set to the generated character |
|
inlinestatic |
Generates a character at random.
For low values of n, the character is alphanumeric. For intermediate values, it is ASCII and printable. For high values of n, the generated character can have any value in its range, even if it means it is not ASCII and/or not printable.
n > 94) n > 94)| n | the size hint, influences the basicness of generated character |
| out | the reference to be set to the generated character |
|
inlinestatic |
Generates a short integer in range [-n, n].
| n | the size hint |
| out | the reference to be set to the generated value |
|
inlinestatic |
Generates an unsigned short integer in range [0, n].
| n | the size hint |
| out | the reference to be set to the generated value |
|
inlinestatic |
Generates an integer in range [-n, n].
| n | the size hint |
| out | the reference to be set to the generated value |
|
inlinestatic |
Generates an unsigned integer in range [0, n].
| n | the size hint |
| out | the reference to be set to the generated value |
|
inlinestatic |
Generates a long integer in range [-n, n].
| n | the size hint |
| out | the reference to be set to the generated value |
|
inlinestatic |
Generates an unsigned long integer in range [0, n].
| n | the size hint |
| out | the reference to be set to the generated value |
|
inlinestatic |
Generates a single-precision floating point value in range [-n, n].
| n | the size hint |
| out | the reference to be set to the generated value |
|
inlinestatic |
Generates a double-precision floating point value in range [-n, n].
| n | the size hint |
| out | the reference to be set to the generated value |
|
inlinestatic |
Generates a long double floating point value in range [-n, n].
| n | the size hint |
| out | the reference to be set to the generated value |
| void quickcheck::generate | ( | size_t | n, |
| std::vector< A > & | out | ||
| ) |
Generates a vector of 0 to n randomly-generated values of type A.
| A | the element type |
| n | the size hint |
| out | the reference to be set to the generated value |
| A quickcheck::generateInRange | ( | A | low, |
| A | high | ||
| ) |
Generates a value in a range.
| A | the value type (must be numeric) |
| low | the lower bound (inclusive) |
| high | the higher bound (inclusive) |
low and high (both inclusive). | A quickcheck::generateInteger | ( | size_t | n | ) |
Generates randomly an integer value.
The value is taken in interval [0, n] for unsigned values and in interval [-n, n] for signed values. These intervals are of course clipped to the minimum and maximum values admissible for the returned type.
| A | the return type |
| n | the size hint |
[-n, n] and the A's range | A quickcheck::oneOf | ( | Iter | first, |
| Iter | last | ||
| ) |
Chooses randomly an element out of a sequence.
| first | an iterator pointing to first element |
| last | an iterator pointing to after-last element |
| std::ostream& quickcheck::operator<< | ( | std::ostream & | out, |
| const std::vector< A > & | xs | ||
| ) |
Insertion operator for vectors.
| out | the output stream to be printed on |
| xs | the vector to print |
| void quickcheck::printArgument | ( | std::ostream & | out, |
| size_t | n, | ||
| const A & | a | ||
| ) |
Prints an argument.
This template is used internally in PropertyBase to print input in case of failure or when verbose checking is requested.
| A | the argument type |
| out | the output stream to use |
| n | the argument number |
| a | the argument |
| void quickcheck::printArgument | ( | std::ostream & | , |
| size_t | , | ||
| const Unit & | |||
| ) |
Specialisation of printArgument for Unit.
Prints nothing.
1.8.1.2