Testing Character Arrays

Component Testing for Ada

Character arrays are a special case. Variables of this type are processed as character strings delimited by quotes.

You therefore need to initialize and test character arrays using character strings, as the following list example illustrates.

If you want to test character arrays like other arrays, you must use a format modification declaration (FORMAT instruction) to change them to arrays of integers.

Example

The following list example illustrates this type of modification:

TEST 2

FAMILY nominal

ELEMENT

VAR l, init = NIL, ev = NONIL

VAR s, init = "foo", ev = init

VAR l.str(1..5), init = "foo" , ev = ('f','o','o')

#l := stack(s, l);

END ELEMENT

END TEST

Related Topics

Testing variables | Testing arrays | Testing an array with pseudo-variables | Testing large arrays | Testing arrays with lists | Testing arrays with other arrays