#include <Property.hh>

Public Member Functions | |
| PropertyBase () | |
| Constructor. | |
| virtual | ~PropertyBase () |
| Destructor. | |
| bool | check (size_t n=100, size_t max=0, bool isVerbose=false, std::ostream &out=std::cout) |
| Checks this property. | |
Protected Member Functions | |
| void | _addFixed (const A &a, const B &b, const C &c, const D &d, const E &e) |
| Adds a fixed test case for with the given arguments. | |
Private Member Functions | |
| void | printInput (std::ostream &out, const A &a, const B &b, const C &c, const D &d, const E &e) |
| Prints the given input arguments on the given output stream. | |
| virtual size_t | sizeHint (size_t testNo) |
| Converts the random test number into a size hint. | |
| virtual bool | _accepts (const A &a, const B &b, const C &c, const D &d, const E &e)=0 |
| Generic wrapper for Property::accepts. | |
| virtual const std::string | _classify (const A &a, const B &b, const C &c, const D &d, const E &e)=0 |
| Generic wrapper for Property::classify. | |
| virtual void | _generateInput (size_t n, A &a, B &b, C &c, D &d, E &e)=0 |
| Generic wrapper for Property::generateInput. | |
| virtual bool | _holdsFor (const A &a, const B &b, const C &c, const D &d, const E &e)=0 |
| Generic wrappper for Property::holdsFor. | |
| virtual bool | _isTrivialFor (const A &a, const B &b, const C &c, const D &d, const E &e)=0 |
| Generic wrapper for Property::isTrivialFor. | |
Private Attributes | |
| std::vector< Input > | _fixedInputs |
| A vector of fixed inputs that are tested in addition to randomly-generated inputs. | |
Classes | |
| struct | Input |
| Input type. More... | |
This class models a verifiable property about some code fragment. It is not meant to be used or derived from directly but rather serves as a base for the various n-argument classes Property. This is just an artefact due to the fact that C++ 98 does not support variadic templates. It can model up to 5-arguments properties.
| A | first argument type | |
| B | second argument type or Unit if less than two arguments | |
| C | third argument type or Unit if less than three arguments | |
| D | fourth argument type or Unit if less than four arguments | |
| E | fifth argument type or Unit if less than five arguments |
| quickcheck::PropertyBase< A, B, C, D, E >::PropertyBase | ( | ) | [inline, explicit] |
Constructor.
| quickcheck::PropertyBase< A, B, C, D, E >::~PropertyBase | ( | ) | [inline, virtual] |
Destructor.
| bool quickcheck::PropertyBase< A, B, C, D, E >::check | ( | size_t | n = 100, |
|
| size_t | max = 0, |
|||
| bool | isVerbose = false, |
|||
| std::ostream & | out = std::cout | |||
| ) | [inline] |
Checks this property.
This method will verify that this property holds for all the fixed inputs and for a number of randomly generated inputs. It prints messages about success or failure (and optionally process) on the given output stream.
| 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 all tests succeeded and false if a test failed or if a sufficient number of tests could not be generated | void quickcheck::PropertyBase< A, B, C, D, E >::_addFixed | ( | const A & | a, | |
| const B & | b, | |||
| const C & | c, | |||
| const D & | d, | |||
| const E & | e | |||
| ) | [inline, protected] |
Adds a fixed test case for with the given arguments.
This function allows to ensure that some carefully chosen test cases will be checked in addition to the randomly-generated ones.
| a | the first argument of the test case | |
| b | the second argument of the test case | |
| c | the third argument of the test case | |
| d | the fourth argument of the test case | |
| e | the fifth argument of the test case |
| void quickcheck::PropertyBase< A, B, C, D, E >::printInput | ( | std::ostream & | out, | |
| const A & | a, | |||
| const B & | b, | |||
| const C & | c, | |||
| const D & | d, | |||
| const E & | e | |||
| ) | [inline, private] |
Prints the given input arguments on the given output stream.
| out | the output stream to use | |
| a | the first argument | |
| b | the second argument or UNIT if less than two arguments | |
| c | the third argument or UNIT if less than three arguments | |
| d | the fourth argument or UNIT if less than four arguments | |
| e | the fifth argument or UNIT if less than five arguments |
| size_t quickcheck::PropertyBase< A, B, C, D, E >::sizeHint | ( | size_t | testNo | ) | [inline, private, virtual] |
Converts the random test number into a size hint.
| testNo | the number of the current random test |
| virtual bool quickcheck::PropertyBase< A, B, C, D, E >::_accepts | ( | const A & | a, | |
| const B & | b, | |||
| const C & | c, | |||
| const D & | d, | |||
| const E & | e | |||
| ) | [private, pure virtual] |
Generic wrapper for Property::accepts.
| a | the first argument | |
| b | the second argument or UNIT if less than two arguments | |
| c | the third argument or UNIT if less than three arguments | |
| d | the fourth argument or UNIT if less than four arguments | |
| e | the fifth argument or UNIT if less than five arguments |
true if arguments forms valid input and false otherwise Implemented in quickcheck::Property< A, B, C, D, E >.
| virtual const std::string quickcheck::PropertyBase< A, B, C, D, E >::_classify | ( | const A & | a, | |
| const B & | b, | |||
| const C & | c, | |||
| const D & | d, | |||
| const E & | e | |||
| ) | [private, pure virtual] |
Generic wrapper for Property::classify.
| a | the first argument | |
| b | the second argument or UNIT if less than two arguments | |
| c | the third argument or UNIT if less than three arguments | |
| d | the fourth argument or UNIT if less than four arguments | |
| e | the fifth argument or UNIT if less than five arguments |
Implemented in quickcheck::Property< A, B, C, D, E >.
| virtual void quickcheck::PropertyBase< A, B, C, D, E >::_generateInput | ( | size_t | n, | |
| A & | a, | |||
| B & | b, | |||
| C & | c, | |||
| D & | d, | |||
| E & | e | |||
| ) | [private, pure virtual] |
Generic wrapper for Property::generateInput.
| n | the size hint | |
| a | the first argument | |
| b | the second argument or UNIT if less than two arguments | |
| c | the third argument or UNIT if less than three arguments | |
| d | the fourth argument or UNIT if less than four arguments | |
| e | the fifth argument or UNIT if less than five arguments |
Implemented in quickcheck::Property< A, B, C, D, E >.
| virtual bool quickcheck::PropertyBase< A, B, C, D, E >::_holdsFor | ( | const A & | a, | |
| const B & | b, | |||
| const C & | c, | |||
| const D & | d, | |||
| const E & | e | |||
| ) | [private, pure virtual] |
Generic wrappper for Property::holdsFor.
| a | the first argument | |
| b | the second argument or UNIT if less than two arguments | |
| c | the third argument or UNIT if less than three arguments | |
| d | the fourth argument or UNIT if less than four arguments | |
| e | the fifth argument or UNIT if less than five arguments |
true if the property holds and false otherwise Implemented in quickcheck::Property< A, B, C, D, E >.
| virtual bool quickcheck::PropertyBase< A, B, C, D, E >::_isTrivialFor | ( | const A & | a, | |
| const B & | b, | |||
| const C & | c, | |||
| const D & | d, | |||
| const E & | e | |||
| ) | [private, pure virtual] |
Generic wrapper for Property::isTrivialFor.
| a | the first argument | |
| b | the second argument or UNIT if less than two arguments | |
| c | the third argument or UNIT if less than three arguments | |
| d | the fourth argument or UNIT if less than four arguments | |
| e | the fifth argument or UNIT if less than five arguments |
true if the property is trivial for given arguments and false otherwise Implemented in quickcheck::Property< A, B, C, D, E >.
std::vector<Input> quickcheck::PropertyBase< A, B, C, D, E >::_fixedInputs [private] |
A vector of fixed inputs that are tested in addition to randomly-generated inputs.
1.5.6