Omitting a Field’s Initial and Test Values

Component Testing for C

You can only initialize and test structured variables with the following forms:

If a field of a structured variable needs to be initialized or tested in a different way, you can omit its initial and expected values from the global test of the structured variable, and run a separate test on this field.

The following example illustrates this:

TEST 4

  FAMILY nominal

  ELEMENT

    VAR l, init = NIL, ev = NONIL

    VAR *l, init == , ev = {,NIL,NIL}

    VAR s, init in {"foo","bar"}, ev = init

    VAR l->str, init ==, ev(s) in {"foo","bar"}

    #l = push(l,s);

  END ELEMENT

END TEST

Using field names, write this as follows:

VAR *l, init ==, ev = {next=>NIL,prev=>NIL}

Related Topics

Testing VariablesTesting a Structured VariableTesting a Structured Variable with C ExpressionsTesting a Structured Variable with Another Structured VariableC Unions