C++ contract check scripts (.otc)

Component Testing for C++ uses its own simple language for describing contracts.

This section describes each keyword of the C++ contract check language, including:

Notation conventions

Throughout this guide, command notation and argument parameters use the following standard convention:

 

Notation

Example

Meaning

BOLD

BEGIN

Language keyword

<italic>

<filename>

Symbolic variables

[   ]

[<option>]

Optional items

{   }

{<filenames>}

Series of values

[{   }]

[{<filenames>}]

Optional series of variables

|

on | off

OR operator

 

C++ test driver script keywords are case insensitive. This means that STUB, stub, and Stub are interpreted the same way.

For conventional purposes however, this document uses upper-case notation for the C++ contract check script keywords in order to differentiate from native source code.

Split statements

C++ contract check script statements may be split over several lines in an .otc contract check script. Continued lines must start with the ampersand ('&') symbol to be recognized as a continuation of the previous line. No tabs or spaces should precede the ampersand.

Statements must be shorter than 2048 characters, although this limit may be lower on some platforms.

Language identifiers

A C++ contract check identifier is a text string used as a label, such as the name of a TEST or a STUB in an .otc contract check script.

Identifiers are made of an unlimited sequence of the following characters:

Spaces are not valid identifier characters.

Note that identifiers starting with a numeric character are allowed. The following statement, for example, is syntactically correct:

CLASS 1

{

..

}

 

C++ test driver script identifiers are case sensitive. This means that LABEL, label, and Label are three different identifiers.

Related Topics

C++ test driver script structureC++ test driver script keywordsC++ contract check scripts (.otc)