the Compartmented Robust Posix C++ Unit Test system

crpcut::get_parameter()

Get the value of a named parameter defined with the -p name=value / --param=name=value command line parameter.

Used in: A test function body, the constructor or destructor of a fixture, or a function called from them. See TEST(name, ...).

crpcut::get_parameter() exists in no less than five flavours.

Flavour

const char *crpcut::get_parameter(const char *name)

Returns the raw C-string value of the parameter, or 0 if no parameter was defined with the provided name.

template <typename T> void crpcut::get_parameter(const char *name, T& t)

Convert the raw value to type T by means of operator>>(std::istream&, T&). If no parameter was defined with the provided name, or if the input streaming failed, the test will fail.

template <typename T> T crpcut::get_parameter(const char *name)

Convert the raw value to type T by means of operator>>(std::istream&, T&). If no parameter was defined with the provided name, or if the input streaming failed, the test will fail.

crpcut::istream_wrapper crpcut::get_parameter<std::istream>(const char *name)

Get an istream from the parameter to extract values from, possibly with the use of stream manipulators. The crpcut::istream_wrapper checks the results of the extractions and fails the test if the extraction fails.

crpcut::iastream crpcut::get_parameter<crpcut::relaxed<std::istream> >(const char *name)

Get an istream from the parameter to extract values from, possibly with the use of stream manipulators. The crpcut::iastream is a pure std::istream implementation, which will set the stream status bits for you to check.