C++ Test Script Language


WRAP <native method signature> <WRAP assertions>




The WRAP statement describes pre- and post-conditions for a method.

<native method signature> refers to an existing method within the class.
The return type may be omitted.
The parameters names may be omitted if the WRAP assertions do not refer to the parameters.
The parameters list may be omitted if the method is not overloaded and if the WRAP assertions do not refer to the parameters.

<WRAP assertions> is made of either one or several REQUIRE or ENSURE statements.

Wraps can be defined for any method of the class, whatever its access specifiers may be.

Wraps cannot be associated to an inherited method, defined in a base class. If you want to do so, define a WRAP in a contract associated with the base class.

If the method is virtual, and the WRAP does not belong to a SINGLE CLASS, the wrap definition also applies to any redefinition of the method, unless a specific wrap has been defined for the redefinition in a daughter class.


C++ source code:

class A {

int f ();

char *g (int); // overloaded method

void g(void *); // overloaded method


C++ Contract Check Script code:


WRAP f /OK */

REQUIRE ( /*... */ )

ENSURE ( /... */)


WRAP g /ambiguous -> error */

/... */


WRAP g(int) / OK */

/... */


WRAP g(void *p) / OK */

/... */