QuickCheck++  0.0.3
Automated testing library
Namespaces | Functions
generate.hh File Reference

Defines the data generator interface. More...

#include <algorithm>
#include <cassert>
#include <cstdlib>
#include <limits>
#include <vector>

Go to the source code of this file.

Namespaces

namespace  quickcheck
 All classes, data generators and printers exported by QuickCheck++ are in the quickcheck namespace.

Functions

template<class A >
quickcheck::generateInRange (A low, A high)
 Generates a value in a range.
template<class A , class Iter >
quickcheck::oneOf (Iter first, Iter last)
 Chooses randomly an element out of a sequence.
template<class A >
quickcheck::generateInteger (size_t n)
 Generates randomly an integer value.
static void quickcheck::generate (size_t, bool &out)
 Generates a boolean value randomly.
static void quickcheck::generate (size_t n, char &out)
 Generates a character at random.
static void quickcheck::generate (size_t n, unsigned char &out)
 Generates a character at random.
static void quickcheck::generate (size_t n, short &out)
 Generates a short integer in range [-n, n].
static void quickcheck::generate (size_t n, unsigned short &out)
 Generates an unsigned short integer in range [0, n].
static void quickcheck::generate (size_t n, int &out)
 Generates an integer in range [-n, n].
static void quickcheck::generate (size_t n, unsigned int &out)
 Generates an unsigned integer in range [0, n].
static void quickcheck::generate (size_t n, long &out)
 Generates a long integer in range [-n, n].
static void quickcheck::generate (size_t n, unsigned long &out)
 Generates an unsigned long integer in range [0, n].
static void quickcheck::generate (size_t n, float &out)
 Generates a single-precision floating point value in range [-n, n].
static void quickcheck::generate (size_t n, double &out)
 Generates a double-precision floating point value in range [-n, n].
static void quickcheck::generate (size_t n, long double &out)
 Generates a long double floating point value in range [-n, n].
template<class A >
void quickcheck::generate (size_t n, std::vector< A > &out)
 Generates a vector of 0 to n randomly-generated values of type A.

Detailed Description

Defines the data generator interface.

This file also contains some functions and templates defining generators for basic types and containers.

Todo:

more generators (e.g. strings and other containers than vectors)

implement more generator helper functions